OFFSET
0,2
COMMENTS
n-th difference of a(n), a(n-1), ..., a(0) is (1, 4, 9, 16, 25, ...).
Similar to A000697 in so far as it can be seen as the transform of 1, 1, 4, 9, 16, ... by a variant of the boustrophedon algorithm (see the Sage implementation). - Peter Luschny, Oct 30 2014
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..2000
Index entries for linear recurrences with constant coefficients, signature (7,-18,20,-8).
FORMULA
a(n) = n*(n+1)*2^(n-2) + 1 = A001788(n) + 1. - Ralf Stephan, Jan 16 2004
a(n) = 7*a(n-1)-18*a(n-2)+20*a(n-3)-8*a(n-4). - Colin Barker, Nov 26 2014
G.f.: -(8*x^3-11*x^2+5*x-1) / ((x-1)*(2*x-1)^3). - Colin Barker, Nov 26 2014
MATHEMATICA
LinearRecurrence[{7, -18, 20, -8}, {1, 2, 7, 25}, 30] (* Jean-François Alcover, Jun 11 2019 *)
PROG
(Magma) [n*(n+1)*2^(n-2) + 1: n in [0..30]]; // Vincenzo Librandi, Sep 26 2011
(Sage)
def sq():
yield 1
for n in PositiveIntegers():
yield n*n
def bous_variant(f):
k = 0
am = next(f)
a = [am]
while True:
yield am
am = next(f)
a.append(am)
for j in range(k, -1, -1):
am += a[j]
a[j] = am
k += 1
b = bous_variant(sq())
print([next(b) for _ in range(26)]) # Peter Luschny, Oct 30 2014
(PARI) Vec(-(8*x^3-11*x^2+5*x-1)/((x-1)*(2*x-1)^3) + O(x^100)) \\ Colin Barker, Nov 26 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved