RosettaCodeData/Task/Long-primes/Quackery/long-primes.quackery
2023-07-01 13:44:08 -04:00

31 lines
681 B
Text

[ over size 0 swap 2swap
bsearchwith < drop ] is search ( [ --> n )
[ 1 over 1 - times
[ 10 * over mod ]
tuck
0 temp put
[ 10 * over mod
1 temp tally
rot 2dup != while
unrot again ]
2drop drop
temp take ] is period ( n --> n )
[ dup isprime not iff
[ drop false ] done
dup period 1+ = ] is islongprime ( n --> b )
64000 eratosthenes
[]
64000 times
[ i^ islongprime if [ i^ join ] ]
behead drop
dup dup 500 search split drop echo cr cr
' [ 500 1000 2000 4000 8000 16000 32000 64000 ]
witheach
[ dup echo say " --> "
dip dup search echo cr ]
drop