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-8 of 8 results.

A008593 Multiples of 11.

Original entry on oeis.org

0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220, 231, 242, 253, 264, 275, 286, 297, 308, 319, 330, 341, 352, 363, 374, 385, 396, 407, 418, 429, 440, 451, 462, 473, 484, 495, 506, 517, 528, 539, 550, 561, 572, 583
Offset: 0

Views

Author

Keywords

Comments

Numbers for which the sum of "digits" in base 100 is divisible by 11. For instance, 193517302 gives 1 + 93 + 51 + 73 + 02 = 220, and 2 + 20 = 22 = 2 * 11. - Daniel Forgues, Feb 22 2016
Numbers in which the sum of the digits in the even positions equals the sum of the digits in the odd positions. - Stefano Spezia, Jan 05 2025

Crossrefs

Programs

Formula

a(n) = 11*n.
G.f.: 11*x/(1-x)^2. - David Wilding, Jun 21 2014
E.g.f.: 11*x*exp(x). - Stefano Spezia, Oct 08 2022
From Elmo R. Oliveira, Apr 10 2025: (Start)
a(n) = 2*a(n-1) - a(n-2).
a(n) = A008604(n)/2. (End)

A225693 Alternating sum of digits of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, 8, 7, 6, 5, 4, 3, 2
Offset: 0

Views

Author

N. J. A. Sloane, May 27 2013

Keywords

Comments

A number n is divisible by 11 if and only if a(n) is divisible by 11. For generalizations see Sharpe and Webster, or the links below.
The primes p for which the absolute value of the alternating sum of digits of p is also a prime begin: 2, 3, 5, 7, 13, 29, 31, 41, 47, 53, 61, 79, 83, 97, 101, 113, 137, 139, 151. - Jonathan Vos Post, May 27 2013
The above prime sequence is A115261. - Jens Kruse Andersen, Jul 13 2014
Digital sum with alternating signs starting with a positive sign for the most significant digit. - Hieronymus Fischer, Mar 23 2014

Crossrefs

A055017 is closely related (but less natural).
Cf. A061479.
Cf. A004086.
Indices of 0..3: A135499, A061470, A061471, A061472.

