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!)
A154781 Sum of all numbers < n that appear as substring of n, written in decimal system. 3
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 2, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 3, 7, 8, 9, 10, 11, 12, 4, 5, 6, 7, 4, 9, 10, 11, 12, 13, 5, 6, 7, 8, 9, 5, 11, 12, 13, 14, 6, 7, 8, 9, 10, 11, 6, 13, 14, 15, 7, 8, 9, 10, 11, 12, 13, 7, 15, 16, 8, 9, 10, 11, 12, 13, 14, 15, 8, 17 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,13
COMMENTS
The condition "< n" narrows the meaning of "substring" to the strict sense, i.e., excludes n itself.
LINKS
FORMULA
a(n) = A154771(n)-n. a(10^n) = A002275(n). a(n)>0 <=> n>9.
EXAMPLE
Since n=0,...,9 has a single digit, only n itself appears as substring in n, thus a(n)=0.
10 has { 0, 1, 10 } as substrings, thus a(10) = 0+1 = 1.
11 has { 1, 11 } as substrings, thus a(11) = 1.
12 has { 1, 2, 12 } as substrings, thus a(12) = 1+2 = 3.
MATHEMATICA
san[n_]:=Total[Union[FromDigits/@Flatten[Table[Partition[IntegerDigits[n], i, 1], {i, IntegerLength[n]-1}], 1]]]; Array[san, 90, 0] (* Harvey P. Dale, May 27 2017 *)
PROG
(PARI) A154781(n) = { local(d=#Str(n)); n=vecsort(concat(vector(d, i, vector(d, j, n%10^j)+(d--&!n\=10))), , 12); n*vector(#n, i, i>1)~ }
(Python)
def a(n):
s = str(n)
return sum(set(int(s[i:j]) for i in range(len(s)) for j in range(i+1, len(s)+1))) - n
print([a(n) for n in range(90)]) # Michael S. Branicky, Nov 08 2022
CROSSREFS
Sequence in context: A077396 A243196 A247485 * A118716 A004177 A004721
KEYWORD
base,easy,nonn
AUTHOR
M. F. Hasler, Jan 16 2009
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 18 20:21 EDT 2024. Contains 371781 sequences. (Running on oeis4.)