Anonymous user
Prime conspiracy: Difference between revisions
m
→{{header|REXX}}: changed comments and whitespace, split a compound line, used a template for the output section.
m (→{{header|REXX}}: changed comments and whitespace, split a compound line, used a template for the output section.) |
|||
Line 2,294:
<lang rexx>/*REXX pgm shows a table of what last digit follows the previous last digit for N primes*/
parse arg N . /*N: the number of primes to be genned*/
if N=='' | N=="," then N=
Np= N+1;
H= N* (2**max(4, (w%2+1) ) )
@.=
#=
do j=3 by 2; if @.j=='' then iterate
#= #+1
do m=j*j to H by j+j; @.m=
end /*m*/
if #==Np then leave /*Enough primes? Then done with gen. */
end /*j*/ /* [↑] gen using Eratosthenes' sieve. */
!.=
say 'For ' N " primes used in this study:"
r=
#=
do i=3 by 2; if @.i=='' then iterate
#= # + 1;
!.r.x= !.r.x +1; r=
if #==Np then leave /*Done? Then leave this DO loop. */
end /*i*/ /* [↑] examine almost all odd numbers.*/
say /* [↓] display the results to the term*/
do d=1 for 9;
do f=1 for 9; if !.d.f==0 then iterate /*
say 'digit ' d "──►" f ' has a count of: ',
right(!.d.f, w)", frequency of:"
end /*
end /*d*/ /*stick a fork in it, we're all done. */</lang>
<pre>
For 1000000 primes used in this study:
|