View Single Post
Old 2021-03-28, 02:23   #1
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

2×3×751 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