A119385 Write out the digits of the integers in order (cf. A007376): 0 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 ...; a(n) = sum of digits between successive zeros.
0, 46, 56, 66, 76, 86, 96, 106, 116, 126, 127, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 66, 76, 86, 96, 106, 116, 126, 136, 137, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 76, 86, 96, 106, 116, 126, 136, 146, 147, 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 86, 96, 106, 116, 126, 136, 146, 156, 157, 0, 4
Offset: 0
Programs
-
Maple
c:=proc(x,y) local s: s:=proc(m) nops(convert(m,base,10)) end: if y=0 then 10*x else x*10^s(y)+y: fi end: b:=proc(n) local nn: nn:=convert(n,base,10): [seq(nn[nops(nn)+1-i],i=1..nops(nn))] end: A:=0: for n from 1 to 500 do A:=c(A,n) od: B:=[0,seq(b(A)[j],j=1..nops(b(A)))]: u:=proc(n) if B[n]=0 then n else fi end: U:=[seq(u(n),n=1..nops(B))]: 0,seq(add(B[j],j=U[i]..U[i+1]),i=1..nops(U)-1); # there must exist a simpler Maple program! - Emeric Deutsch, Jul 27 2006 #alternative A119385 := proc(n) option remember ; local nupto,a,a007376,k ; if n =0 then RETURN([0,0]) ; else nupto := op(2,A119385(n-1)) ; a := 0 ; for k from nupto+1 do a007376 := A007376(k) ; if op(1,a007376) > 0 then a := a+op(1,a007376) ; else RETURN([a,k]) ; fi ; od: fi ; end :# R. J. Mathar, Jan 21 2008
-
Mathematica
list1=Flatten[Table[IntegerDigits[i],{i,0,1000}]]; index1=Partition[Flatten[Position[list1,0]],2,1]; Plus@@@Table[Take[list1,Flatten[Take[index1,{i}]]],{i,Length[index1]}] (From Harvey Dale)
Extensions
More terms from Emeric Deutsch, Jul 27 2006
Comments