OFFSET
1,3
FORMULA
a(n)=0 iff n==2 mod 3 because 2 is quadratic nonresidue of 3.
EXAMPLE
1 + 3*1 = 4 = 2^2, 3 + 3*2 = 9 = 3^2, 4 + 3*4 = 16 = 4^2.
MATHEMATICA
Table[m = 1; If[Mod[n, 3] == 2, m = 0, While[! IntegerQ[Sqrt[n + 3*m]], m++]]; m, {n, 100}] (* Michael De Vlieger, Mar 20 2015 *)
PROG
(PARI) a(n)=if(n==Mod(2, 3), return(0)); m=1; while(!issquare(n+3*m), m++); m
vector(100, n, a(n)) \\ Derek Orr, Mar 22 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Zak Seidov, Mar 20 2015
STATUS
approved