login
A319497
a(0)=0, a(3*n)=9*a(n), a(3*n+1)=9*a(n)+1, a(3*n+2)=9*a(n)+3.
1
0, 1, 3, 9, 10, 12, 27, 28, 30, 81, 82, 84, 90, 91, 93, 108, 109, 111, 243, 244, 246, 252, 253, 255, 270, 271, 273, 729, 730, 732, 738, 739, 741, 756, 757, 759, 810, 811, 813, 819, 820, 822, 837, 838, 840, 972, 973, 975, 981, 982, 984, 999, 1000, 1002, 2187, 2188, 2190, 2196, 2197, 2199, 2214
OFFSET
0,3
COMMENTS
Appears to be related to mod 3 modular forms: see MathOverflow link.
FORMULA
G.f. g(x) satisfies g(x) = (x+3*x^2)/(1-x^3) + 9*(1+x+x^2)*g(x^3).
The base-9 representation of a(n) is obtained from the base-3 representation of n by replacing each digit 2 with digit 3. - Max Alekseyev, May 02 2024
EXAMPLE
G.f. = x + 3*x^2 + 9*x^3 + 10*x^4 + 12*x^5 + 27*x^6 + 28*x^7 + 30*x^8 + ... - Michael Somos, Sep 20 2018
MAPLE
f:= proc(n) option remember; local t;
t:= n mod 3;
if t = 0 then 9*procname(n/3) elif t=1 then 1+9*procname((n-1)/3) else 3 + 9*procname((n-2)/3) fi
end proc:
f(0):= 0:
map(f, [$0..100]);
MATHEMATICA
a[ n_] := If[ n < 1, 0, 9 a[Quotient[n, 3]] + Binomial[Mod[n, 3] + 1, 2]]; (* Michael Somos, Sep 20 2018 *)
PROG
(PARI) {a(n) = if( n<1, 0 , 9*a(n\3) + binomial(n%3 + 1, 2))}; /* Michael Somos, Sep 20 2018 */
(PARI) { a319497(n) = fromdigits(apply(x->if(x==2, 3, x), digits(n, 3)), 9); } /* Max Alekseyev, May 02 2024 */
CROSSREFS
Sequence in context: A055063 A030354 A108865 * A036119 A211185 A229269
KEYWORD
nonn
AUTHOR
Robert Israel, Sep 20 2018
STATUS
approved