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.

A339508 Number of subsets of {2..n} such that the product of the elements is a decimal palindrome.

This page as a plain text file.
%I A339508 #45 Feb 16 2025 08:34:01
%S A339508 1,1,2,4,6,7,8,10,11,13,13,33,43,56,70,73,99,114,134,151,151,185,333,
%T A339508 372,445,456,558,565,672,1031,1031,1220,1518,1967,2161,2176,2238,5399,
%U A339508 5543,6720,6720,8857,10019,11819,16882,16896,18072,19299,21267,23405,23405,24686
%N A339508 Number of subsets of {2..n} such that the product of the elements is a decimal palindrome.
%C A339508 a(k*10) = a(k*10-1) because all new products end in 0, thus not palindromes. - _Michael S. Branicky_, Dec 08 2020
%H A339508 David A. Corneth, <a href="/A339508/a339508.gp.txt">List of factorizations of the a(n) products for n = 1..51</a>.
%H A339508 David A. Corneth, <a href="/A339508/a339508_2.gp.txt">Lower bounds on a(n) for n = 0..100</a>.
%H A339508 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PalindromicNumber.html">Palindromic Number</a>
%H A339508 <a href="/index/Pac#palindromes">Index entries for sequences related to palindromes</a>
%e A339508 a(9) = 13 subsets: {}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {2, 3}, {2, 4}, {4, 7, 9} and {2, 3, 6, 7}.
%o A339508 (Python)
%o A339508 from numpy import prod
%o A339508 from itertools import combinations
%o A339508 def a(n):
%o A339508     ans = 1  # empty set
%o A339508     for r in range(1, n):
%o A339508         for s in combinations(range(2, n+1), r):
%o A339508             strsp = str(prod(s))
%o A339508             ans += strsp==strsp[::-1]
%o A339508     return ans
%o A339508 print([a(n) for n in range(20)])  # _Michael S. Branicky_, Dec 08 2020
%o A339508 (Python)
%o A339508 from functools import lru_cache, reduce
%o A339508 from operator import mul
%o A339508 from itertools import combinations
%o A339508 @lru_cache(maxsize=None)
%o A339508 def A339508(n):
%o A339508     nlist = [i for i in range(2,n) if i % 10 != 0]
%o A339508     if n == 0 or n == 1:
%o A339508         return 1
%o A339508     c = A339508(n-1)
%o A339508     if n % 10 != 0:
%o A339508         if str(n) == str(n)[::-1]:
%o A339508             c += 1
%o A339508         for i in range(1,len(nlist)+1):
%o A339508             for d in combinations(nlist,i):
%o A339508                 s = str(reduce(mul,d)*n)
%o A339508                 if s == s[::-1]:
%o A339508                     c += 1
%o A339508     return c # _Chai Wah Wu_, Dec 08 2020
%o A339508 (Python)
%o A339508 from functools import lru_cache
%o A339508 def cond(p): sp = str(p); return sp == sp[::-1]
%o A339508 @lru_cache(maxsize=None)
%o A339508 def b(n, p):
%o A339508     if n == 1: return int(cond(p))
%o A339508     return b(n-1, p) + b(n-1, p*n) if p*n%10 else b(n-1, p)
%o A339508 def a(n): return 1 if n < 2 else b(n, 1)
%o A339508 print([a(n) for n in range(36)]) # _Michael S. Branicky_, Oct 05 2022
%Y A339508 Cf. A002113, A093888, A339507.
%K A339508 nonn,base
%O A339508 0,3
%A A339508 _Ilya Gutkovskiy_, Dec 07 2020
%E A339508 a(23)-a(32) from _Michael S. Branicky_, Dec 08 2020
%E A339508 a(33)-a(42) from _Chai Wah Wu_, Dec 08 2020
%E A339508 a(43)-a(48) from _Chai Wah Wu_, Dec 11 2020
%E A339508 a(49)-a(51) from _Michael S. Branicky_, Oct 05 2022