OFFSET
1,2
COMMENTS
This is a periodic sequence with period 9 and cycle 1,6,6,1,9,3,1,3,9 - which are also the coefficients of x in the numerator of the generating function.
FORMULA
a(n) = a(n-9), and as the sum of the terms contained in each cycle is 39 they also satisfy the eighth-order inhomogeneous recurrence a(n) = 39 - a(n-1) - a(n-2) - a(n-3) - a(n-4) - a(n-5) - a(n-6) - a(n-7) - a(n-8).
a(n) = 2 + cos(2/9*(n-5)*Pi) + cos(4/9*(n-5)*Pi) + cos(2/3*(n-5)*Pi) + cos(8/9*(n-5)*Pi) + cos(4/3*(n-5)*Pi) + cos(14/9*(n-5)*Pi) + cos(16/9*(n-5)*Pi) + cos((2 n Pi)/9) + cos((4 n Pi)/9) + cos((2 n Pi)/3) + cos((8 n Pi)/9) + cos((10 n Pi)/9) + cos((4 n Pi)/3) + cos((14 n Pi)/9) + cos((16 n Pi)/9) + cos(2/9 (2+5 n) Pi) + (8n + 5n^2 + 7n^3 + n^5 + n^7 + 6n^8) mod 9.
G.f.: x(1+6x+6x^2+x^3+9x^4+3x^5+x^6+3x^7+9x^8)/((1-x)(1+x+x^2)(1+x^3+x^6)).
EXAMPLE
The sixth nonzero hexagonal number is A000384(6)=66. As 6+6=12 and 1+2=3, this has digital root 3 and so a(6)=3.
MATHEMATICA
DigitalRoot[n_]:=FixedPoint[Plus@@IntegerDigits[#]&, n]; DigitalRoot[ # (2#-1)]&/@Range[63]
CoefficientList[Series[(1 + 6 x + 6 x^2 + x^3 + 9 x^4 + 3 x^5 + x^6 + 3 x^7 + 9 x^8)/((1 - x) (1 + x + x^2) (1 + x^3 + x^6)), {x, 0, 100}], x] (* Vincenzo Librandi, Aug 11 2015 *)
PadRight[{}, 120, {1, 6, 6, 1, 9, 3, 1, 3, 9}] (* Harvey P. Dale, Oct 02 2018 *)
PROG
(Haskell)
a194597 n = [1, 6, 6, 1, 9, 3, 1, 3, 9] !! a010878 (n-1)
-- Reinhard Zumkeller, Jan 09 2013
(Magma) &cat[ [1, 6, 6, 1, 9, 3, 1, 3, 9]: k in [1..10] ]; // Vincenzo Librandi, Aug 11 2015
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Ant King, Aug 30 2011
STATUS
approved