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.

A093882 Sum of all the numbers formed by deleting one digit from n.

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
Offset: 0

Views

Author

Amarnath Murthy, Apr 22 2004

Keywords

Comments

Subsidiary sequence: Sum of the numbers formed by deleting all possible strings touching one end ( containing at least one of the LSB or MSB). A071980(123) = 123 + 12 + 1 + 23 + 3 = 162. A071980(1234) = 1 + 12 + 123 + 1234 + 234 + 34 + 4 = 1642.
This allows leading zeros are after deletion. If these are forbidden, the first change would be a(101) = 21 instead of 22. - Franklin T. Adams-Watters, Jul 27 2006

Examples

			a(123) = 12 + 13 + 23 = 48. [corrected by _Harvey P. Dale_, Jul 24 2017]
		

Crossrefs

Cf. A007953.

Programs

  • Maple
    read("transforms"):
    A093882 := proc(n)
        local a,dgs,d,dgsred ;
        a := 0 ;
        dgs := convert(n,base,10) ;
        for d from 1 to nops(dgs) do
            [op(1..d-1,dgs),op(d+1..nops(dgs),dgs)] ;
            a := a+digcatL(%) ;
        end do:
        a ;
    end proc: # R. J. Mathar, May 06 2019
    # second Maple program:
    a:= n-> (s-> add(parse(cat("0", s[..i-1],
             s[i+1..])), i=1..length(s)))(""||n):
    seq(a(n), n=0..123);  # Alois P. Heinz, May 06 2019
  • Mathematica
    sn[n_]:=Module[{idn=IntegerDigits[n]},Total[FromDigits/@Table[ Delete[ idn,i],{i,Length[idn]}]]]; Array[sn,90,0] (* Harvey P. Dale, Jul 24 2017 *)
  • Python
    def a(n): s=str(n); return sum(int(s[:i]+s[i+1:]) for i in range(len(s))) if n > 9 else 0
    print([a(n) for n in range(88)]) # Michael S. Branicky, Oct 27 2023

Extensions

Corrected and extended by Franklin T. Adams-Watters, Jul 27 2006
Offset corrected by Alois P. Heinz, May 06 2019

A138953 Sum of numbers from all substrings of n.

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
Offset: 0

Views

Author

Zak Seidov, Apr 04 2008

Keywords

Examples

			One-digit numbers have no substring, hence a(0..9)=0;
a(10)  = 1+0 = 1,
a(123) = 1+2+3+12+23 = 41,
a(150) = 1+5+0+15+50 = 71.
		

Crossrefs

Cf. A093882.

Programs

  • Mathematica
    Table[id=IntegerDigits[n]; Total[Flatten[Table[FromDigits/@ Partition[id,k,1], {k,Length[id]-1}]]], {n,0,150}]

Formula

a(n) = A071980(n) - n. [R. J. Mathar, Jul 06 2009]
Note: Mathar's formula works for numbers with 1, 2 or 3 digits, but thereafter only for numbers whose internal digits are zeros. [Christian N. K. Anderson, May 13 2013]

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
Showing 1-3 of 3 results.