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.

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