OFFSET
0,1
COMMENTS
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (3,-2).
FORMULA
a(n+2) == A000225(n) for n >= 1.
a(n) = 3*a(n-1)-2*a(n-2) for n>4. G.f.: (4*x^4+3*x^3-4*x^2-5*x+3) / ((x-1)*(2*x-1)). - Colin Barker, Mar 24 2014
EXAMPLE
1*2^1+1 = 3 is not a square. 2*2^1+1 = 5 is not a square. 3*2^1+1 = 7 is not a square. 4*2^1+1 = 9 is a square. Thus, a(1) = 4.
MATHEMATICA
CoefficientList[Series[(4 x^4 + 3 x^3 - 4 x^2 - 5 x + 3)/((x - 1) (2 x - 1)), {x, 0, 50}], x] (* Vincenzo Librandi, Mar 24 2014 *)
PROG
(Python)
import sympy
from sympy import isprime
def TwoSq(n):
..for k in range(1, 10**10):
....for i in range(10**4):
......if k*(2**n)+1 == i**2:
........return k
......if k*(2**n)+1 < i**2:
........break
n = 1
while n < 100:
..print(TwoSq(n))
..n += 1
(PARI)
Vec((4*x^4+3*x^3-4*x^2-5*x+3)/((x-1)*(2*x-1)) + O(x^100)) \\ Colin Barker, Mar 24 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Derek Orr, Mar 23 2014
STATUS
approved