mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > YAFU

Reply
 
Thread Tools
Old 2021-03-28, 02:23   #1
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

3·372 Posts
Default 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.
EdH is offline   Reply With Quote
Old 2021-03-29, 14:48   #2
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

3×1,193 Posts
Default

Well, that was silly. Thanks as always for testing! Fixed in r396.

P.s., *cough* "primes(0,1e6,0)" -pscreen *cough*
bsquared is offline   Reply With Quote
Old 2021-03-29, 18:11   #3
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

3×372 Posts
Default

Quote:
Originally Posted by bsquared View Post
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.
EdH is offline   Reply With Quote
Old 2021-03-29, 18:18   #4
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

3×1,193 Posts
Default

Quote:
Originally Posted by EdH View Post
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.
bsquared is offline   Reply With Quote
Old 2021-03-29, 20:19   #5
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

3·372 Posts
Default

Quote:
Originally Posted by bsquared View Post
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!
EdH is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc 10.2.0 behavior bsquared Programming 12 2021-07-20 12:52
nextprime function is spooked by leading zero. shortcipher YAFU 5 2018-03-27 13:59
nextprime() appears to be limited... EdH YAFU 7 2013-03-18 22:09
P-1, 4GB RAM on 32 bit OS, odd behavior PageFault Software 2 2012-05-06 00:58
Question about P-1 behavior JuanTutors Software 0 2006-11-18 02:49

All times are UTC. The time now is 13:28.


Thu Dec 2 13:28:31 UTC 2021 up 132 days, 7:57, 0 users, load averages: 0.91, 1.23, 1.33

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, 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.