|
|
A063737
|
|
Numbers n such that sum of digits of n is equal to the sum of the prime factors of n, counted with multiplicity.
|
|
9
|
|
|
2, 3, 4, 5, 7, 27, 378, 576, 588, 648, 729, 2688, 17496, 19683, 49896, 69888, 3796875, 3857868, 4898880, 5878656, 7077888, 8957952, 2499898464, 34998578496, 49997969280, 2928898896840, 7625597484987, 184958866998359685
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
|
|
LINKS
|
|
|
EXAMPLE
|
27=3*3*3, 2+7=9, 3+3+3=9. 49896 = 2*2*2*3*3*3*3*7*11, 4+9+8+9+6 = 36, 2+2+2+3+3+3+3+7+11 = 36.
|
|
MATHEMATICA
|
g@n_ := Cases[Union@(Times @@ # & /@Select[Flatten[Table[IntegerPartitions[k, All, Prime@Range@PrimePi@(9*n)], {k, 1, 9*n}], 1], Plus@@#==DigitSum@(Times @@ #) &]),
_?(#<10^n&)];
|
|
PROG
|
(ARIBAS): var stk: stack; end; for n := 1 to 2000000 do s := itoa(n); for j := 0 to length(s) - 1 do stack_push(stk, atoi(s[j..j])); end; if sum(stack2array(stk)) = sum(factorlist(n)) then write(n, " "); end; end; .
(PARI) isok(m) = my(f=factor(m)); sumdigits(m) == f[, 1]~*f[, 2]; \\ Michel Marcus, Dec 18 2020
(Python) MAXDIGITS=20
maxsum, maxval = 9*MAXDIGITS, 10**MAXDIGITS-1
from sympy import primerange
primes=list(primerange(0, maxsum))
nprimes, results = len(primes), []
def lensumdigits(x):
s, t = str(x), 0
for c in s: t+= ord(c)-48
return len(s), t
def solve(startidx, sump, val):
for idx in range(startidx, nprimes):
p=primes[idx]
s2, v2 = sump+p, val*p
ld, sd = lensumdigits(v2)
if sd==s2: results.append(v2)
if (s2 > maxsum) or (v2 > maxval) or ((p>10) and (s2 > 9*ld)):
return
solve(idx, s2, v2)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|