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-10 of 12 results. Next

A036301 Numbers whose sum of even digits and sum of odd digits are equal.

Original entry on oeis.org

0, 112, 121, 134, 143, 156, 165, 178, 187, 211, 314, 336, 341, 358, 363, 385, 413, 431, 516, 538, 561, 583, 615, 633, 651, 718, 781, 817, 835, 853, 871, 1012, 1021, 1034, 1043, 1056, 1065, 1078, 1087, 1102, 1120, 1201, 1210, 1223, 1232, 1245, 1254, 1267, 1276, 1289, 1298
Offset: 1

Views

Author

Patrick De Geest, Dec 15 1998

Keywords

Crossrefs

Cf. A071650 (sum of odd digits minus sum of even digits).

Programs

  • Magma
    [ n: n in [0..1300] | (#A eq 0 select 0 else &+A) eq (#B eq 0 select 0 else &+B) where A is [ d: d in D | IsOdd(d) ] where B is [ d: d in D | IsEven(d) ] where D is Intseq(n) ];
    
  • Mathematica
    Select[Range[0,10000], Plus @@Select[IntegerDigits[ # ], OddQ]\[Equal]Plus @@Select[IntegerDigits[ # ], EvenQ]&] (* Zak Seidov, Feb 17 2005 *)
  • PARI
    select( is_A036301(n)=!vecsum(apply(t->(-1)^t*t,digits(n))), [0..1999]) \\ This defines the function is_A036301 = !A071650; the surrounding select(...) just serves as a check and illustration. - M. F. Hasler, Dec 09 2018
    A36301=[112]; A036301(n, L=#A36301)={while(n>L, A36301=concat(A36301, next_A036301(A36301[L], L, L+=1))); A36301[n]} \\ M. F. Hasler, Aug 11 2023
    next_A036301(N, L=#A36301, k=setsearch(A36301, N+1, 1)) = if(k>L, until( is_A036301(N+=1),); N, k, A36301[k], N+1) \\ next larger term: min { a(k) > N }. - M. F. Hasler, Aug 11 2023
    
  • 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) == 0]
    print(aupto(1298)) # Michael S. Branicky, Feb 21 2021

Formula

This set A036301 = { n | A071650(n) = 0 }. - M. F. Hasler, Aug 11 2023

Extensions

Zero added by Zak Seidov, Nov 22 2010
Name edited by Michel Marcus, Jan 14 2021

A124176 Consider the map f that sends m to m + (sum of odd digits of m) - (sum of even digits of m). Sequence gives numbers m such that f^(k)(m) = m for some k.

Original entry on oeis.org

0, 11, 13, 17, 18, 25, 28, 54, 55, 64, 65, 112, 121, 134, 137, 143, 148, 155, 156, 165, 166, 173, 178, 184, 187, 198, 200, 209, 211, 216, 231, 233, 234, 237, 244, 245, 270, 275, 280, 285, 314, 336, 341, 358, 363, 385, 396, 402, 407, 410, 413, 429, 431, 432
Offset: 1

Views

Author

Eric Angelini, Dec 04 2006

Keywords

Comments

Terms computed by Barry and Theunis de Jong.
Subsequence A036301 lists fixed points of the map f = A304439. - M. F. Hasler, May 18 2018

Examples

			11 and 13 loop on themselves, but 12 doesn't:
11 -> 13 -> 17 -> 25 -> 28 -> 18 -> 11
12 -> 11 -> 13 -> 17 -> 25 -> 28 -> 18 -> 11
13 -> 17 -> 25 -> 28 -> 18 -> 11 -> 13.
		

Crossrefs

Programs

  • PARI
    is(n,S=List())=until(setsearch(Set(S),n=A304439(n)),listput(S,n));n==S[1] \\ M. F. Hasler, May 18 2018

A124177 Consider the map f that sends m to m + (sum of even digits of m) - (sum of odd digits of m). Sequence gives numbers m such that f^(k)(m) = m for some k.

Original entry on oeis.org

0, 22, 26, 27, 34, 35, 44, 49, 52, 63, 66, 78, 79, 81, 88, 99, 104, 107, 108, 112, 115, 121, 126, 133, 134, 143, 144, 151, 156, 165, 178, 187, 211, 224, 229, 232, 233, 283, 290, 314, 336, 341, 358, 363, 385, 413, 431, 467, 470, 489, 492, 516, 538, 561, 583, 615
Offset: 1

Views

Author

Eric Angelini, Dec 04 2006

Keywords

Comments

Terms computed by Theunis de Jong.
Subsequence A036301 lists fixed points of the map f = A304440. - M. F. Hasler, May 18 2018

Examples

			26 and 27 loop on themselves, but 28 doesn't.
26 -> 34 -> 35 -> 27 -> 22 -> 26
27 -> 22 -> 26 -> 34 -> 35 -> 27
28 -> 38 -> 43 -> 44 -> 52 -> 49 -> 44.
		

Crossrefs

Programs

  • PARI
    is(n,S=List())={until(setsearch(Set(S),n=A304440(n)),listput(S,n));n==S[1]} \\ M. F. Hasler, May 18 2018

A071649 Sum of odd decimal digits of n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, May 28 2002

Keywords

Crossrefs

a(n) = A007953(n) - A071648(n).

Programs

  • Maple
    A071649 := proc(n)
          local a,d;
          a := 0 ;
          for d in convert(n,base,10) do
            if type(d,'odd') then
                a := a+d ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Feb 02 2015
  • Mathematica
    Table[Total[Select[IntegerDigits[n], OddQ[#] &]],{n,92}] (* Jayanta Basu, May 23 2013 *)
  • PARI
    a(n)=my(d=digits(n)); sum(i=1,#d,if(d[i]%2,d[i])) \\ Charles R Greathouse IV, Apr 04 2014
    
  • PARI
    A071649(n)=vecsum(select(d->bittest(d,0), digits(n))) \\ Nearly twice as fast. - M. F. Hasler, Dec 09 2018
    
  • Python
    A071649 = lambda x: sum(d for d in map(int, str(x)) if d&1) # M. F. Hasler, Dec 07 2022

Formula

a(n) = 0 iff n is in A014263. - Bernard Schott, Mar 17 2023

A071648 Sum of even decimal digits of n.

Original entry on oeis.org

0, 2, 0, 4, 0, 6, 0, 8, 0, 0, 0, 2, 0, 4, 0, 6, 0, 8, 0, 2, 2, 4, 2, 6, 2, 8, 2, 10, 2, 0, 0, 2, 0, 4, 0, 6, 0, 8, 0, 4, 4, 6, 4, 8, 4, 10, 4, 12, 4, 0, 0, 2, 0, 4, 0, 6, 0, 8, 0, 6, 6, 8, 6, 10, 6, 12, 6, 14, 6, 0, 0, 2, 0, 4, 0, 6, 0, 8, 0, 8, 8, 10, 8, 12, 8, 14, 8, 16, 8, 0, 0, 2
Offset: 1

Views

Author

Reinhard Zumkeller, May 28 2002

Keywords

Crossrefs

Programs

  • Mathematica
    Array[Total@ Select[IntegerDigits@ #, EvenQ] &, 101] (* Michael De Vlieger, Dec 09 2018 *)
  • PARI
    a(n)=my(d=digits(n)); sum(i=1,#d,if(d[i]%2,,d[i])) \\ Charles R Greathouse IV, Apr 04 2014
    
  • PARI
    A071648(n)=vecsum(select(d->!bittest(d,0),digits(n))) \\ Nearly twice as fast. - M. F. Hasler, Dec 09 2018

Formula

a(n) = A007953(n) - A071649(n). (Corrected by M. F. Hasler, Dec 09 2018)

A304439 Add to n the sum of its odd digits minus the sum of its even digits.

Original entry on oeis.org

0, 2, 0, 6, 0, 10, 0, 14, 0, 18, 11, 13, 11, 17, 11, 21, 11, 25, 11, 29, 18, 20, 18, 24, 18, 28, 18, 32, 18, 36, 33, 35, 33, 39, 33, 43, 33, 47, 33, 51, 36, 38, 36, 42, 36, 46, 36, 50, 36, 54, 55, 57, 55, 61, 55, 65, 55, 69, 55, 73, 54, 56, 54, 60, 54, 64, 54, 68, 54, 72
Offset: 0

Views

Author

M. F. Hasler, May 18 2018

Keywords

Comments

Subsequence A036301 lists fixed points of this map, the first nontrivial one being 112. It is a subsequence of A124176 (and A124177) which considers iterations of this map, more precisely, numbers which are in a cyclic orbit for iterations of this map.

Crossrefs

Programs

  • Mathematica
    soded[n_]:=Module[{idn=IntegerDigits[n]},n+Total[Select[idn,OddQ]]-Total[ Select[idn,EvenQ]]]; Array[soded,70,0] (* Harvey P. Dale, Aug 12 2021 *)
  • PARI
    A304439(n)=n-vecsum(apply(t->t*(-1)^t,digits(n)))

Formula

a(n) = n + A071650(n).

A304440 Add to n the sum of its even digits minus the sum of its odd digits.

Original entry on oeis.org

0, 0, 4, 0, 8, 0, 12, 0, 16, 0, 9, 9, 13, 9, 17, 9, 21, 9, 25, 9, 22, 22, 26, 22, 30, 22, 34, 22, 38, 22, 27, 27, 31, 27, 35, 27, 39, 27, 43, 27, 44, 44, 48, 44, 52, 44, 56, 44, 60, 44, 45, 45, 49, 45, 53, 45, 57, 45, 61, 45, 66, 66, 70, 66, 74, 66, 78, 66, 82, 66, 63
Offset: 0

Views

Author

M. F. Hasler, May 18 2018

Keywords

Comments

A036301 lists fixed points of this map, the first nonzero one being 112. It is also a subsequence of A124177 (and A124176) which lists numbers which are in a cyclic orbit under iterations of this map.

Crossrefs

Cf. A304439 (variant: + even - odd digits), A071650 (odd - even digits), A071648, A071649, A036301 (fixed points), A124177, A124176.

Programs

  • Mathematica
    nseo[n_]:=Module[{idn=IntegerDigits[n]},n+Total[Select[idn,EvenQ]]-Total[Select[idn,OddQ]]]; Array[nseo,80,0] (* Harvey P. Dale, Dec 26 2023 *)
  • PARI
    A304440(n)=n+vecsum(apply(t->t*(-1)^t,digits(n)))

Formula

a(n) = n - A071650(n).

A111309 Absolute difference between the sum of the odd digits and the sum of the even digits of the n-th prime.

Original entry on oeis.org

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

Views

Author

Zak Seidov and Robert G. Wilson v, Mar 02 2005

Keywords

Examples

			a(9)=1 because the 9th prime is 23 and the absolute difference between 2 & 3 is 1.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local Lo,Le;
      Lo,Le:= selectremove(type,convert(n,base,10),odd);
      abs(convert(Lo,`+`)-convert(Le,`+`))
    end proc:
    map(f, [seq(ithprime(i),i=1..100)]); # Robert Israel, Nov 12 2024
  • Mathematica
    f[n_] := (id = IntegerDigits[ Prime[n]]; Abs[(Plus @@ id) - 2Plus @@ Select[id, OddQ]]); Table[f[n], {n, 91}]

Extensions

Edited by Charles R Greathouse IV, Aug 04 2010

A303269 Sum of squares of odd digits minus sum of squares of even digits of n.

Original entry on oeis.org

0, 1, -4, 9, -16, 25, -36, 49, -64, 81, 1, 2, -3, 10, -15, 26, -35, 50, -63, 82, -4, -3, -8, 5, -20, 21, -40, 45, -68, 77, 9, 10, 5, 18, -7, 34, -27, 58, -55, 90, -16, -15, -20, -7, -32, 9, -52, 33, -80, 65, 25, 26, 21, 34, 9, 50, -11, 74, -39, 106, -36, -35, -40, -27
Offset: 0

Views

Author

M. F. Hasler, May 18 2018

Keywords

Comments

Up to 10^4, resp. 10^5, there are 5824, resp. 59316, positive terms. All terms from a(1) to a(11111) are nonzero: see A076164 for indices of zeros.

Crossrefs

Programs

  • PARI
    A303269(n)=-vecsum(apply(d->d^2*(-1)^d,digits(n)))

A341005 Numbers whose sum of even digits and sum of odd digits differ by 4.

Original entry on oeis.org

4, 13, 22, 31, 40, 103, 116, 125, 130, 138, 147, 152, 161, 169, 174, 183, 196, 202, 215, 220, 233, 251, 301, 310, 318, 323, 332, 345, 354, 367, 376, 381, 389, 398, 400, 417, 435, 453, 471, 512, 521, 534, 543, 556, 565, 578, 587, 611, 619, 637, 655, 673, 691, 714, 736, 741, 758
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).
Cf. A071650 (difference between sum of even and sum of odd digits).

Programs

  • Mathematica
    Select[Range[1000], Abs[Plus @@ Select[(d = IntegerDigits[#]), OddQ] - Plus @@ Select[d, EvenQ]] == 4 &] (* Amiram Eldar, Feb 02 2021 *)
  • Python
    def ok(n):
      sums = [0, 0]
      for d in str(n): sums[d in "13579"] += int(d)
      return abs(sums[0] - sums[1]) == 4
    print(list(filter(ok, range(759)))) # Michael S. Branicky, Apr 13 2021
Showing 1-10 of 12 results. Next