OFFSET
0,3
COMMENTS
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
EXAMPLE
Since n=0,...,9 has a single digit, only n itself appears as substring in k, thus a(n)=n.
10 has { 0, 1, 10 } as substrings, thus a(10) = 0+1+10 = 11.
11 has { 1, 11 } as substrings, thus a(11) = 1+11 = 12.
12 has { 1, 2, 12 } as substrings, thus a(12) = 1+2+12 = 15.
PROG
(PARI) A154771(n) = { local(d=#Str(n)); n=vecsort(concat(vector(d, i, vector(d, j, n%10^j)+(d--&!n\=10))), , 8); n*vector(#n, i, 1)~ }
(Haskell)
a154771 = sum . a218978_row :: Integer -> Integer
-- Reinhard Zumkeller, Nov 10 2012
(Python)
def a(n):
s = str(n); L = len(s)
return sum(set(int(s[i:j]) for i in range(L) for j in range(i+1, L+1)))
print([a(n) for n in range(73)]) # Michael S. Branicky, Nov 08 2022
CROSSREFS
KEYWORD
AUTHOR
M. F. Hasler, Jan 16 2009
STATUS
approved