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.

A356177 Palindromes in A333369.

This page as a plain text file.
%I A356177 #29 Jul 30 2022 12:59:57
%S A356177 1,3,5,7,9,22,44,66,88,111,212,232,252,272,292,333,414,434,454,474,
%T A356177 494,555,616,636,656,676,696,777,818,838,858,878,898,999,2002,2222,
%U A356177 2442,2662,2882,4004,4224,4444,4664,4884,6006,6226,6446,6666,6886,8008,8228,8448,8668,8888,10101
%N A356177 Palindromes in A333369.
%C A356177 If a term has a decimal digit that is odd, it must have an odd number of decimal digits and all odd digits are the same. - _Chai Wah Wu_, Jul 29 2022
%C A356177 If a term has an even number of decimal digits, then it must have only even decimal digits. - _Bernard Schott_, Jul 30 2022
%H A356177 Michael S. Branicky, <a href="/A356177/b356177.txt">Table of n, a(n) for n = 1..10000</a>
%e A356177 474 is palindrome and 474 has two 4's and one 7 in its decimal expansion, hence 474 is a term.
%t A356177 simQ[n_] := AllTrue[Tally @ IntegerDigits[n], EvenQ[Plus @@ #] &]; Select[Range[10^4], PalindromeQ[#] && simQ[#] &] (* _Amiram Eldar_, Jul 28 2022 *)
%o A356177 (Python)
%o A356177 from itertools import count, islice, product
%o A356177 def simb(n): s = str(n); return all(s.count(d)%2==int(d)%2 for d in set(s))
%o A356177 def pals(): # generator of palindromes
%o A356177     digits = "0123456789"
%o A356177     for d in count(1):
%o A356177         for p in product(digits, repeat=d//2):
%o A356177             if d > 1 and p[0] == "0": continue
%o A356177             left = "".join(p); right = left[::-1]
%o A356177             for mid in [[""], digits][d%2]:
%o A356177                 yield int(left + mid + right)
%o A356177 def agen(): yield from filter(simb, pals())
%o A356177 print(list(islice(agen(), 55))) # _Michael S. Branicky_, Jul 28 2022
%o A356177 (Python) # faster version based on Comments
%o A356177 from itertools import count, islice, product
%o A356177 def odgen(d): yield from [1, 3, 5, 7, 9] if d == 1 else sorted(int(f+"".join(p)+o+"".join(p[::-1])+f) for o in "13579" for f in o + "2468" for p in product(o+"02468", repeat=d//2-1))
%o A356177 def evgen(d): yield from (int(f+"".join(p)+"".join(p[::-1])+f) for f in "2468" for p in product("02468", repeat=d//2-1))
%o A356177 def A356177gen():
%o A356177     for d in count(1, step=2): yield from odgen(d); yield from evgen(d+1)
%o A356177 print(list(islice(A356177gen(), 55))) # _Michael S. Branicky_, Jul 30 2022
%Y A356177 Intersection of A002113 and A333369.
%Y A356177 Cf. A355770, A355771, A355772, A100706 (subsequence of repunits).
%K A356177 nonn,base
%O A356177 1,2
%A A356177 _Bernard Schott_, Jul 28 2022