login
Least number k such that prime(n) is the largest divisor of k^2 + 1, or 0 if there is no such k.
2

%I #3 Apr 03 2013 22:51:51

%S 1,0,2,0,0,5,4,0,0,12,0,6,9,0,0,23,0,11,0,0,27,0,0,34,22,10,0,0,33,15,

%T 0,0,37,0,44,0,28,0,0,80,0,19,0,81,14,0,0,0,0,107,89,0,64,0,16,0,82,0,

%U 60,53,0,138,0,0,25,114,0,148,0,136,42,0,0,104,0,0

%N Least number k such that prime(n) is the largest divisor of k^2 + 1, or 0 if there is no such k.

%C Note that a(n) = 0 for prime(n) = 3 (mod 4). If the zeros are removed, A002314 (with 1 prepended) and A177979 are produced.

%t nn = 100; t = Table[0, {nn}]; Do[If[Mod[Prime[n], 4] == 3, t[[n]] = -1], {n, nn}]; n = 0; While[Times @@ t == 0, n++; s = FactorInteger[n^2 + 1][[-1, 1]]; p = PrimePi[s]; If[p <= nn && t[[p]] == 0, t[[p]] = n]]; Do[If[Mod[Prime[n], 4] == 3, t[[n]] = 0], {n, nn}]; t

%Y Cf. A223701-A223707 (related sequences).

%K nonn

%O 1,3

%A _T. D. Noe_, Apr 03 2013