Cubic special primes: Difference between revisions
Content added Content deleted
(Added Algol W) |
m (→{{header|REXX}}: simplified code, added a foot sep, changed whitespace and comments.) |
||
Line 400:
call genP /*build array of semaphores for primes.*/
w= 10 /*width of a number in any column. */
'difference of successive terma are the smallest cubic numbers'
if cols>0 then say ' index │'center(
if cols>0 then say '───────┼'center("" , 1 + cols*(w+1), '─') /* "
op= 1
$= /*a list of
do j=0 by 0
do k=1 until !.np
found= found + 1 /*bump number of primes of this type. */
op= np /*assign the newPrime to the oldPrime*/
if cols
c= commas(np) /*maybe add commas to the number. */
$= $ right(c, max(w, length(c) ) ) /*add a
if
say center(idx, 7)'│' substr($, 2); $= /*display what we have so far (cols). */
idx= idx + cols /*bump the index count for the output*/
Line 422 ⟶ 423:
if $\=='' then say center(idx, 7)"│" substr($, 2) /*possible display residual output.*/
if cols>0 then say '───────┴'center("" , 1 + cols*(w+1), '─') /*display foot sep. */
say
say 'Found ' commas(
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Line 450 ⟶ 452:
11 │ 2,531 2,539 3,539 3,547 4,547 5,059 10,891 12,619 13,619 13,627
21 │ 13,691 13,907 14,419
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────
Found 23 of the smallest primes < 15,000 such that the difference of successive terma are the smallest cubic numbers
|