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.

Previous Showing 21-30 of 33 results. Next

A341007 Numbers whose sum of even digits and sum of odd digits differ by 6.

Original entry on oeis.org

6, 15, 24, 33, 42, 51, 60, 105, 118, 127, 149, 150, 172, 181, 194, 204, 217, 222, 235, 240, 253, 271, 303, 325, 330, 347, 352, 369, 374, 396, 402, 419, 420, 437, 455, 473, 491, 501, 510, 523, 532, 545, 554, 567, 576, 589, 598, 600, 639, 657, 675, 693, 712, 721, 734, 743, 756
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Feb 02 2021

Keywords

Crossrefs

Cf. A036301 (sums are equal), A341002 to A341010 (sums differ by 1 to 9).

Programs

  • Mathematica
    Select[Range[1000], Abs[Plus @@ Select[(d = IntegerDigits[#]), OddQ] - Plus @@ Select[d, EvenQ]] == 6 &] (* Amiram Eldar, Feb 02 2021 *)

A341008 Numbers whose sum of even digits and sum of odd digits differ by 7.

Original entry on oeis.org

7, 18, 29, 70, 81, 92, 108, 115, 126, 133, 144, 151, 162, 180, 209, 216, 238, 261, 283, 290, 313, 328, 331, 346, 364, 382, 414, 436, 441, 458, 463, 485, 511, 548, 566, 584, 612, 621, 634, 643, 656, 665, 678, 687, 700, 768, 786, 801, 810, 823, 832, 845, 854, 867, 876, 889, 898
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Feb 02 2021

Keywords

Crossrefs

Cf. A036301 (sums are equal), A341002 to A341010 (sums differ by 1 to 9).

Programs

  • Mathematica
    Select[Range[1000], Abs[Plus @@ Select[(d = IntegerDigits[#]), OddQ] - Plus @@ Select[d, EvenQ]] == 7 &] (* Amiram Eldar, Feb 02 2021 *)
  • Python
    def ok(n):
      s = str(n)
      return abs(sum(map(int, s))-2*sum(int(d) for d in s if d in "2468")) == 7
    print(list(filter(ok, range(900)))) # Michael S. Branicky, Jul 18 2021

A341009 Numbers whose sum of even digits and sum of odd digits differ by 8.

Original entry on oeis.org

8, 17, 26, 35, 44, 53, 62, 71, 80, 107, 129, 170, 192, 206, 219, 224, 237, 242, 255, 260, 273, 291, 305, 327, 349, 350, 372, 394, 404, 422, 439, 440, 457, 475, 493, 503, 525, 530, 547, 552, 569, 574, 596, 602, 620, 659, 677, 695, 701, 710, 723, 732, 745, 754, 767, 776, 789
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Feb 02 2021

Keywords

Crossrefs

Cf. A009994, A036301 (sums are equal), A341002 to A341010 (sums differ by 1 to 9).

Programs

  • Mathematica
    Select[Range[1000], Abs[Plus @@ Select[(d = IntegerDigits[#]), OddQ] - Plus @@ Select[d, EvenQ]] == 8 &] (* Amiram Eldar, Feb 02 2021 *)
  • Python
    def eodiff(n):
      digs = list(map(int, str(n)))
      return abs(sum(d for d in digs if d%2==0)-sum(d for d in digs if d%2==1))
    def aupto(lim): return [m for m in range(lim+1) if eodiff(m) == 8]
    print(aupto(789)) # Michael S. Branicky, Feb 21 2021

A341011 a(n) is the smallest positive number m not yet in the sequence with the property that the sum of the even digits of m and the sum of the odd digits of m differ by n.

Original entry on oeis.org

112, 1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 119, 39, 139, 59, 159, 79, 179, 99, 199, 488, 399, 688, 599, 888, 799, 1799, 999, 1999, 11999, 3999, 13999, 5999, 15999, 7999, 17999, 9999, 19999, 68888, 39999, 88888, 59999, 159999, 79999, 179999, 99999, 199999, 1199999, 399999, 1399999, 599999, 1599999, 799999, 1799999, 999999
Offset: 0

Views

Author

Carole Dubois and Eric Angelini, Feb 02 2021

Keywords

Comments

This is the lexicographically earliest sequence of distinct integers > 0 having this property.
Indices of terms not congruent to 9 (mod 10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 20, 22, 24, 38, 40, 56, .... - Robert G. Wilson v, Feb 21 2021

Examples

			a(19) = 199 since 199 is the smallest number such that the sum of even digits (0) and the sum of odd digits (19) differ by n = 19;
a(20) = 488 since 488 is the smallest number such that the sum of even digits (20) and the sum of odd digits (0) differ by n = 20; etc.
		

Crossrefs

Programs

  • Mathematica
    del[n_] := Abs[Plus @@ Select[(d = IntegerDigits[n]), OddQ] - Plus @@ Select[d, EvenQ]]; m = 54; s = Table[0, {m}]; c = n = 0; While[c < m, n++; i = del[n]; If[i > 0 && i <= m && s[[i]] == 0, c++; s[[i]] = n]]; s (* Amiram Eldar, Feb 02 2021 *)
    f[n_] := Block[{b, c, d, e, o}, d = 0; c = Floor[n/9]; b = 10^c -1; While[n != (Plus @@ IntegerDigits[d*10^c + b]), If[ OddQ@ d, d += 2, d++]]; o = d*10^c + b;
    d = 0; c = Floor[n/8]; b = 8(10^c -1)/9; While[n != (Plus @@ IntegerDigits[d*10^c + b]), If[ OddQ@ d, d++, d += 2]]; e = d*10^c + b; Min[o, e]]; f[0] = 112; (* Robert G. Wilson v, Feb 21 2021 *)

Extensions

a(0) added by Robert G. Wilson v, Feb 21 2021

A351378 For all a(2n) the cumulative sum of the even digits used so far in the sequence [including a(2n)] is twice the cumulative sum of the odd digits used so far in the sequence [including a(2n)]. This is the lexicographically earliest sequence of distinct positive numbers with this property.

Original entry on oeis.org

1, 2, 3, 6, 4, 11, 5, 28, 7, 68, 8, 13, 9, 288, 10, 14, 12, 21, 15, 48, 16, 23, 17, 88, 18, 30, 19, 488, 20, 34, 22, 32, 24, 45, 25, 26, 27, 66, 29, 268, 31, 44, 33, 84, 35, 286, 36, 63, 37, 668, 38, 43, 39, 888, 40, 56, 41, 58, 42, 54, 46, 47, 49, 86, 50, 64, 51, 168, 52, 62, 53, 448, 55, 686, 57, 2688, 59
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Feb 09 2022

Keywords

Comments

The sequence is a permutation of the positive integers.

Examples

			This sequence : 1, 2, 3, 6,  4, 11,  5, 28,  7, 68,  8, 13, 9, 288, 10, 14, 12 ...
Even dig. sums: 0, 2, 2, 8, 12, 12, 12, 22, 22, 36, 44, 44, 44, 62, 62, 66, 68 ...
Odd dig. sums : 1, 1, 4, 4,  4,  6, 11, 11, 18, 18, 18, 22, 31, 31, 32, 33, 34 ...
                   x     x       x       x       x       x       x       x     ...
We see that 2 is twice 1, 8 is twice 4, 12 is twice 6, 22 is twice 11, 36 is twice 18, etc.
		

Crossrefs

A351406 For all a(2n) the cumulative sum of the odd digits used so far in the sequence [including a(2n)] is twice the cumulative sum of the even digits used so far in the sequence [including a(2n)]. This is the lexicographically earliest sequence of distinct numbers >= 0 with this property.

Original entry on oeis.org

0, 123, 1, 23, 2, 13, 3, 12, 4, 17, 5, 34, 6, 39, 7, 14, 8, 79, 9, 36, 10, 32, 11, 112, 15, 114, 16, 119, 18, 159, 19, 116, 20, 31, 21, 27, 22, 35, 24, 57, 25, 47, 26, 97, 28, 1199, 29, 43, 30, 45, 33, 141, 37, 158, 38, 139, 40, 53, 41, 70, 42, 75, 44, 709, 46
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Feb 10 2022

Keywords

Comments

The sequence is a permutation of the nonnegative integers.

Examples

			This sequence : 0, 123, 1, 23, 2, 13,  3, 12,  4, 17,  5, 34,  6, 39,  7, 14,  8, ...
Even dig. sums: 0,  2,  2,  4, 6,  6,  6,  8, 12, 12, 12, 16, 22, 22, 22, 26, 34, ...
Odd dig. sums : 0,  4,  5,  8, 8, 12, 15, 16, 16, 24, 29, 32, 32, 44, 51, 52, 52, ...
                    x       x      x       x       x       x       x       x      ...
We see that 4 is twice 2, 8 is twice 4, 12 is twice 6, 16 is twice 8, 24 is twice 12, etc.
		

Crossrefs

A076164 Numbers n such that sum of squares of even digits of n equals sum of squares of odd digits of n.

Original entry on oeis.org

0, 11112, 11121, 11211, 11356, 11365, 11536, 11563, 11635, 11653, 12111, 13156, 13165, 13516, 13561, 13615, 13651, 15136, 15163, 15316, 15361, 15613, 15631, 16135, 16153, 16315, 16351, 16513, 16531, 21111, 31156, 31165, 31516, 31561
Offset: 1

Views

Author

Zak Seidov, Nov 01 2002

Keywords

Comments

The minimal number of digits in any nonzero term is 5.
Numbers such that the sum of even digits equals the sum of odd digits are listed in A036301.

Examples

			11356 is in the sequence because 1^2 + 1^2 + 3^2 + 5^2 = 6^2.
		

Crossrefs

Cf. A303269, A036301 (analog without squares), A071650, A304439, A304440, A124176, A124177.

Programs

  • Mathematica
    oeQ[n_]:=Module[{idn=IntegerDigits[n]},Total[Select[idn,OddQ]^2]== Total[ Select[ idn, EvenQ]^2]]; Select[Range[0,99999],oeQ] (* Harvey P. Dale, Sep 23 2011 *)
  • PARI
    is(n)=!vecsum(apply(d->d^2*(-1)^d,digits(n))) \\ M. F. Hasler, May 18 2018

Extensions

Edited and a(1) = 0 added by M. F. Hasler, May 18 2018

A103849 Rearrangement of natural numbers according to sums of odd and even digits.

Original entry on oeis.org

0, 112, 1, 2, 121, 3, 4, 134, 5, 6, 143, 7, 8, 156, 9, 12, 165, 10, 14, 178, 11, 16, 187, 13, 18, 211, 15, 20, 314, 17, 21, 336, 19, 22, 341, 23, 24, 358, 25, 26, 363, 27, 28, 385, 29, 34, 413, 30, 36, 431, 31, 38, 516, 32, 40, 538, 33, 41, 561, 35, 42, 583, 37, 43, 615, 39
Offset: 1

Views

Author

Zak Seidov, Feb 18 2005

Keywords

Comments

Sum of odd digits (less than, equals and larger than) sum of even digits A103829, A036301, 103848.

Examples

			k=1: a(1)=A103829(1), a(2)=A036301(1), a(3)=A103848(1).
		

Crossrefs

Formula

n=3k-2, a(n)=A103829(k); n=3k-1, a(n)=A036301(k); n=3k-1, a(n)=A103848(k); (k=1, 2, ...)

A330674 Lexicographically earliest infinite sequence of distinct nonnegative terms such that a(n+1) is obtained by adding to a(n) the odd digits of a(n) and subtracting the even ones.

Original entry on oeis.org

1, 2, 0, 3, 6, 4, 5, 10, 11, 13, 17, 25, 28, 18, 7, 14, 8, 9, 12, 15, 21, 20, 16, 19, 29, 36, 33, 39, 51, 57, 69, 72, 77, 91, 101, 103, 107, 115, 122, 119, 130, 134, 22, 23, 24, 26, 27, 32, 30, 31, 35, 43, 42, 34, 37, 47, 50, 55, 65, 64, 54, 38, 40, 41, 44, 45, 46, 48, 49, 52, 53, 61, 56, 58, 59, 73, 83, 78
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Dec 24 2019

Keywords

Comments

When an iteration reproduces a term already in the sequence, we cancel this iteration and restart the sequence from there with the smallest integer not yet present in the sequence.

Examples

			As a(1) = 1, we get a(2) = 2 by adding the odd digit 1 to a(1);
as a(2) = 2, we  get a(3) = 0 by subtracting the even digit 2 from a(2);
as a(3) = 0, we stop to iterate (0 would produce 0, already in the sequence) and restart the sequence with a(4) = 3, the smallest integer not present;
as a(4) = 3, we get a(5) = 6 by adding the odd digit 3 to a(4);
as a(5) = 6, we stop to iterate (6-6 produces 0, already in the sequence) and restart the sequence with a(6) = 4, the smallest integer not present;
as a(6) = 4, we stop to iterate (4-4 produces 0, already in the sequence) and restart the sequence with a(7) = 5, the smallest integer not present;
as a(7) = 5, we get a(8) = 10 by adding the odd digit 5 to a(7);
as a(8) = 10, we get a(9) = 11 by adding the odd digit 1 to a(8);
as a(9) = 11, we get a(10) = 13 by adding the odd digits 1 and 1 to a(9); etc.
		

Crossrefs

Cf. A036301 (Numbers n such that sum of even digits of n equals sum of odd digits of n).

Programs

  • Mathematica
    Nest[Append[#1, If[FreeQ[#1, #2], #2, Block[{k = 3}, While[! FreeQ[#1, k], k++]; k]] & @@ {#1, #1[[-1]] + Total@ Select[#2, OddQ] - Total@ Select[#2, EvenQ]} & @@ {#, IntegerDigits@ #[[-1]]}] &, {1}, 77] (* Michael De Vlieger, Dec 24 2019 *)

A340125 Numbers whose sum of even digits and sum of odd digits are equal and whose digits are in nondecreasing order.

Original entry on oeis.org

0, 112, 134, 156, 178, 336, 358, 1223, 1245, 1267, 1289, 1447, 1469, 2334, 2356, 2378, 2558, 3445, 3467, 3489, 3669, 4556, 4578, 5667, 5689, 6778, 7889, 11114, 11136, 11158, 11338, 12225, 12247, 12269, 12449, 22233, 22345, 22367, 22389, 22556, 22578, 23447, 23469, 24455
Offset: 1

Views

Author

David A. Corneth, Feb 21 2021

Keywords

Examples

			1223 is in the sequence as the sum of the odd digits is 1 + 3 = 4 and the sum of the even digits is 2 + 2 = 4 are equal.
		

Crossrefs

Intersection of A009994 and A036301.

Programs

  • Mathematica
    seodQ[n_]:=With[{idn=IntegerDigits[n]},Total[Select[idn,EvenQ]]==Total[Select[idn,OddQ]]&&Min[Differences[idn]]>=0]; Select[Range[0,25000],seodQ] (* Harvey P. Dale, Dec 30 2024 *)
  • PARI
    is(n) = { my(d = digits(n), w = vector(2)); if(d != vecsort(d), return(0)); for(i = 1, #d, w[d[i]%2 + 1] += d[i] ); w[1] == w[2] }
    
  • Python
    def ok(n):
      digs = list(map(int, str(n)))
      return sorted(digs) == digs and sum(d*(-1)**d for d in digs) == 0
    def aupto(lim): return [m for m in range(lim+1) if ok(m)]
    print(aupto(24455)) # Michael S. Branicky, Feb 21 2021
Previous Showing 21-30 of 33 results. Next