A172979 Primes with locations of right angle turns in Ulam square spiral (primes in A033638).
2, 3, 5, 7, 13, 17, 31, 37, 43, 73, 101, 157, 197, 211, 241, 257, 307, 401, 421, 463, 577, 601, 677, 757, 1123, 1297, 1483, 1601, 1723, 2551, 2917, 2971, 3137, 3307, 3541, 3907, 4357, 4423, 4831, 5113, 5477, 5701, 6007, 6163, 6481, 7057, 8011, 8101, 8191, 8837, 9901
Offset: 1
Keywords
Examples
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 ...
Programs
-
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]
-
PARI
for(n=0,10^3, my(t=n^2\4+1); if(isprime(t),print1(t,", "))); \\ Joerg Arndt, Jul 12 2014
Comments