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

A030142 Odd numbers in which parity of digits alternates.

Original entry on oeis.org

1, 3, 5, 7, 9, 21, 23, 25, 27, 29, 41, 43, 45, 47, 49, 61, 63, 65, 67, 69, 81, 83, 85, 87, 89, 101, 103, 105, 107, 109, 121, 123, 125, 127, 129, 141, 143, 145, 147, 149, 161, 163, 165, 167, 169, 181, 183, 185, 187, 189, 301, 303, 305, 307, 309, 321, 323
Offset: 1

Views

Author

Keywords

Comments

a(n) = A179085(n) for n <= 25. - Reinhard Zumkeller, Jun 28 2010

Crossrefs

Cf. A030143, A062285, intersection of A005408 and A030141.

Programs

  • Haskell
    a030142 n = a030142_list !! (n-1)
    a030142_list = filter odd a030141_list
    -- Reinhard Zumkeller, Aug 31 2013
  • Mathematica
    id[n_]:=IntegerDigits[n];t={}; Do[If[Length[id[n]]==1, AppendTo[t,n], If[Union[Abs[Differences[Boole /@ EvenQ[id[n]]]]] == {1}, AppendTo[t,n]]], {n,1,323,2}]; t (* Jayanta Basu, May 07 2013 *)
    Join[{1, 3, 5, 7, 9}, Select[Range[21, 323, 2], Total[Abs[Differences[Mod[(id = IntegerDigits[#]), 2]]]] == Length[id] - 1 &]] (* Zak Seidov, May 07 2013 *)

Formula

(a(n) mod 2) * A228710(a(n)) = 1. - Reinhard Zumkeller, Aug 31 2013

Extensions

Offset corrected by Reinhard Zumkeller, Jun 28 2010

A030143 Even numbers in which parity of digits alternates.

Original entry on oeis.org

0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 30, 32, 34, 36, 38, 50, 52, 54, 56, 58, 70, 72, 74, 76, 78, 90, 92, 94, 96, 98, 210, 212, 214, 216, 218, 230, 232, 234, 236, 238, 250, 252, 254, 256, 258, 270, 272, 274, 276, 278, 290, 292, 294, 296, 298, 410, 412, 414
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A030142, A062285, intersection of A005843 and A030141.

Programs

  • Haskell
    a030143 n = a030143_list !! (n-1)
    a030143_list = filter even a030141_list
    -- Reinhard Zumkeller, Aug 31 2013
  • Mathematica
    id[n_]:=IntegerDigits[n]; t={}; Do[If[Length[id[n]]==1, AppendTo[t,n],If[Union[Abs[Differences[Boole /@ EvenQ[id[n]]]]]=={1}, AppendTo[t,n]]], {n,0,414,2}]; t (* Jayanta Basu, May 07 2013 *)

Formula

(1 - a(n) mod 2) * A228710(a(n)) = 1. - Reinhard Zumkeller, Aug 31 2013

Extensions

Offset corrected by Reinhard Zumkeller, Aug 31 2013

A080467 Multiples of 11 in which the even positioned digits from left are odd and the odd positioned ones are even.

Original entry on oeis.org

0, 418, 616, 638, 814, 836, 858, 2101, 2123, 2145, 2167, 2189, 2321, 2343, 2365, 2387, 2541, 2563, 2585, 2761, 2783, 2981, 4103, 4125, 4147, 4169, 4301, 4323, 4345, 4367, 4389, 4521, 4543, 4565, 4587, 4741, 4763, 4785, 4961, 4983, 6105, 6127, 6149
Offset: 1

Views

Author

Amarnath Murthy, Mar 02 2003

Keywords

Crossrefs

Intersection of A008593 and A062285.
Cf. A080466.

Extensions

Terms corrected by Andrew Howroyd, Sep 29 2024

A376692 Numbers with the most significant digit odd and alternating parity of digits.

Original entry on oeis.org

1, 3, 5, 7, 9, 10, 12, 14, 16, 18, 30, 32, 34, 36, 38, 50, 52, 54, 56, 58, 70, 72, 74, 76, 78, 90, 92, 94, 96, 98, 101, 103, 105, 107, 109, 121, 123, 125, 127, 129, 141, 143, 145, 147, 149, 161, 163, 165, 167, 169, 181, 183, 185, 187, 189, 301, 303, 305, 307, 309
Offset: 1

Views

Author

Andrew Howroyd, Oct 01 2024

Keywords

Crossrefs

Complement of A062285 within A030141.

Programs

  • PARI
    isok(n)=my(d=digits(n)); for(i=1, #d, if((d[i]-i)%2, return(0))); 1
Showing 1-5 of 5 results.