OFFSET
1,2
COMMENTS
Sequence A001651 is the "base 3" version. In base 4 this rule leads to (1,2,4,4,4...), in base 5 to (1,2,4,8,11,12,14,18,21,22,24,28...) = A235700. - M. F. Hasler, Jan 14 2014
This and the following sequences (none of which is "base"!) could all be defined by a(1) = 1 and a(n+1) = a(n) + (a(n) mod b) with different values of b: A001651 (b=3), A235700 (b=5), A047235 (b=6), A047350 (b=7), A007612 (b=9). Using b=4 or b=8 yields a constant sequence from that term on. - M. F. Hasler, Jan 15 2014
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (2,-2,2,-1).
FORMULA
a(n) = 2*a(n-1)-2*a(n-2)+2*a(n-3)-a(n-4) for n>5. G.f.: x*(5*x^4+2*x^3+2*x^2+1) / ((x-1)^2*(x^2+1)). - Colin Barker, Sep 20 2014
a(n) = (-10 - (1-i/2)*(-i)^n - (1+i/2)*i^n + 5*n) for n>1, where i = sqrt(-1). - Colin Barker, Oct 18 2015
EXAMPLE
28 + 8 = 36, 36 + 6 = 42.
MATHEMATICA
LinearRecurrence[{2, -2, 2, -1}, {1, 2, 4, 8, 16}, 60] (* Harvey P. Dale, Jul 02 2022 *)
PROG
(PARI) print1(a=1); for(i=1, 99, print1(", "a+=a%10)) \\ M. F. Hasler, Jan 14 2014
(PARI) Vec(x*(5*x^4+2*x^3+2*x^2+1)/((x-1)^2*(x^2+1)) + O(x^100)) \\ Colin Barker, Sep 20 2014
(PARI) a(n) = if(n==1, 1, (-10-(1-I/2)*(-I)^n-(1+I/2)*I^n+5*n)) \\ Colin Barker, Oct 18 2015
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Samantha Stones (devilsdaughter2000(AT)hotmail.com), Dec 25 2004
STATUS
approved