OFFSET
1,2
COMMENTS
Also: Square root of -1/4 in Z/pZ, for Pythagorean primes p=A002144(n).
Also: Least m>0 such that the Pythagorean prime p=A002144(n) divides 4(kp +/- m)^2+1 for all k>=0.
In practice these can also be determined by searching the least N^2+1 whose least prime factor is p=A002144(n): For given p, all of these N will have a(n) or p-a(n) as remainder mod 2p.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1)=1 since A002144(1)=5 and 4*1^2+1 is divisible by 5; as a consequence 4*(5k+/-1)^2+1 = 100k^2 +/- 40k + 5 is divisible by 5 for all k.
a(2)=4 since A002144(2)=13 and 4*4^2+1 = 65 is divisible by 13, while 4*1^1+1=5, 4*2^2+1=17 and 4*3^2+1=37 are not. As a consequence, 4*(13k+/-4)^2+1 = 13(...)+4*4^1+1 is divisible by 13 for all k.
MAPLE
f:= proc(p) local m;
if not isprime(p) then return NULL fi;
m:= numtheory:-msqrt(-1/4, p);
min(m, p-m);
end proc:
map(f, [seq(i, i=5..1000, 4)]); # Robert Israel, Mar 13 2018
MATHEMATICA
f[p_] := Module[{r}, r /. Solve[4 r^2 == -1, r, Modulus -> p] // Min];
f /@ Select[4 Range[300] + 1, PrimeQ] (* Jean-François Alcover, Jul 27 2020 *)
PROG
(PARI) apply(p->lift(sqrt(Mod(-1, p)/4)), A002144)
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Mar 14 2012
STATUS
approved