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.

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

A071650 Difference between sums of odd and even digits of n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, May 28 2002

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Total[Select[IntegerDigits[n],OddQ]]-Total[Select[ IntegerDigits[ n],EvenQ]],{n,80}] (* Harvey P. Dale, Jul 27 2020 *)
  • PARI
    a(n) = {my(d=digits(n), s = 0); for (k=1, #d, if (d[k] % 2, s += d[k], s -= d[k]);); s;} \\ Michel Marcus, Aug 05 2017
    
  • PARI
    A071650(n)=-vecsum(apply(t->(-1)^t*t,digits(n))) \\ M. F. Hasler, Dec 09 2018

Formula

a(n) = A071649(n) - A071648(n);
a(A036301(n)) = 0.

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

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).

A341012 The cumulative sum of the even digits so far in the sequence and the cumulative sum of the odd digits so far differ by n for all a(n)s.

Original entry on oeis.org

1, 10, 16, 7, 23, 32, 45, 54, 67, 76, 89, 98, 100, 203, 225, 230, 247, 252, 269, 274, 296, 302, 320, 405, 427, 449, 450, 472, 494, 504, 522, 540, 607, 629, 670, 692, 706, 724, 742, 760, 809, 890, 908, 926, 944, 962, 980, 1000, 1112, 1121, 1134, 1143, 1156, 1165, 1178
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Feb 02 2021

Keywords

Comments

This is the lexicographically earliest sequence of distinct integers > 0 having this property.

Examples

			Say that the current sequence is S, the cumulative sum at any moment of the even digits of S is E, the cumulative sum at any moment of the odd digits of S is O and the absolute difference |E-O| is D. We would then have:
S = 1, 10, 16, 7, 23, 32, 45, 54, 67, 76, 89, 98,...
E = 0   0   6  6   8  10  14  18  24  30  38  46
O = 1   2   3 10  13  16  21  26  33  40  49  58
D = 1   2   3  4   5   6   7   8   9  10  11  12 <-- this is = n.
		

Crossrefs

Cf. A341002 (numbers whose sum of even digits and sum of odd digits differ by 1).

A156614 a(1)=2, a(n+1) is the smallest prime with sum of even digits >= sum of even digits of a(n).

Original entry on oeis.org

2, 23, 29, 41, 43, 47, 61, 67, 83, 89, 181, 263, 269, 281, 283, 461, 463, 467, 487, 661, 683, 863, 881, 883, 887, 1889, 2683, 2687, 2689, 2861, 2887, 4861, 4889, 6689, 6863, 6869, 6883, 8681, 8689, 8861, 8863, 8867, 8887, 26881
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Feb 11 2009

Keywords

Comments

An increasing sequence of primes a(n) such that the sequence A071648(a(n)) is nondecreasing. - R. J. Mathar, May 15 2010

Examples

			2, 23(2=2), 29(2=2), 41(4>2), 43(4=4), 61(6>4), 67(6=6), 83(8>6), 89(8=8), 181(8=8), 263(2+6=8), 269(2+6=2+6), 281(2+8>2+6), 283(2+8=2+8), 461(4+6=2+8), etc.
		

Crossrefs

Cf. A000040.

Programs

  • Mathematica
    t={}; max=0; Do[p=Prime[i]; If[(x=Total[Select[IntegerDigits[p],EvenQ[#] &]])>=max, max = x; AppendTo[t,p]],{i,3000}]; t (* Jayanta Basu, May 22 2013 *)
    sped[p_]:=Module[{d1=Total[Select[IntegerDigits[p],EvenQ]],p2=NextPrime[p]},While[ Total[ Select[ IntegerDigits[ p2],EvenQ]]Harvey P. Dale, Jan 22 2024 *)

Extensions

Corrected (4861 inserted) by R. J. Mathar, May 15 2010
Showing 1-8 of 8 results.