OFFSET
1,2
EXAMPLE
For n=1, we have no primes and one nonprime (a(1)=1), so a(2)=0^2+1^2+1=2. Now we have one prime (a(2)=2) and one nonprime, so a(3)=1^2+1^2+1=3.
MATHEMATICA
t = {1}; Do[ps = Count[t, _?(PrimeQ[#] &)]; AppendTo[t, ps^2 + (n - ps - 1)^2 + 1], {n, 2, 100}]; t (* T. D. Noe, Sep 15 2011 *)
PROG
(PARI) p=q=0; for(n=1, 50, print1(k=p^2+q^2+1", "); if(isprime(k), p++, q++)) \\ Charles R Greathouse IV, Sep 16 2011
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Greg Knowles, Sep 15 2011
STATUS
approved