# [seqfan] Re: Sum of all valid substrings (VS)

Maximilian Hasler maximilian.hasler at gmail.com
Fri Jan 16 20:50:23 CET 2009

```The following has been sent to the OEIS:

%I A154770
%S A154770 10,11,12,15,21,24,30,33,36,45,54,63,72,81,90,99,108,127,176,283,407,
%T A154770 458,578,733,849,1003,1117,1381,2044,2318,2953,4397,5435,6557,7964,9989,
%U A154770 12279,16572,26426,36970,49970,67738,84716,100181,111599,139413,209606
%N A154770 a(n+1) = A154771(a(n)) = sum of all "valid substrings" of
a(n); a(1)=10 (least nontrivial choice).
%C A154770 "Valid substrings" means all numbers that appear as
substring of n (written in decimal system). Starting values < 10 would
yield a constant sequence.
%H A154770 E. Angelini, <a
href="http://list.seqfan.eu/pipermail/seqfan/2009-January/000536.html">Sum
of all valid substrings (VS)</a>, SeqFan list, Jan 16 2009
%e A154770 a(1) = 10 has { 0, 1, 10 } as substrings,
%e A154770 a(2) = 0+1+10 = 11 has { 1, 11 } as substrings,
%e A154770 a(3) = 1+11 = 12 has { 1, 2, 12 } as substrings,
%e A154770 a(4) = 1+2+12 = 15 has { 1, 5, 15 } as substrings.
%o A154770 (PARI) A154770( n=2, a=10 ) = { local(d); while( n--,
a=vecsort(concat(vector(d=#Str(a),i,vector(d,j,a%10^j)+(d--&!a\=10))),,8);a*=vector(#a,i,1)~);
a }
%o A154770 print1(a=10);for(i=1,50,print1("," a=A154770(,a)))
%Y A154770 Cf. A004207, A154771.
%K A154770 base,easy,nonn
%O A154770 1,1
%A A154770 Eric Angelini (eric.angelini(AT)kntv.be) and M. F. Hasler
(Maximilian.Hasler(AT)gmail.com), Jan 16 2009

```