OFFSET
1,1
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..1001
Index entries for linear recurrences with constant coefficients, signature (0,1).
FORMULA
G.f.: x*(2 + 4*x + 5*x^2 + 9*x^3 + 9*x^4)/((1 - x)*(1 + x)). - Bruno Berselli, May 29 2014
EXAMPLE
a(2)=4 because 2^2=4;
a(3)=7 because 4^2=16 and 6+1=7;
a(4)=13 because 7^2=49 and 4+9=13.
Other similar sequences, starting from 3, 5, 7 respectively:
. 3, 9 (9 repeated);
. 5, 7, 13, 16, 13 (13, 16 repeated);
. 8, 10, 1 (1 repeated).
MATHEMATICA
Join[{2, 4, 7}, LinearRecurrence[{0, 1}, {13, 16}, 50]] (* or *) CoefficientList[Series[x*(2 + 4*x + 5*x^2 + 9*x^3 + 9*x^4)/((1 - x)*(1 + x)), {x, 0, 50}], x] (* G. C. Greubel, Jul 27 2017 *)
PadRight[{2, 4, 7}, 120, {16, 13}] (* Harvey P. Dale, Aug 29 2021 *)
PROG
(PARI) x='x+O('x^50); Vec(x*(2 + 4*x + 5*x^2 + 9*x^3 + 9*x^4)/((1 - x)*(1 + x))) \\ G. C. Greubel, Jul 27 2017
(Scheme) (define (A163522 n) (cond ((<= n 2) (expt 2 n)) ((= 3 n) 7) ((even? n) 13) (else 16))) ;; Antti Karttunen, Sep 14 2017
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Vincenzo Librandi, Jul 30 2009
EXTENSIONS
Edited by N. J. A. Sloane, Aug 01 2009
Edited by Bruno Berselli, May 29 2014
STATUS
approved