Multi-base primes: Difference between revisions

m
→‎{{header|REXX}}: changed some comments.
m (→‎{{header|Pascal}}: Forget to inc number in IncInBaseDigits and to reset all digits to 0 in CnvtoBASE)
m (→‎{{header|REXX}}: changed some comments.)
Line 1,271:
say
say; say center(' 'word(names, w)"─character numbers that are" ,
'prime in the most bases: ('cnt "bases) ", 101, "'"')
do n=bot to top; y= words($.w.n) /*search again for maxesmaximums. */
if y==cnt then say n '──►' strip($.w.n) /*display ───a─── maximum. */
end /*n*/
end /*w*/
Line 1,284:
end /*k*/; return z || substr(@, x+1, 1)
/*──────────────────────────────────────────────────────────────────────────────────────*/
genP: @.1=2; @.2=3; @.3=5; @.4=7; @.5=11 /*define some low primes. */
#= 5; ssq.#= @.# ** 2 /*number of primes so far; prime prime²squared. */
do j=@.#+2 by 2 to 2 * 36 * 10**widths /*find odd primes from here on. */
parse var j '' -1 _; if _==5 then iterate /*J divisibleis ÷ by 5? (right dig).*/
if j//3==0 then iterate; if j// 37==0 then iterate /*" " " " " 3?; ÷ by 7? */
do k=5 while sq.k<=j if j// 7==0 then iterate /*" " " 7? [↓] divide by the known odd primes.*/
doif j//@.k=5=0 whilethen iterate s.k<=j /*Is J ÷ X? Then not /*prime. [↓] divide by the___ known odd primes.*/
if j // @.k == 0 then iterate j /*Is J ÷ X? Then not prime. ___ */
end /*k*/ /* [↑] only process numbers ≤ √ J */
#= # + 1; @.#= j; ssq.#= j*j /*bump # of Ps; assign next P; P squaresquared.*/
end /*j*/; return</lang>
{{out|output|text=&nbsp; when using the default input:}}
<pre>