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

A030141 Numbers in which parity of the decimal digits alternates.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 21, 23, 25, 27, 29, 30, 32, 34, 36, 38, 41, 43, 45, 47, 49, 50, 52, 54, 56, 58, 61, 63, 65, 67, 69, 70, 72, 74, 76, 78, 81, 83, 85, 87, 89, 90, 92, 94, 96, 98, 101, 103, 105, 107, 109, 121, 123, 125, 127, 129
Offset: 1

Views

Author

Keywords

Comments

An alternating integer is a positive integer for which, in base-10, the parity of its digits alternates.
The number of terms < 10^n (n>=0): 1, 10, 55, 280, 1405, 7030, 35155, ..., . - Robert G. Wilson v, Apr 01 2011
The number of terms between 10^n and 10^(n+1) is 9 * 5^n for n>=0. For n>=0, number of terms < 10^n is 1 + 9 * (5^n-1)/4. - Franklin T. Adams-Watters, Apr 01 2011
A228710(a(n)) = 1. - Reinhard Zumkeller, Aug 31 2013

Examples

			121 is alternating and in the sequence because its consecutive digits are odd-even-odd, 1 being odd and 2 even. Of course, 1234567890 is also alternating.
		

Crossrefs

Programs

  • Haskell
    a030141 n = a030141_list !! (n-1)
    a030141_list = filter ((== 1) . a228710) [0..]
    -- Reinhard Zumkeller, Aug 31 2013
    
  • Mathematica
    fQ[n_] := Block[{m = Mod[ IntegerDigits@ n, 2]}, m == Split[m, UnsameQ][[1]]]; Select[ Range[0, 130], fQ] (* Robert G. Wilson v, Apr 01 2011 *)
    Select[Range[0,150],FreeQ[Differences[Boole[EvenQ[IntegerDigits[#]]]],0]&] (* Harvey P. Dale, Jul 19 2025 *)
  • PARI
    is(n,d=digits(n))=for(i=2,#d, if((d[i]-d[i-1])%2==0, return(0))); 1 \\ Charles R Greathouse IV, Jul 08 2022
    
  • Python
    from itertools import count
    def A030141_gen(startvalue=0): # generator of terms >= startvalue
        return filter(lambda n:all(int(a)+int(b)&1 for a, b in zip(str(n),str(n)[1:])),count(max(startvalue,0)))
    A030141_list = list(islice(A030141_gen(),30)) # Chai Wah Wu, Jul 12 2022
    
  • Python
    from itertools import chain, count, islice
    def altgen(seed, digits):
        allowed = "02468" if seed in "13579" else "13579"
        if digits == 1: yield from allowed; return
        for f in allowed: yield from (f + r for r in altgen(f, digits-1))
    def agen(): yield from chain(range(10), (int(f+r) for d in count(2) for f in "123456789" for r in altgen(f, d-1)))
    print(list(islice(agen(), 65))) # Michael S. Branicky, Jul 12 2022

Extensions

Offset corrected by Reinhard Zumkeller, Aug 31 2013

A110303 Alternators.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75
Offset: 1

Views

Author

Walter Nissen, Jul 18 2005

Keywords

Comments

An alternating integer is a positive integer for which, in base-10, the parity of its digits alternates. E.g., 121 is alternating because its consecutive digits are odd-even-odd, 1 being odd and 2 even. Of course, 1234567890 is also alternating. An alternator is a positive integer which has a multiple which is alternating.
This sequence is the answer to the 6th problem proposed the 2nd day by Iran during the 45th International Mathematical Olympiad, in Athens (Greece), 2004 (see links). - Bernard Schott, Apr 12 2021

Examples

			11 is an alternator and in the sequence because it has a multiple which is alternating. The least of these multiples is 121.
		

Crossrefs

Programs

Formula

Positive n, not congruent to 0 mod 20.
a(n + 19) = a(n) + 20. - David A. Corneth, Apr 13 2021

Extensions

Offset 1 from Michel Marcus, May 12 2021

A110304 Least alternating multiple of alternators.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 121, 12, 52, 14, 30, 16, 34, 18, 38, 0, 21, 418, 23, 72, 25, 52, 27, 56, 29, 30, 341, 32, 165, 34, 70, 36, 74, 38, 78, 0, 41, 210, 43, 616, 45, 92, 47, 96, 49, 50, 561, 52, 212, 54, 165, 56, 456, 58, 236, 0, 61, 434, 63, 256, 65, 858, 67, 272, 69
Offset: 1

Views

Author

Walter Nissen, Jul 18 2005

Keywords

Comments

An alternating integer is a positive integer for which, in base-10, the parity of its digits alternates. E.g., 121 is alternating because its consecutive digits are odd-even-odd, 1 being odd and 2 even. Of course, 1234567890 is also alternating. An alternator is a positive integer which has a multiple which is alternating.
For n congruent to 0 mod 20, a(n) is shown as zero to indicate that n is not an alternator.

Examples

			a(11) = 121 because 121 is the least multiple of 11 which is alternating.
		

Crossrefs

A343335 a(n) is the smallest proper alternating multiple of n when n is not a multiple of 20, otherwise a(20*k) = 0 for k >= 1.

Original entry on oeis.org

2, 4, 6, 8, 10, 12, 14, 16, 18, 30, 121, 36, 52, 56, 30, 32, 34, 36, 38, 0, 63, 418, 69, 72, 50, 52, 54, 56, 58, 90, 341, 96, 165, 238, 70, 72, 74, 76, 78, 0, 123, 210, 129, 616, 90, 92, 94, 96, 98, 250, 561, 416, 212, 216, 165, 616, 456, 232, 236, 0, 183, 434, 189, 256, 325, 858
Offset: 1

Views

Author

Bernard Schott, Apr 12 2021

Keywords

Comments

Every positive integer that is not multiple of 20 is called an alternator (A110303) because it has a multiple in which parity of the decimal digits alternates (see link) and that is called an alternating integer (A030141).
If n is an alternator, n <> 20*k, k>=1, then a(n) is the smallest alternating multiple k*n, with k > 1.
If n is congruent to 0 mod 20, a(n) is set to zero to indicate that n is not an alternator.
This sequence is a variant of A110304, but here the smallest alternating multiple of n cannot be n, when n is an alternating integer.

Examples

			For n = 13, 2 * 13 = 26, 3 * 13 = 39, 4 * 13 = 52 that is alternating, so, a(13) = 52.
		

Crossrefs

Programs

  • Mathematica
    altQ[n_] := (r = Mod[IntegerDigits[n], 2]) == Split[r, UnsameQ][[1]]; a[n_] := If[Divisible[n, 20], 0, Module[{k = 2*n}, While[!altQ[k], k += n]; k]]; Array[a, 100] (* Amiram Eldar, Apr 12 2021 *)

A343336 Factors of alternators which produce least alternating proper multiples.

Original entry on oeis.org

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

Views

Author

Bernard Schott, Apr 15 2021

Keywords

Comments

Every positive integer that is not multiple of 20 is called an alternator (A110303) because it has a multiple in which parity of the decimal digits alternates and that is called an alternating integer (A030141).
If n is an alternator, n <> 20*k, a(n) is the smallest q > 1, such that q*n is a proper alternating multiple of n; this is a variant of A110305 where q = 1 is authorized when n is an alternating alternator.
If n is congruent to 0 mod 20, a(n) is set to zero to indicate that n is not an alternator.

Examples

			a(14) = 4 because the successive proper multiples of 14 are 28, 42 that are not alternating, then, 4*14 = 56 is alternating because 5 is odd and 6 is even.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local k,L;
      if n mod 20 = 0 then return 0 fi;
      if n <= 4 then return 2 fi;
      for k from 2 do
        L:= convert(k*n,base,10) mod 2;
        if convert(L[1..-2]+L[2..-1],set) = {1} then return k fi;
      od
    end proc:
    map(f, [$1..100]); # Robert Israel, Apr 15 2021
  • Mathematica
    altQ[n_] := (r = Mod[IntegerDigits[n], 2]) == Split[r, UnsameQ][[1]]; a[n_] := If[Divisible[n, 20], 0, Module[{k = 2*n}, While[! altQ[k], k += n]; k/n]]; Array[a, 100] (* Amiram Eldar, Apr 15 2021 *)

Formula

a(n) >= A110305(n).

Extensions

Name edited by Michel Marcus, May 12 2021
Showing 1-5 of 5 results.