OFFSET
1,2
COMMENTS
Sequence is finite with 48 terms.
Also numbers n such that pd(n) = sd(n) and simultaneously both the additive and multiplicative persistences of n are 0 or 1.
Numbers k such that A007953(k) = A010888(k) = A007954(k) = A031347(k). - Mohammed Yaseen, Nov 12 2022
LINKS
Eric Weisstein's World of Mathematics, Additive Persistence.
Eric Weisstein's World of Mathematics, Multiplicative Persistence.
EXAMPLE
321 -> sd(321) = 3+2+1 = 6; pd(321) = 3*2*1 = 6; pd(sd(321)) = pd(6) = 6; sd(pd(321)) = sd(6) = 6.
MATHEMATICA
sod[n_] := Plus@@ IntegerDigits@ n; pod[n_] := Times@@ IntegerDigits@ n; Select[ Range[10^5], pod@ # == sod@ # && pod@ sod@ # == sod@ pod@ # &] (* Giovanni Resta, May 30 2018 *)
PROG
MAGMA [n: n in [1..1000000] | &+Intseq(n) eq &*Intseq(n) and &*Intseq(&+Intseq(n)) eq &+Intseq(&*Intseq(n))]
(PARI) pd(n) = my(d=digits(n)); factorback(d);
alias(sd, sumdigits);
isok(n) = my(p=pd(n), s=sd(n)); (p==s) && (sd(p) == pd(s)); \\ Michel Marcus, May 30 2018
(Python)
from math import prod
def pd(x): return prod(map(int, str(x)))
def sd(x): return sum(map(int, str(x)))
def ok(n): return pd(n) == sd(n) and sd(pd(n)) == pd(sd(n))
print([k for k in range(1, 10**5) if ok(k)]) # Michael S. Branicky, Nov 12 2022
CROSSREFS
KEYWORD
nonn,base,fini,full
AUTHOR
Jaroslav Krizek, May 28 2018
STATUS
approved