Programs

  • Haskell
    a225693 = f 1 0 where
       f _ a 0 = a
       f s a x = f (negate s) (s * a + d) x' where (x', d) = divMod x 10
    -- Reinhard Zumkeller, May 11 2015, Aug 08 2014
    
  • Maple
    A225693 :=proc(n) local t1,i;
    t1:=convert(n,base,10);
    add((-1)^(i+nops(t1))*t1[i],i=1..nops(t1));
    end;
    [seq(A225693(n),n=0..120)];
  • Mathematica
    Table[Total[Times@@@Partition[Riffle[IntegerDigits[n],{1,-1},{2,-1,2}],2]],{n,0,90}] (* Harvey P. Dale, Nov 27 2015 *)
  • PARI
    a(n) = my(d=digits(n)); sum(k=1, #d, (-1)^(k+1)*d[k]); \\ Michel Marcus, Jul 15 2022
  • Python
    def a(n): return sum(int(d)*(-1)**i for i, d in enumerate(str(n)))
    print([a(n) for n in range(87)]) # Michael S. Branicky, Jul 14 2022
    
  • Smalltalk
    "Version for general bases"
    "Set base = 10 for this sequence"
    altDigitalSumLeft: base
    base > 1 ifTrue:  [m:= self integerFloorLog: base]
             ifFalse: [^self \\ 2].
    p:=1.
    s:=0.
    1 to: m by: 2 do: [ :k |
        p := p*base.
        s := s - (self // p) .
        p := p*base.
        s := s + (self // p) ].
    ^(self + ((base + 1)*s)) * (m alternate)
    "Version for base 10 using altDigitalSumRight from A055017"
    A225693
    ^(self A004086) altDigitalSumLeft: 10
    [by Hieronymus Fischer, Mar 23 2014]
    

Formula

If n has decimal expansion abc..xyz with least significant digit z, a(n) = a - b + c - d + ...
From Hieronymus Fischer, Mar 23 2014: (Start)
Formulas for general bases b > 1 (b = 10 for this sequence). Always m := floor(log_b(n)).
a(n) = Sum_{k>=0} (-1)^k*(floor(n*b^(k-m)) mod b). The sum is finite with floor(log_b(n)) as the highest index.
a(n) = (-1)^m*n - (b+1)*Sum_{k=1..m} (-1)^k*floor(n*b^(k-m-1)).
a(n) = (-1)^m*(n + (b+1)*Sum_{k>=1} (-1)^k*floor(n/b^k)).
a(n) = -(-1)^(m-k)*a(n mod b^k) + a(floor(n/b^k)), for 0 <= k <= m+1.
a(n) = (-1)^m*a(n mod b) + a(floor(n/b)).
a(n) = -(-1)^m*a(n mod b^2) + a(floor(n/b^2)).
a(n) = (-1)^m*A055017(n).
a(n) = A055017(A004086(n)).
a(A004086(A004086(n))) = a(n).
(End)
a(A135499(n)) = 0; a(A061470(n)) = 1. - Reinhard Zumkeller, Aug 08 2014
a(A061471(n)) = 2; a(A061472(n)) = 3. - Bernard Schott, Jul 14 2022

Extensions

Comment corrected by Jens Kruse Andersen, Jul 13 2014

A060979 |First digit - second digit + third digit - fourth digit ...| = 11.

Original entry on oeis.org

209, 308, 319, 407, 418, 429, 506, 517, 528, 539, 605, 616, 627, 638, 649, 704, 715, 726, 737, 748, 759, 803, 814, 825, 836, 847, 858, 869, 902, 913, 924, 935, 946, 957, 968, 979, 1309, 1408, 1419, 1507, 1518, 1529, 1606, 1617, 1628, 1639, 1705, 1716
Offset: 1

Views

Author

Robert G. Wilson v, May 10 2001

Keywords

Comments

Note that all terms are divisible by eleven.

Crossrefs

Programs

  • Haskell
    a060979 n = a060979_list !! (n-1)
    a060979_list = filter (\x -> let digs = map (read . return) $ show x in
                                 evens digs /= odds digs) [11, 22 ..]
       where evens [] = 0; evens [x] = x; evens (x:_:xs) = x + evens xs
             odds [] = 0; odds [x] = 0; odds (_:x:xs) = x + odds xs
    -- Reinhard Zumkeller, Jul 05 2014
  • Maple
    filter:= proc(n) local L,i;
      L:= convert(n,base,10);
      abs(add(L[i]*(-1)^i,i=1..nops(L))) = 11
    end proc:
    select(filter, [$1..1000] *~ 11); # Robert Israel, Jun 02 2023
  • Mathematica
    Do[ a = IntegerDigits[ n ]; l = Length[ a ]; e = o = {}; Do[ o = Append[ o, a[ [ 2k - 1 ] ] ], {k, 1, l/2 + .5} ]; Do[ e = Append[ e, a[ [ 2k ] ] ], {k, 1, l/2} ]; If[ Abs[ Apply[ Plus, o ] - Apply[ Plus, e ] ] == 11, Print[ n ] ], {n, 1, 2000} ]
    d11Q[n_]:=Module[{idn=IntegerDigits[n]},Abs[Total[Table[(-1)^(i+1) idn[[i]],{i,Length[idn]}]]]==11]; Select[Range[1800],d11Q] (* Harvey P. Dale, Aug 26 2012 *)

Extensions

Erroneous comment deleted by Robert Israel, Jun 02 2023

A214527 Numbers k such that the alternating sum of decimal digits of k is zero.

Original entry on oeis.org

101, 112, 123, 134, 145, 156, 167, 178, 189, 202, 213, 224, 235, 246, 257, 268, 279, 303, 314, 325, 336, 347, 358, 369, 404, 415, 426, 437, 448, 459, 505, 516, 527, 538, 549, 606, 617, 628, 639, 707, 718, 729, 808, 819, 909, 1010, 1021, 1032, 1043, 1054, 1065, 1076
Offset: 1

Views

Author

Alex Ratushnyak, Aug 08 2012

Keywords

Comments

Alternating sum starts with plus after the most significant digit, for example
1+0-1 = 0, so 101 is in the sequence, also
4+3-7 = 0, 1+0-7+6 = 0, so 437 and 1076 are in the sequence.

Crossrefs

Cf. A135499: same definition except that the alternating sum starts with minus after the most significant digit.

Programs

  • Python
    a = []
    for n in range(1, 2000):
        t = str(n)
        s = int(t[0])
        s += sum((-1)**i * int(d) for i, d in enumerate(t[1:]))
        if s == 0:
             a.append(n)
    print(a)

A244212 Numbers n for which the alternating sum of the digits of n^n is 0.

Original entry on oeis.org

22, 55, 77, 99, 132, 187, 286, 1056, 1463, 1474, 1606, 1837, 2277, 2981, 4785, 4851, 5313, 5588, 5929, 7227, 8272, 8415, 8492, 8954, 11517, 12573, 12628, 13156, 14883, 15972, 17688, 22066, 23936, 24915, 25850, 27522, 34045, 36289, 36806, 38489, 40744, 43450, 46794, 48092
Offset: 1

Views

Author

Anthony Sand, Jun 23 2014

Keywords

Comments

The result of alternately adding and subtracting the digits of n sometimes differs in sign when the procedure goes from left to right or right to left. For example, if n = 1234, 1 - 2 + 3 - 4 = -2, whereas 4 - 3 + 2 - 1 = +2. However, if the sum is zero when adding and subtracting from left to right, it will also be zero when adding and subtracting from right to left.
n such that A000312(n) is in A135499. - Robert Israel, Jul 13 2014
All terms are multiples of 11. This follows from the divisibility rule for 11. - Jens Kruse Andersen, Jul 13 2014
Number of terms less than 10^k: 0, 4, 7, 24, 55, 135, ..., . - Robert G. Wilson v, Jul 18 2014
Numbers for which the alternating sum of the digits of n^n are == 0 (Mod 10): 12, 22, 23, 35, 45, 46, 47, 55, 57, 77, 99, 117, 126, 132, 151, ..., . Obviously the members of A244212 are included here. - Robert G. Wilson v, Jul 20 2014

Examples

			22^22 = 341427877364219557396646723584, therefore the alternating sum = 4 - 8 + 5 - 3 + 2 - 7 + 6 - 4 + 6 - 6 + 9 - 3 + 7 - 5 + 5 - 9 + 1 - 2 + 4 - 6 + 3 - 7 + 7 - 8 + 7 - 2 + 4 - 1 + 4 - 3 = 0.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local x,j;
       x:= convert(n^n,base,10);
       evalb(add((-1)^j*x[j],j=1..nops(x)) = 0)
    end proc;
    select(filter, 11 * [$1..1000]); # Robert Israel, Jul 13 2014
  • Mathematica
    fQ[n_] := Block[{id = IntegerDigits[ n^n]}, Sum[ id[[i]]*(-1)^i, {i, Length@ id}] == 0]; k = 11; lst = {}; While[k < 100001, If[ fQ@ k, AppendTo[ lst, k]; Print@ k]; k+= 11]; lst (* Robert G. Wilson v, Jul 13 2014 *)
  • PARI
    isok(n) = d = digits(n^n) ; sum(i=1, #d, d[i]*(-1)^i) == 0; \\ Michel Marcus, Jun 25 2014

Formula

s = 0; m = 1; for digit[n,i=1..j] of n, s = s + digit[i] * m; m = -m; next i; if s = 0, print n;

Extensions

a(9)-a(24) from Michel Marcus, Jun 23 2014
a(25)-a(44) from Robert G. Wilson v, Jul 13 2014

A384212 a(n) is the number of bases >= 2 in which the alternating sum of digits of n is equal to 0.

Original entry on oeis.org

0, 0, 1, 1, 1, 2, 1, 2, 2, 2, 1, 4, 1, 2, 3, 3, 1, 4, 1, 3, 2, 2, 1, 6, 2, 2, 3, 4, 1, 6, 1, 4, 3, 2, 2, 7, 1, 2, 3, 6, 1, 5, 1, 4, 5, 2, 1, 8, 2, 3, 3, 4, 1, 5, 2, 6, 3, 2, 1, 9, 1, 2, 5, 5, 3, 6, 1, 4, 2, 6, 1, 10, 1, 2, 5, 4, 2, 5, 1, 8, 3, 2, 1, 8, 3, 2, 2
Offset: 1

Views

Author

Felix Huber, May 24 2025

Keywords

Comments

The alternating sum of digits of n is equal to 1 for base n and equal to n for bases > n.

Examples

			a(72) = 10 because the alternating sum of digits of n is equal to 0 in the 10 bases 2 [1, 0, 0, 1, 0, 0, 0], 3 [2, 2, 0, 0], 5 [2, 4, 2], 7 [1, 3, 2], 8 [1, 1, 0], 11 [6, 6], 17 [4, 4], 23 [3, 3], 35 [2, 2] and 71 [1, 1].
		

Crossrefs

Programs

  • Maple
    A384212:=proc(n)
        local a,b,c,i;
        a:=0;
        for b from 2 to n-1 do
            c:=convert(n,'base',b);
        	   if add(c[i]*(-1)^i,i=1..nops(c))=0 then
               a:=a+1
            fi
        od;
        return a
    end proc;
    seq(A384212(n),n=1..87);
    A384212bases:=proc(n)
        local L,b,c,i;
        L:=[];
        for b from 2 to n-1 do
            c:=convert(n,'base',b);
        	if add(c[i]*(-1)^i,i=1..nops(c))=0 then
                L:=[op(L),b,ListTools:-Reverse(c)]
            fi
        od;
        return op(L)
    end proc;
    A384212bases(72);
  • Mathematica
    q[n_, b_] := Module[{d = IntegerDigits[n, b]}, Sum[(-1)^k*d[[k]], {k, 1, Length[d]}] == 0 ]; a[n_] := Count[Range[2, n-1], ?(q[n, #] &)]; Array[a, 100] (* _Amiram Eldar, May 24 2025 *)
  • PARI
    a(n) = sum(b=2, n-1, my(d=digits(n, b)); sum(k=1, #d, (-1)^k*d[k]) == 0); \\ Michel Marcus, May 24 2025
  • Python
    from sympy.ntheory import digits
    def s(v): return sum(v[::2]) - sum(v[1::2])
    def a(n): return sum(1 for b in range(2, n) if s(digits(n, b)[1:]) == 0)
    print([a(n) for n in range(1, 87)]) # Michael S. Branicky, May 24 2025
    

Formula

Trivial bounds: 1 <= a(n) <= n - 2 for n >= 3 because the representation of n in base n-1 is [1,1] and the alternating sum of digits of n is > 0 for bases >= n.

A309489 Numbers k such that the sum of digits in odd places is equal to the sum of digits in even places in k!.

Original entry on oeis.org

11, 18, 20, 25, 27, 28, 32, 35, 41, 43, 51, 57, 60, 68, 72, 74, 80, 102, 105, 107, 113, 121, 122, 138, 140, 145, 156, 161, 166, 171, 228, 233, 245, 282, 301, 307, 308, 311, 315, 329, 333, 335, 340, 347, 349, 351, 353, 366, 386, 412, 420, 454, 469, 478
Offset: 1

Views

Author

Daniel Starodubtsev, Aug 04 2019

Keywords

Comments

Numbers k such that A000142(k) is a term of A135499. - Michel Marcus, Aug 04 2019

Crossrefs

Cf. A000142 (n!), A135499.

Programs

  • Mathematica
    aQ[n_] := Total[(d = IntegerDigits[n!])[[1;;-1;;2]]] == Total[d[[2;;-1;;2]]]; Select[Range[500], aQ] (* Amiram Eldar, Aug 04 2019 *)
    sdoeQ[n_]:=With[{nf=IntegerDigits[n!]},Total[Take[nf,{1,-1,2}]]==Total[Take[nf,{2,-1,2}]]]; Select[Range[500],sdoeQ] (* Harvey P. Dale, Jun 04 2025 *)
  • PARI
    isok(k) = {my(d = digits(k!), so=0, se=0); for (i=1, #d, if (i%2, so += d[i], se += d[i])); so == se; } \\ Michel Marcus, Aug 04 2019
    
  • Python
    def c(n): s = str(n); return sum(map(int, s[::2])) == sum(map(int, s[1::2]))
    def afind(limit):
        k, factk = 1, 1
        while k <= limit:
            if c(factk): print(k, end=", ")
            k += 1; factk *= k
    afind(500) # Michael S. Branicky, Nov 18 2021

A382337 Palindromes in base 10 in which the difference between the sums of the digits in the even and odd positions is zero.

Original entry on oeis.org

0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 121, 242, 363, 484, 1001, 1111, 1221, 1331, 1441, 1551, 1661, 1771, 1881, 1991, 2002, 2112, 2222, 2332, 2442, 2552, 2662, 2772, 2882, 2992, 3003, 3113, 3223, 3333, 3443, 3553, 3663, 3773, 3883, 3993, 4004, 4114, 4224, 4334, 4444, 4554, 4664, 4774, 4884, 4994
Offset: 1

Views

Author

Alexander Yutkin, Mar 22 2025

Keywords

Crossrefs

Intersection of A002113 and A135499.

Programs

  • Mathematica
    Select[11 * Range[0, 500], PalindromeQ[#] && Total[IntegerDigits[#][[1 ;; -1 ;; 2]]] == Total[IntegerDigits[#][[2 ;; -1 ;; 2]]] &] (* Amiram Eldar, Mar 22 2025 *)
Showing 1-8 of 8 results.