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 11 results. Next

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.

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

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

A158085 Starting at a(1)=2, a(n) is the smallest prime larger than a(n-1) such that the sum of odd digits of a(n) is not smaller than the sum of odd digits of a(n-1).

Original entry on oeis.org

2, 3, 5, 7, 17, 19, 37, 59, 79, 97, 179, 197, 199, 379, 397, 577, 599, 797, 977, 997, 1979, 1997, 1999, 5779, 7759, 7993, 9199, 9397, 9739, 9973, 13799, 13997, 13999, 17599, 17959, 17977, 19597, 19759, 19777, 19979
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Mar 12 2009

Keywords

Comments

"Odd digits" means odd-valued digits (not digits in odd-indexed positions).

Examples

			The sequence of the sums of odd digits is 0, 3=3, 5=5, 7=7, 1+7=8, 1+9=10, 3+7=10, 5+9=14, 7+9=16, 9+7=16, 1+7+9=17, 1+9+7=17, 1+9+9=19 and so on. - _R. J. Mathar_, Feb 02 2015
		

Programs

  • Maple
    A158085 := proc(n)
        option remember;
        if n =1 then
            2;
        else
            for a from procname(n-1)+1 do
                if isprime(a) then
                    if A071649(a) >= A071649(procname(n-1)) then
                        return a;
                    end if;
                end if;
            end do:
    end if; # R. J. Mathar, Feb 02 2015
  • Mathematica
    spl[n_]:=Module[{sod=Total[Select[IntegerDigits[n],OddQ]],p1= NextPrime[ n]}, While[ Total[ Select[ IntegerDigits[ p1],OddQ]]Harvey P. Dale, Nov 15 2018 *)

Formula

A071649(a(n)) >= A071649(a(n-1)). - R. J. Mathar, Feb 02 2015

Extensions

Corrected (997 inserted, 1699 removed, 9199 to 9739 inserted) by R. J. Mathar, May 19 2010

A340015 a(n) is the least even number not used earlier and equal to the sum of the odd digits of the terms up to and including a(n), if such a number exists; otherwise, a(n) is the least odd number not occurring earlier.

Original entry on oeis.org

0, 1, 3, 4, 5, 10, 7, 18, 9, 30, 11, 13, 15, 42, 17, 19, 60, 21, 23, 64, 25, 76, 27, 92, 29, 102, 31, 33, 114, 116, 118, 35, 130, 134, 138, 37, 154, 39, 174, 41, 43, 45, 184, 194, 47, 49, 51, 53, 224, 55, 57, 246, 59, 260, 61, 63, 264, 65, 276, 67, 292, 69, 304, 71, 316, 73, 332, 338, 75, 358, 77, 79, 81, 83, 85, 87, 404, 89, 414, 91
Offset: 0

Views

Author

Eric Angelini and Carole Dubois, Dec 26 2020

Keywords

Comments

From M. F. Hasler, Dec 06 2022: (Start)
From the definition it is immediate that any even term is equal to the sum of all odd digits in the sequence up to that term.
Also, the subsequences of terms of given parity are both strictly increasing: The odd terms give exactly the sequence of all odd numbers, A005408, and any even number not occurring before a given even a(n) (e.g., 2, 6, 8, 12, 14, 16, ...) will never occur in the sequence.
The search space to check whether an even number can extend the sequence is bounded because using a number with more digits can increase the sum of digits by at most 9 per digit, while the number itself becomes (roughly) 10 times larger with each additional digit.
We have the following properties:
1) If the sum of all odd digits up to a(n) has only even digits, then a(n+1) equals that sum.
2) An even term a(n) can never be immediately followed by a term a(n+1) with only even digits.
3) An even term a(n) can be followed by another even term a(n+1) if the sum of the odd digits of a(n+1) is equal to a(n+1) - a(n), as for example at (..., 114, 116, 118, ...) and (..., 130, 134, 138, ...).
4) If a(n) is even and s = (sum of the odd digits of a(n)) can be added to a(n) without changing any of a(n)'s odd digits and leaving a(n)'s even digits even, then a(n+1) <= a(n) + s. (There may be a smaller solution a(n+1) whose sum of odd digits is smaller than s.) (End)

Examples

			The 1st nonzero even term is 4 and 4 is the sum of the odd digits so far, 1 and 3;
The 2nd even term is 10 and 10 is the sum of 1+3+5+1 (the last 1 being the 1 of 10 itself);
The 3rd even term is 18 and 10 is the sum of 1+3+5+1+7+1 (the last 1 being the 1 of 18 itself);
The 4th even term is 30 and 30 is the sum of 1+3+5+1+7+1+9+3 (the last 3 being the 3 of 30 itself); etc.
		

Crossrefs

Cf. A005408 (odd numbers), A071649 (sum of odd decimal digits of n).

Programs

  • Python
    def A357051_first(N=100):
        S = []; used_even = set(); next_odd = 1; sod = 0 # sum of odd digits (so far)
        for n in range(N):
            x = sod + sod % 2; lim = sod + 9*len(str(x)); sodx = A071649(x)
            while x < lim:
                if x == sod + sodx and x not in used_even:
                    used_even |= { x } ; break
                x += 2
                if x % 10 == 0:
                    sodx = A071649(x)
                    if sodx == 1: lim += 9
            else: x = next_odd; next_odd += 2; sodx = A071649(x)
            S += [ x ] ; sod += sodx
        return S
    # M. F. Hasler, Dec 06 2022

A226017 Primes such that sum of odd digits is also prime.

Original entry on oeis.org

3, 5, 7, 11, 23, 43, 47, 67, 83, 101, 113, 131, 137, 139, 151, 157, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 263, 283, 311, 313, 317, 331, 337, 353, 359, 373, 379, 397, 443, 463, 467, 487, 557, 571, 577, 593, 599, 607, 643, 647, 683, 719, 733, 739
Offset: 1

Views

Author

Jayanta Basu, May 23 2013

Keywords

Comments

Primes such that A104260(n) is prime.

Examples

			181 is a member since sum of odd digits=2.
		

Crossrefs

Programs

  • Mathematica
    soQ[n_]:=PrimeQ[Total[Select[IntegerDigits[n],OddQ[#] &]]]; Select[Prime[Range[132]],soQ[#] &]
Showing 1-10 of 11 results. Next