OFFSET
1,2
FORMULA
a(n) = a(n-1)^2 + a(n-1) - 2*a(n-1)*a(n-2) + 2*a(n-2)^2, a(1) = 1, a(2) = 2.
EXAMPLE
u(2) = 2, v(2) = 2; u(3) = 4, v(3) = 8; u(4) = 12, v(4) = 80; u(5) = 92, v(5) = 6544.
MATHEMATICA
RecurrenceTable[{x[n+ 2] == x[n+1]^2 + x[n+1] - 2*x[n+1]*x[n] + 2*x[n]^2, x[1] == 1, x[2] == 2 }, x, {n, 10}]
PROG
(Magma) I:=[1, 2]; [n le 2 select I[n] else Self(n-1)^2+Self(n-1)-2*Self(n-1)*Self(n-2)+2*Self(n-2)^2: n in [1..11]]; // Vincenzo Librandi, Jun 18 2015
(Sage)
def main(size):
u=[1]; v=[1]; a=[1]
for i in range(1, size-1):
u.append(u[i-1]+v[i-1])
v.append(u[i-1]**2+v[i-1]**2)
a.append(u[i])
return a # Anders Hellström, Jul 10 2015
(PARI) first(m)={my(u=vector(m), v=vector(m)); v[1]=1; u[1]=1; for(i=2, m, u[i] = u[i-1] + v[i-1]; v[i] = (u[i-1])^2 + (v[i-1])^2); u; } \\ Anders Hellström, Aug 20 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Morris Neene, Jun 17 2015
STATUS
approved