OFFSET
1,1
COMMENTS
Except for the first term, 2, these are the primes on the main diagonals of the Ulam spiral. - Robert G. Wilson v, Jul 10 2014
EXAMPLE
Ulam square spiral = 7 8 9 / 6 1 2 / 5 4 3 /...; changes of direction (right-angle)
for the primes at 2 3 5 7 ...
MAPLE
with(numtheory): a0:=1:for n from 1 to 200 do : a1:=a0+floor(n/2):a0:=a1:if
type(a1, prime)=true then printf(`%d, `, a1):else fi:od:
MATHEMATICA
Select[ Sort@ Flatten@ Table[ 4n^2 + (2j - 4)n + 1, {j, 0, 3}, {n, 55}], PrimeQ]
PROG
(PARI) for(n=0, 10^3, my(t=n^2\4+1); if(isprime(t), print1(t, ", "))); \\ Joerg Arndt, Jul 12 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Nov 21 2010
STATUS
approved