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.

Showing 1-3 of 3 results.

A225580 The sum of all substrings of n (including n).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 66, 68, 70, 72, 74, 76, 78, 80
Offset: 1

Views

Author

Keywords

Comments

This sequence differs from A071980 beginning with n = 1010, and differs formulaically beginning with n = 1000 (the first four digit number). Where A071980 is calculated as a + ab + abc + abcd + bcd + cd + d for four digit numbers abcd, this sequence also includes the term bc in the sum.
Limits: n <= a(n) < 1.73*n. Proof: a(n)/n will be maximized when substrings are as large as possible while n is as small as possible, or for numbers of the form 199999999... The sum of substrings of this number is < 222222... + < 1234567... or < 3456790123.../2000000000... or < 1.728396.
The number 111 is the smallest term that occurs twice in the sequence, when n = {96, 100}. The number 2254 is the smallest term that occurs three times in the sequence, when n = {1476, 1510, 2008}.

Examples

			For n=1980, a(n) = 1 + 9 + 8 + 0 + 19 + 98 + 80 + 198 + 980 + 1980 = 3373. Note that A071980(1980) = 3258, because it does not include 9, 8, 98 in the sum.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local i,d,L;
      L:= convert(n,base,10);
      d:= nops(L);
      add(L[i]*(d-i+1)*(10^i - 1)/9, i=1..d);
    end proc:
    map(f, [$1..100]); # Robert Israel, May 15 2025
  • Mathematica
    Table[s = IntegerDigits[n]; Total[Flatten[Table[FromDigits /@ Partition[s, i, 1], {i, Length[s]}]]], {n, 100}] (* T. D. Noe, May 13 2013 *)
  • Python
    def a(n):
        s = str(n)
        return sum(int(s[i:j]) for j in range(1, len(s)+1) for i in range(j))
    # David Radcliffe, May 15 2025
  • R
    sapply(1:100,function(n) {tot=0; s=as.character(n); len=nchar(s); for(i in 1:len) for(j in i:len) tot=tot+as.numeric(substr(s,i,j)); tot})
    

Formula

a(n) = A138953(n) + n. (Note the offset in A138953 is zero. - Zak Seidov, May 16 2013)
a(n) = 11*a(floor(n/10)) - 10*a(floor(n/100)) + (n mod 10) * A055642(n). - David Radcliffe, May 15 2025

Extensions

Example corrected by Zak Seidov, May 16 2013

A307629 Let decimal expansion of n be d_1 d_2 ... d_k; a(n) = Sum_{i=1..k-1} Sum_{j=i+1..k} (d_i + d_j).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 2, 4, 6
Offset: 0

Views

Author

N. J. A. Sloane, Apr 19 2019

Keywords

Comments

More than the usual number of terms are shown in order to distinguish this from related sequences.
Starts to differ from A093882 at A093882(101)=22 <> a(101)=4. - R. J. Mathar, May 06 2019

Examples

			For n<10 there is only one decimal digit so a(n)=0.
a(102) = 1+0 + 1+2 + 0+2 = 6.
		

Crossrefs

Suggested by A307560.

Programs

  • Maple
    a:= n-> (d-> (nops(d)-1)*add(i, i=d))(convert(n, base, 10)):
    seq(a(n), n=0..120);  # Alois P. Heinz, Apr 19 2019
  • Mathematica
    Array[Total@ Flatten@ Subsets[IntegerDigits@ #, {2}] &, 103, 0] (* Michael De Vlieger, Apr 19 2019 *)

Formula

From Alois P. Heinz, Apr 19 2019: (Start)
a(n) = A007953(n) * (A055642(n)-1).
a(n) = A110805(n) - A007953(n). (End)

A162467 Numbers n such that the sum of all proper substrings of their decimal representation equals the reverse of n.

Original entry on oeis.org

0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 891, 941, 2931, 51070, 147970, 1330550, 1523870, 75914061, 30735249050, 32036090950, 90000000001, 575605978451, 922898423231, 21326410034240, 31829906273560, 93336794910541, 39470358768890551
Offset: 1

Views

Author

Claudio Meller, Jul 04 2009

Keywords

Comments

Here substrings are substrings of adjacent digits of length less than the number of digits of n, of which there are (d+2)*(d-1)/2=A000096(d-1), counted with multiplicity, where d=A055642(N).

Examples

			941 is in the list because 94 + 41 + 9 + 4 + 1 = 149.
51070 is in the list because 5107+1070+510+107+070+51+10+07+70+5+1+0+7+0=07015.
		

Crossrefs

Cf. A125303 (substrings without multiplicity). - R. J. Mathar, Jul 06 2009

Formula

{n: A138953(n)=A004086(n)} - R. J. Mathar, Jul 06 2009

Extensions

Keyword base added, 10 to 90 and 147970 added by R. J. Mathar, Jul 06 2009
0 and a(16)-a(38) from Ray Chandler, Jul 15 2009
Showing 1-3 of 3 results.