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.

This page as a plain text file.
%I A030147 #24 Jul 04 2023 18:53:50
%S A030147 0,1,2,3,4,5,6,7,8,9,101,121,141,161,181,212,232,252,272,292,303,323,
%T A030147 343,363,383,414,434,454,474,494,505,525,545,565,585,616,636,656,676,
%U A030147 696,707,727,747,767,787,818,838,858,878,898,909,929,949
%N A030147 Palindromes in which parity of digits alternates.
%C A030147 All terms have an odd number of digits. - _Alonso del Arte_, Jan 31 2020
%H A030147 Reinhard Zumkeller, <a href="/A030147/b030147.txt">Table of n, a(n) for n = 1..10000</a>
%H A030147 <a href="/index/Pac#palindromes">Index entries for sequences related to palindromes</a>
%F A030147 A136522(a(n)) * A228710(a(n)) = 1. - _Reinhard Zumkeller_, Aug 31 2013
%t A030147 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 *)
%t A030147 Join[Range[0,9],Select[Range[100000],PalindromeQ[#]&&Union[Total/@Partition[Boole[ EvenQ[ IntegerDigits[ #]]],2,1]] =={1}&]] (* _Harvey P. Dale_, Jul 04 2023 *)
%o A030147 (Haskell)
%o A030147 a030147 n = a030147_list !! (n-1)
%o A030147 a030147_list = filter ((== 1) . a228710) a002113_list
%o A030147 -- _Reinhard Zumkeller_, Aug 31 2013
%o A030147 (Scala) def isPal(n: Int) = (n.toString == n.toString.reverse)
%o A030147 def alternsPar(n: Int): Boolean = {
%o A030147   val dPars = Integer.toString(n).toList.map(_ % 2 == 0)
%o A030147   val scanPars = (dPars zip dPars.tail).map{ case (x, y) => x ^ y }
%o A030147   scanPars.toSet == Set(true)
%o A030147 }
%o A030147 (0 to 9) ++: (10 to 999).filter(isPal).filter(alternsPar) // _Alonso del Arte_, Feb 02 2020
%Y A030147 Intersection of A002113 and A030141.
%Y A030147 Subsequence of A001633.
%Y A030147 Cf. A030143, A030144, A030152.
%K A030147 nonn,base
%O A030147 1,3
%A A030147 _Patrick De Geest_