Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #29 Jul 30 2022 12:59:57
%S 1,3,5,7,9,22,44,66,88,111,212,232,252,272,292,333,414,434,454,474,
%T 494,555,616,636,656,676,696,777,818,838,858,878,898,999,2002,2222,
%U 2442,2662,2882,4004,4224,4444,4664,4884,6006,6226,6446,6666,6886,8008,8228,8448,8668,8888,10101
%N Palindromes in A333369.
%C 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 If a term has an even number of decimal digits, then it must have only even decimal digits. - _Bernard Schott_, Jul 30 2022
%H Michael S. Branicky, <a href="/A356177/b356177.txt">Table of n, a(n) for n = 1..10000</a>
%e 474 is palindrome and 474 has two 4's and one 7 in its decimal expansion, hence 474 is a term.
%t simQ[n_] := AllTrue[Tally @ IntegerDigits[n], EvenQ[Plus @@ #] &]; Select[Range[10^4], PalindromeQ[#] && simQ[#] &] (* _Amiram Eldar_, Jul 28 2022 *)
%o (Python)
%o from itertools import count, islice, product
%o def simb(n): s = str(n); return all(s.count(d)%2==int(d)%2 for d in set(s))
%o def pals(): # generator of palindromes
%o digits = "0123456789"
%o for d in count(1):
%o for p in product(digits, repeat=d//2):
%o if d > 1 and p[0] == "0": continue
%o left = "".join(p); right = left[::-1]
%o for mid in [[""], digits][d%2]:
%o yield int(left + mid + right)
%o def agen(): yield from filter(simb, pals())
%o print(list(islice(agen(), 55))) # _Michael S. Branicky_, Jul 28 2022
%o (Python) # faster version based on Comments
%o from itertools import count, islice, product
%o 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 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 def A356177gen():
%o for d in count(1, step=2): yield from odgen(d); yield from evgen(d+1)
%o print(list(islice(A356177gen(), 55))) # _Michael S. Branicky_, Jul 30 2022
%Y Intersection of A002113 and A333369.
%Y Cf. A355770, A355771, A355772, A100706 (subsequence of repunits).
%K nonn,base
%O 1,2
%A _Bernard Schott_, Jul 28 2022