OFFSET
1,1
LINKS
Michel Marcus, Table of n, a(n) for n = 1..751
EXAMPLE
First term prime(2) = 3 is placed on 0th row.
If prime(n-1) = +1 mod 4 is on k-th row then we put prime(n) on (k-1)-st row.
If prime(n-1) = -1 mod 4 is on k-th row then we put prime(n) on (k+1)-st row.
This process makes an array of prime numbers:
0th row: 3, 7, 19, 43, ...
1st row: 5, 11, 17, 23, 31, 41, 47, 59, 67, 103, 127, ...
2nd row: 13, 29, 37, 53, 61, 71, 79, 101, 107, 113 ...
3rd row: 73, 83, 97, 109, ...
4th row: 89, ...
MATHEMATICA
Prime[#]&/@(Flatten[Position[Accumulate[If[Mod[#, 4]==1, 1, -1]&/@ Prime[ Range[ 2, 51000]]], -1]]+2) (* Harvey P. Dale, Mar 08 2015 *)
PROG
(PARI) lista(nn) = my(vp=primes(nn), nb1=0, nb3=0); for (i=2, #vp, my(p = vp[i]); if (nb1 == nb3-1, print1(p, ", ")); if ((p % 4) == 1, nb1++, nb3++); ); \\ Michel Marcus, May 30 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Yasutoshi Kohmoto, Aug 12 2004
EXTENSIONS
More terms from Joshua Zucker, May 03 2006
STATUS
approved