OFFSET
0,2
COMMENTS
Row sums of the triangle in A083093. - Reinhard Zumkeller, Jul 11 2013
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..6561=3^8
Michael Gilleland, Some Self-Similar Integer Sequences
A. Granville, Binomials modulo a prime
FORMULA
Write n in base 3; if the representation contains r 1's and s 2's then a(n) = 2^{r-1} * (3^(s+1) - 1) = 1/2 * (3*A006047(n) - 2^(A062756(n))). - Robin Chapman, Ahmed Fares (ahmedfares(AT)my-deja.com) and others, Jul 16 2001
a(3n) = a(n), a(3n+1) = 2a(n), a(9n+2) = a(3n+2), a(9n+5) = 2a(3n+2), a(9n+8) = 4a(3n+2) - 3a(n). - David Radcliffe, Jun 25 2025
MATHEMATICA
Table[2^(DigitCount[n, 3, 1]-1) (3^(DigitCount[n, 3, 2]+1)-1), {n, 0, 80}] (* Harvey P. Dale, Jun 20 2019 *)
PROG
(Haskell)
a051638 = sum . a083093_row -- Reinhard Zumkeller, Jul 11 2013
(Python)
from gmpy2 import digits
def A051638(n): return 3*3**(s:=digits(n, 3)).count('2')-1<<s.count('1')>>1 # Chai Wah Wu, Jun 25 2025
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved
