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.

A239480 Palindromes such that additive and multiplicative persistences coincide.

This page as a plain text file.
%I A239480 #12 Feb 16 2025 08:33:21
%S A239480 0,1,2,3,4,5,6,7,8,9,11,22,33,99,101,111,121,131,141,151,161,171,202,
%T A239480 212,222,262,282,303,313,393,404,424,454,474,525,545,565,585,595,636,
%U A239480 656,676,757,838,858,959,1001,1111,1221,1331,1441,1991,2002,2112,2552
%N A239480 Palindromes such that additive and multiplicative persistences coincide.
%C A239480 Palindromes k for which A031286(k) = A031346(k).
%H A239480 Michael S. Branicky, <a href="/A239480/b239480.txt">Table of n, a(n) for n = 1..10000</a>
%H A239480 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/AdditivePersistence.html">Additive Persistence</a>
%H A239480 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/MultiplicativePersistence.html">Multiplicative Persistence</a>
%H A239480 <a href="/index/Pac#palindromes">Index entries for sequences related to palindromes</a>
%F A239480 A002113 INTERSECT A239427.
%e A239480 99 -> 18 -> 9 has additive persistence 2. 99 -> 81 -> 8 has multiplicative persistence 2. The palindromic number 99 is therefore in the sequence.
%o A239480 (PARI) for(n=0, 2552, s=Vec(Str(n)); if(s==vecextract(s, "-1..1"), v=n; a=0; while(n>9, a++; n=sumdigits(n)); n=v; m=0; while(n>9, m++; d=digits(n); n=prod(k=1, #d, d[k])); n=v; if(a==m, print1(n, ", "))));
%o A239480 (Python)
%o A239480 from math import prod
%o A239480 from itertools import count, islice, product
%o A239480 def A031286(n):
%o A239480     ap = 0
%o A239480     while n > 9: n, ap = sum(map(int, str(n))), ap+1
%o A239480     return ap
%o A239480 def A031346(n):
%o A239480     mp = 0
%o A239480     while n > 9: n, mp = prod(map(int, str(n))), mp+1
%o A239480     return mp
%o A239480 def is_pal(n): return (s:=str(n)) == s[::-1]
%o A239480 def pals(base=10): # all d-digit palindromes
%o A239480     digits = "".join(str(i) for i in range(base))
%o A239480     for d in count(1):
%o A239480         for p in product(digits, repeat=d//2):
%o A239480             if d > 1 and p[0] == "0": continue
%o A239480             left = "".join(p); right = left[::-1]
%o A239480             for mid in [[""], digits][d%2]: yield int(left + mid + right)
%o A239480 def ok(n): return is_pal(n) and A031286(n) == A031346(n)
%o A239480 def agen(): yield from filter(ok, pals())
%o A239480 print(list(islice(agen(), 20))) # _Michael S. Branicky_, Jun 22 2023
%Y A239480 Cf. A002113, A031286, A031346, A239427.
%K A239480 nonn,base
%O A239480 1,3
%A A239480 _Arkadiusz Wesolowski_, Mar 20 2014