September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -5,7 +5,7 @@ parse arg high .; if high=='' then high=1000000 /*Not specified? The
!.2=1; !.3=1; !.5=1; !.7=1; !.11=1; !.13=1; !.17=1 /*set some low prime flags. */
#=7; s.#=@.#**2 /*number of primes so far; prime². */
/* [↓] generate more primes ≤ high.*/
do j=@.#+2 by 2 to high /*only find odd primes from here on out*/
do j=@.#+2 by 2 for max(0, high%2-@.#%2-1) /*only find odd primes from here on out*/
if j// 3==0 then iterate /*is J divisible by three? */
parse var j '' -1 _; if _==5 then iterate /* " " " " five? (right digit)*/
if j// 7==0 then iterate /* " " " " seven? */
@ -13,8 +13,8 @@ parse arg high .; if high=='' then high=1000000 /*Not specified? The
if j//13==0 then iterate /* " " " " thirteen? */
/* [↑] the above five lines saves time*/
do k=7 while s.k<=j /* [↓] divide by the known odd primes.*/
if j//@.k==0 then iterate j /*Is J divisible by X? Then not prime.*/
end /*k*/
if j//@.k==0 then iterate j /*Is J ÷ X? Then not prime. ___ */
end /*k*/ /* [↑] only process up to the √ J */
#=#+1 /*bump the number of primes found. */
@.#=j; s.#=j*j; !.j=1 /*assign next prime; prime²; prime #.*/
end /*j*/