OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..5000
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
For n>1, a(n+3) = a(n) + 7.
G.f.: x*(1 + 3*x + 3*x^2 + 2*x^3 - 2*x^4)/((1-x)*(1-x^3)). - Vladimir Joseph Stephan Orlovsky, Jan 26 2012
a(n) = -a(n-1) - a(n-2) + 7*(n-1), for n >= 4, with a(n) = 3*n-2 for n < 4. - G. C. Greubel, Jan 22 2024
EXAMPLE
The first six palindromes are 1, 22, 232, 3223, 22322, 232232.
MATHEMATICA
CoefficientList[Series[(1+3x+3x^2+2x^3-2x^4)/((1-x)*(1-x^3)), {x, 0, 70}], x] (* Vladimir Joseph Stephan Orlovsky, Jan 26 2012 *)
Join[{1}, LinearRecurrence[{1, 0, 1, -1}, {4, 7, 10, 11}, 61]] (* Ray Chandler, Aug 25 2015 *)
PROG
(Magma) R<x>:=PowerSeriesRing(Integers(), 70); Coefficients(R!( (1+3*x+3*x^2+2*x^3-2*x^4)/((1-x)*(1-x^3)) )); // G. C. Greubel, Jan 22 2024
(SageMath)
def a(n): # a = A082206
if n<5: return 3*n-2
else: return a(n-3) + 7
[a(n) for n in range(1, 71)] # G. C. Greubel, Jan 22 2024
CROSSREFS
KEYWORD
base,easy,nonn,less
AUTHOR
Amarnath Murthy, Apr 10 2003
EXTENSIONS
Edited by Don Reble, Mar 13 2006
Offset corrected by Mohammed Yaseen, Aug 15 2023
STATUS
approved