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

A068879 Duplicate of A030152.

Original entry on oeis.org

1, 4, 9, 16, 25, 36, 49, 81, 121, 169, 256, 361, 529, 676, 729, 961, 1296, 4761, 5476
Offset: 1

Views

Author

Keywords

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

A030144 Primes in which parity of digits alternates.

Original entry on oeis.org

2, 3, 5, 7, 23, 29, 41, 43, 47, 61, 67, 83, 89, 101, 103, 107, 109, 127, 149, 163, 167, 181, 307, 347, 349, 367, 383, 389, 503, 509, 521, 523, 541, 547, 563, 569, 587, 701, 709, 727, 743, 761, 769, 787, 907, 929, 941, 947, 967, 983, 2129, 2141, 2143, 2161, 2309
Offset: 1

Views

Author

Keywords

Examples

			2129 is a term as 2, 1, 2 and 9 have even and odd parity alternately.
		

Crossrefs

Intersection of A000040 and A030141.

Programs

  • Haskell
    a030144 n = a030144_list !! (n-1)
    a030144_list = filter ((== 1) . a228710) a000040_list
    -- Reinhard Zumkeller, Aug 31 2013
  • Mathematica
    Join[{2,3,5,7},Select[Prime[Range[400]],Union[Abs[Differences[Boole/@ EvenQ[ IntegerDigits[#]]]]] == {1}&]] (* Harvey P. Dale, Jul 26 2011 *)

Formula

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

Extensions

Offset corrected by Reinhard Zumkeller, Aug 31 2013

A068882 Triangular numbers with property that digits alternate in parity.

Original entry on oeis.org

1, 3, 6, 10, 21, 36, 45, 78, 105, 210, 276, 325, 496, 561, 630, 703, 741, 903, 1830, 2145, 2701, 5050, 6105, 6903, 8385, 9870, 10585, 12561, 14365, 18145, 18721, 23436, 25878, 29890, 30381, 32385, 36585, 38503, 38781, 41616, 47278, 50721
Offset: 1

Views

Author

Amarnath Murthy, Mar 19 2002

Keywords

Examples

			1830 is a term as 1, 8, 3 and 0 have odd and even parity alternately.
		

Crossrefs

Programs

  • Mathematica
    altQ[n_] := n < 10 || Union[ Total /@ Partition[ Mod[ IntegerDigits@n, 2], 2, 1]] == {1}; t[n_] := n (n + 1)/2; Select[ t@ Range@ 400, altQ] (* Giovanni Resta, Aug 17 2018 *)

Extensions

More terms from Sascha Kurz, Mar 23 2002

A030151 Numbers k such that in k^2 the parity of digits alternates.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 19, 23, 26, 27, 31, 36, 69, 74, 81, 84, 96, 111, 113, 119, 127, 137, 181, 187, 204, 237, 264, 269, 273, 277, 281, 296, 311, 384, 404, 426, 461, 463, 539, 574, 584, 606, 661, 673, 677, 689, 726, 736, 764, 819
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    upto=2000;tfs=Flatten[Table[{True,False},{Ceiling[IntegerLength[ upto]]}]]; altparQ[n_]:= Module[{n2=n^2},MemberQ[Partition[ tfs,IntegerLength[n2],1], EvenQ/@IntegerDigits[n2]]]; Join[{0},Select[Range[upto],altparQ]] (* Harvey P. Dale, May 12 2011 *)

A030147 Palindromes in which parity of digits alternates.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 101, 121, 141, 161, 181, 212, 232, 252, 272, 292, 303, 323, 343, 363, 383, 414, 434, 454, 474, 494, 505, 525, 545, 565, 585, 616, 636, 656, 676, 696, 707, 727, 747, 767, 787, 818, 838, 858, 878, 898, 909, 929, 949
Offset: 1

Views

Author

Keywords

Comments

All terms have an odd number of digits. - Alonso del Arte, Jan 31 2020

Crossrefs

Intersection of A002113 and A030141.
Subsequence of A001633.

Programs

  • Haskell
    a030147 n = a030147_list !! (n-1)
    a030147_list = filter ((== 1) . a228710) a002113_list
    -- Reinhard Zumkeller, Aug 31 2013
    
  • Mathematica
    palQ[n_, b_:10] := (IntegerDigits[n, b] == Reverse[IntegerDigits[n, b]]); alternParQ[n_, b_:10] := (Union[BlockMap[Xor @@ # &, OddQ[IntegerDigits[n, b]], 2, 1]] == {True}); Join[Range[0, 9], Select[Range[1000], palQ[#] && alternParQ[#] &]] (* Alonso del Arte, Feb 02 2020 *)
    Join[Range[0,9],Select[Range[100000],PalindromeQ[#]&&Union[Total/@Partition[Boole[ EvenQ[ IntegerDigits[ #]]],2,1]] =={1}&]] (* Harvey P. Dale, Jul 04 2023 *)
  • Scala
    def isPal(n: Int) = (n.toString == n.toString.reverse)
    def alternsPar(n: Int): Boolean = {
      val dPars = Integer.toString(n).toList.map(_ % 2 == 0)
      val scanPars = (dPars zip dPars.tail).map{ case (x, y) => x ^ y }
      scanPars.toSet == Set(true)
    }
    (0 to 9) ++: (10 to 999).filter(isPal).filter(alternsPar) // Alonso del Arte, Feb 02 2020

Formula

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

A030160 Cubes in which parity of digits alternates.

Original entry on oeis.org

0, 1, 8, 27, 125, 216, 343, 729, 5832, 12167, 614125, 658503, 1030301, 1092727, 4741632, 8741816, 27270901, 27818127, 47832147, 381078125, 4767078987, 14905098181, 21670967872, 496981290961, 874545616547, 903670125632
Offset: 1

Views

Author

Keywords

Comments

The number ((1+10^2)*(1+10^8)*(1+10^32)*(1+10^128)*(1+10^512))^3 is a term of the sequence. - Giovanni Resta, Aug 16 2018

Crossrefs

Programs

  • Mathematica
    altQ[n_] := n < 10 || Union[Total /@ Partition[ Mod[ IntegerDigits@n, 2], 2, 1]] == {1}; Select[ Range[0, 10^4]^3, altQ[#] &] (* Giovanni Resta, Aug 16 2018 *)

Extensions

Offset changed by Giovanni Resta, Aug 16 2018

A030153 Numbers k such that in k and k^2 the parity of digits alternates.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 9, 16, 23, 27, 36, 69, 74, 81, 96, 127, 181, 187, 296, 874, 2327, 2369, 2723, 2727, 2763, 3816, 4589, 5874, 6563, 6589, 6727, 8323, 10181, 12723, 18163, 18587, 21236, 21274, 29236, 29274, 30127, 43296, 52361, 78163, 87616
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    altQ[n_] := n < 10 || Union[Total /@ Partition[ Mod[ IntegerDigits@n, 2], 2, 1]] == {1}; Select[ Range[0, 10^5], altQ[#] && altQ[#^2] &] (* Giovanni Resta, Aug 16 2018 *)

A030154 Squares such that in n and sqrt(n) the parity of digits alternates.

Original entry on oeis.org

0, 1, 4, 9, 16, 25, 36, 49, 81, 256, 529, 729, 1296, 4761, 5476, 6561, 9216, 16129, 32761, 34969, 87616, 763876, 5414929, 5612161, 7414729, 7436529, 7634169, 14561856, 21058921, 34503876, 43072969, 43414921, 45252529, 69272329
Offset: 1

Views

Author

Keywords

Comments

The more digits there are in n, the lower the likelihood that the parity of n's digits will strictly alternate. Thus, the terms of the sequence become increasingly rare as n gets larger. - Harvey P. Dale, Aug 05 2018
For n > 3 the last digit of a(n) isn't 0 or 4. - David A. Corneth, Aug 05 2018

Crossrefs

Programs

  • Mathematica
    pdaQ[n_]:=Module[{a=Mod[IntegerDigits[n],2],b=Mod[IntegerDigits[ Sqrt[ n]],2]},Length[ Split[a]] ==IntegerLength[n]&&Length[Split[b]]== IntegerLength[ Sqrt[n]]]; Join[{0},Select[Range[8500]^2,pdaQ]] (* Harvey P. Dale, Aug 05 2018 *)
  • PARI
    alternating(n)={my(v=digits(n)%2);0==#select(i->v[i]==v[i-1],[2..#v])}
    { for(n=0, 10^5, if(alternating(n^2) && alternating(n), print1(n^2, ", "))) } \\ Andrew Howroyd, Aug 05 2018
    
  • PARI
    \\ for larger n: requires alternating function above
    upto(n)={local(R=List([0])); my(recurse(s,b)=if(b0&&alternating(k^2\b), listput(R, k)); self()(k, 10*b)))))); recurse(0,1); listsort(R); Vec(R)}
    apply(n->n^2, upto(sqrtint(10^12))) \\ Andrew Howroyd, Aug 05 2018

Extensions

Offset changed by David A. Corneth, Aug 05 2018

A030156 Odd squares in which parity of digits alternates.

Original entry on oeis.org

1, 9, 25, 49, 81, 121, 169, 361, 529, 729, 961, 4761, 6561, 12321, 12769, 14161, 16129, 18769, 32761, 34969, 56169, 72361, 74529, 76729, 78961, 96721, 212521, 214369, 290521, 436921, 452929, 458329, 474721, 670761, 690561, 1038361
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    altQ[n_] := n < 10 || Union[Total /@ Partition[ Mod[ IntegerDigits@n, 2], 2, 1]] == {1}; Select[ Range[1, 2000, 2]^2, altQ[#] &] (* Giovanni Resta, Aug 16 2018 *)

Extensions

Offset changed by Giovanni Resta, Aug 16 2018
Showing 1-10 of 23 results. Next