A239427 Numbers such that additive and multiplicative persistences coincide.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 28, 29, 30, 31, 32, 33, 37, 38, 40, 41, 42, 46, 48, 50, 51, 56, 58, 60, 61, 64, 65, 67, 70, 71, 73, 76, 80, 81, 82, 83, 84, 85, 90, 92, 99, 100, 101, 102, 103, 104, 105, 106
Offset: 1
Examples
28 -> 10 -> 1 has additive persistence 2. 28 -> 16 -> 6 has multiplicative persistence 2. 28 is therefore in the sequence.
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
Programs
-
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 def ok(n): return A031286(n) == A031346(n) print([k for k in range(107) if ok(k)]) # Michael S. Branicky, Sep 17 2022
Comments