cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A154781 Sum of all numbers < n that appear as substring of n, written in decimal system.

This page as a plain text file.
%I A154781 #17 Nov 08 2022 13:58:40
%S A154781 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,
%T A154781 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,
%U A154781 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
%N A154781 Sum of all numbers < n that appear as substring of n, written in decimal system.
%C A154781 The condition "< n" narrows the meaning of "substring" to the strict sense, i.e., excludes n itself.
%H A154781 Harvey P. Dale, <a href="/A154781/b154781.txt">Table of n, a(n) for n = 0..1000</a>
%F A154781 a(n) = A154771(n)-n. a(10^n) = A002275(n). a(n)>0 <=> n>9.
%e A154781 Since n=0,...,9 has a single digit, only n itself appears as substring in n, thus a(n)=0.
%e A154781 10 has { 0, 1, 10 } as substrings, thus a(10) = 0+1 = 1.
%e A154781 11 has { 1, 11 } as substrings, thus a(11) = 1.
%e A154781 12 has { 1, 2, 12 } as substrings, thus a(12) = 1+2 = 3.
%t A154781 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 *)
%o A154781 (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)~ }
%o A154781 (Python)
%o A154781 def a(n):
%o A154781     s = str(n)
%o A154781     return sum(set(int(s[i:j]) for i in range(len(s)) for j in range(i+1, len(s)+1))) - n
%o A154781 print([a(n) for n in range(90)]) # _Michael S. Branicky_, Nov 08 2022
%Y A154781 Cf. A154770, A154771.
%K A154781 base,easy,nonn
%O A154781 0,13
%A A154781 _M. F. Hasler_, Jan 16 2009