mersenneforum.org > YAFU nextprime() odd behavior?
 Register FAQ Search Today's Posts Mark Forums Read

 2021-03-28, 02:23 #1 EdH     "Ed Hall" Dec 2009 Adirondack Mtns 2×19×97 Posts nextprime() odd behavior? Doesn't this seem a tiny bit odd? Script (calling YAFU wip r395): Code: #!/bin/bash np=2 while [ $np -lt 30 ] do printf "nextprime for$np is " np=$(./yafu "nextprime($np)" -silent) echo "$np" done Result: Code: $ bash primesgen.sh nextprime for 2 is 3 nextprime for 3 is 13 nextprime for 13 is 17 nextprime for 17 is 19 nextprime for 19 is 23 nextprime for 23 is 29 nextprime for 29 is 31 Not that anyone would generate primes in this fashion.
 2021-03-29, 14:48 #2 bsquared     "Ben" Feb 2007 D4C16 Posts Well, that was silly. Thanks as always for testing! Fixed in r396. P.s., *cough* "primes(0,1e6,0)" -pscreen *cough*
2021-03-29, 18:11   #3
EdH

"Ed Hall"
Dec 2009

368610 Posts

Quote:
 Originally Posted by bsquared Well, that was silly. Thanks as always for testing! Fixed in r396. P.s., *cough* "primes(0,1e6,0)" -pscreen *cough*
Thanks! I remembered nextprime(), but not primes(). And, there's no way I would have remembered it needed 3 values. I'd have had to look it up.

2021-03-29, 18:18   #4
bsquared

"Ben"
Feb 2007

22·23·37 Posts

Quote:
 Originally Posted by EdH Thanks! I remembered nextprime(), but not primes(). And, there's no way I would have remembered it needed 3 values. I'd have had to look it up.
I had to look it up too . primes(0,1000000) is the same as primes(0,1000000,1) which just counts primes in the range. primes(0,1000000,0) actually computes them and -pscreen dumps them to screen. -pfile puts them in primes.dat.

2021-03-29, 20:19   #5
EdH

"Ed Hall"
Dec 2009

1110011001102 Posts

Quote:
 Originally Posted by bsquared I had to look it up too . primes(0,1000000) is the same as primes(0,1000000,1) which just counts primes in the range. primes(0,1000000,0) actually computes them and -pscreen dumps them to screen. -pfile puts them in primes.dat.
I need to review the docs more often. I find lots of neat things in there!

Thanks for all!

 Similar Threads Thread Thread Starter Forum Replies Last Post bsquared Programming 11 2021-01-17 21:55 shortcipher YAFU 5 2018-03-27 13:59 EdH YAFU 7 2013-03-18 22:09 PageFault Software 2 2012-05-06 00:58 JuanTutors Software 0 2006-11-18 02:49

All times are UTC. The time now is 14:21.

Thu Apr 15 14:21:39 UTC 2021 up 7 days, 9:02, 0 users, load averages: 2.59, 2.26, 2.30