mersenneforum.org some tools for weights computing...
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

2007-02-27, 19:04   #1
Thomas11

Feb 2003

192010 Posts
some tools for weights computing...

I was asked about the tools I'm using to compute the Nash weights for the larger k.
Since there might be some general interest, I'm uploading them into this thread, in hope that you find them useful. Thanks to MinGW I was able to prepare some Windows binaries too (since you're all Windoozers, right?).

You should note, that those tools where originally written for my personal use -- so there is no detailed information about the algorithms in the code, nor is there any help file etc...
Also note, that it's all about Riesel-ks, e.g. k*2^n-1. For the Proth-ks one has to modify the source code.

For general information related to the Nash weights you may also have a look into the 15k forum, where I already posted a Linux binary of the nash weight calculator.

The first tool (attached to this post) calculates the Nash weight for a single k. It should work for any k of arbitrary length.

Usage is:
Code:
nash <k>
for example:
Code:
nash 12345
12345 2060 2064
The output is of the form <k> <w> <w'>.
The difference between standard Nash weight (w) and modified Nash weight (w') is that the standard Nash weight is computed for n=100001-110000, while the modified Nash weight is for n=1-10000. The latter is related to the Proth weight:
Code:
Proth weight = w' / 1751.542
Due to the limitation of only one attachment per posting, I will post the other stuff in the following separate posts...
Attached Files
 nash.zip (45.4 KB, 479 views)

2007-02-27, 19:09   #2
Thomas11

Feb 2003

192010 Posts

The next one is a multiple-k Nash calculator. Note that the current version is restricted to k<2^64 (e.g unsigned long)

Usage is:
Code:
mnash <kmin> <kmax> <kstep>
for example:
Code:
mnash 1 10 2
1  925 1176
3 2976 2933
5 2180 2176
7  912  917
9 1674 1678
(This is the same as the older "nash3" in the 15k forum.)
Attached Files
 mnash.zip (15.8 KB, 402 views)

2007-02-27, 19:33   #3
Thomas11

Feb 2003

27×3×5 Posts

The final one is a bit different.
Since the Nash algorithm is quite slow when computing large ranges (e.g. millions) of k, one needs a faster tool. Therefore I implemented an ordinary sieve for p up to 512 and a smaller n range of only 1-1000. Due to precomputation of the "reversed orders of n" the whole calculation can be done in cache memory and is therefore really fast (e.g. about 3000 k/sec on a 1.7 GHz P4).

So one can use multi5 for a fast pre-scanning of a k-range and then do some sorting on the results and run the "good ones" through nash.

For some historic reason it is written in Fortran (and lacks any comments) and there are no command line options. Therefore you need to edit the steer.txt file for specifying the k-range and a print condition. The latter is necessary since otherwise the sieve would produce hundreds of megabytes of output within minutes...

The example steer.txt file reads:
Code:
32000000025             KMIN
32001000000             KMAX
30                      KSTEP
600                     minimum weight for printing
You may skip the text comments at the right. The printing condition means, that the k is only printed when the weight is higher or equal to the specified value (e.g. weight>=600 in the example). Note, that we use a smaller n-range (1-1000), therefore 600 is a rather high weight. The weights are roughly one tenth of the Nash weights. Also note the restriction of k<2^63 (signed long).

Usage is simply:
Code:
multi5
for the example steer.txt file you will get:
Code:
multi5
32000060235  609
32000107425  622
32000193225  612
32000315325  605
32000497485  640
32000553585  618
32000703735  674
32000816445  601
32000982585  622
If you want to store the results, you can simply redirect the output to a file, e.g.:
Code:
multi5 > my_ks.txt
Of course it works the some way for nash and mnash...
Attached Files
 multi5.zip (32.4 KB, 400 views)

Last fiddled with by Thomas11 on 2007-02-27 at 19:48

 2007-02-27, 19:42 #4 Thomas11     Feb 2003 27·3·5 Posts I forgot to mention: For nash and mnash I used a precompiled static GMP library. I haven't tested the binaries on a Windows machine without the GMP lib so far, nor have I tested them on a non-P4 (non-SSE2) machine. So, if you run into trouble, just let me know...
 2007-02-27, 20:46 #5 Flatlander I quite division it     "Chris" Feb 2005 England 31×67 Posts Nash Crash Nash crashes in Windows. I assume I need to download the library you mentioned? Could you provide a direct link please. XP Home Athlon XP 3200+ Last fiddled with by Flatlander on 2007-02-27 at 20:47 Reason: Spec. added.
2007-02-28, 10:09   #6
Thomas11

Feb 2003

27×3×5 Posts

Quote:
 Originally Posted by Flatlander Nash crashes in Windows. I assume I need to download the library you mentioned? Could you provide a direct link please. XP Home Athlon XP 3200+
I used the following (german) link:
http://www.bempf.de/c/gmp/gmp.html

But probably in your case the problem is, that the library is precompiled for SSE2 machines, but your Athlon doesn't have SSE2...

Currently I don't have any Athlons running under Windows.
But I could try to compile GMP from scratch without the SSE2 options this evening...

Edit: amphoria was so kind to generate a Windows binary (attached below) for the older nash3 (which is essentially the same as mnash). I haven't tested it so far, but perhaps it works on your Athlon...
Attached Files
 nash3.zip (21.6 KB, 373 views)

Last fiddled with by Thomas11 on 2007-02-28 at 10:12

 2007-02-28, 13:46 #7 Flatlander I quite division it     "Chris" Feb 2005 England 31·67 Posts Nash3 works. Thank you.
2007-02-28, 14:39   #8
Thomas11

Feb 2003

27·3·5 Posts
P3/Athlon binaries for Windows

I created a new set of Windows binaries by using a different precompiled GMP library from: http://cs.nyu.edu/exact/core/gmp/

The file contains nash.exe and mnash.exe. They are tested on an AthlonXP/Win2000 system and should work on P3 machines as well.
Attached Files
 nash_p3.zip (102.8 KB, 382 views)

 2009-05-11, 13:04 #9 cipher     Feb 2007 110100112 Posts Thomas 11 do you think multi5 code can be optimized to run faster on 64 bit OS? Thanks cipher
2009-05-11, 13:21   #10
Thomas11

Feb 2003

27×3×5 Posts

Quote:
 Originally Posted by cipher do you think multi5 code can be optimized to run faster on 64 bit OS?
I wouldn't expect any increase in speed since the (current) code will not benefit from a 64 bit architecture (e.g. 64 bit registers). The program was written to fit just into the limitations (e.g. cache size etc.) of the 32 bit processors of that time. Of course one could rewrite some parts to gain some benefit from 64 bits, but this would require some further investigation.
Probably a complete rewrite in C/C++ would be necessary...

 2015-07-02, 21:09 #11 pepi37     Dec 2011 After milion nines:) 2×757 Posts I search for this article and will say this "old" nash for 93*10^n-1 gives -93 10 5030 5045 "new" nash gives "only" -93 3116 3123 So what is correct ? Second: how to calculate nash weight from 1 to 1000 on base 3? mnash calculate only base 2, right? Thanks for answer

 Similar Threads Thread Thread Starter Forum Replies Last Post CRGreathouse Factoring 3 2018-02-05 14:55 Romuald Factoring 1 2016-11-13 10:59 Brain GPU Computing 20 2015-10-25 18:39 Uncwilly Lounge 5 2014-07-07 22:36 GP2 Lounge 2 2003-12-03 14:13

All times are UTC. The time now is 11:37.

Tue May 17 11:37:40 UTC 2022 up 33 days, 9:38, 0 users, load averages: 0.85, 1.06, 0.98

Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