login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A273005 Sum of coefficients in the hereditary representation of n in base 10. 2
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
Eric Weisstein's World of Mathematics, Hereditary Representation.
FORMULA
If n = Sum_{j=1..k} d_j*10^(e_j) where 0 <= e_1 < ... < e_k and 1 <= d_j <= 9, then a(n) = Sum_{j=1..k} (d_j + a(e_j)). - Pontus von Brömssen, Sep 17 2020
EXAMPLE
266 = 6 + 6*10^1 + 2*10^2 which can be represented as [6, [6, [1]], [2, [2]]], therefore a(266) = 6 + 6 + 1 + 2 + 2 = 17.
PROG
(PARI) (hr(n, b=10)=if(1<#n=digits(n, b), my(v=if(n[#n], [n[#n]], [])); forstep(i=#n-1, 1, -1, n[i]&&v=concat(v, [[n[i], hr(#n-i, b)]])); v, n)); (cc(v)=if(type(v)=="t_VEC", sum(i=1, #v, cc(v[i])), v)); a(n)=cc(hr(n, 10))
(Python)
def A273005(n):
s=str(n)[::-1]
return sum(int(s[i])+A273005(i) for i in range(len(s)) if s[i]!='0') # Pontus von Brömssen, Sep 17 2020
CROSSREFS
Sequence in context: A276716 A189506 A173529 * A093017 A156230 A028897
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, May 12 2016
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 07:07 EDT 2024. Contains 371964 sequences. (Running on oeis4.)