OFFSET
1,3
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..66 from Arkadiusz Wesolowski)
Eric Weisstein's World of Mathematics, Additive Persistence
Eric Weisstein's World of Mathematics, Multiplicative Persistence
EXAMPLE
28 -> 10 -> 1 has additive persistence 2. 28 -> 16 -> 6 has multiplicative persistence 2. 28 is therefore in the sequence.
PROG
(PARI) for(n=0, 106, 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, ", ")));
(Python)
from math import prod
def A031286(n):
ap = 0
while n > 9: n, ap = sum(map(int, str(n))), ap+1
return ap
def A031346(n):
mp = 0
while n > 9: n, mp = prod(map(int, str(n))), mp+1
return mp
print([k for k in range(107) if ok(k)]) # Michael S. Branicky, Sep 17 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Arkadiusz Wesolowski, Mar 19 2014
STATUS
approved