OFFSET
0,11
COMMENTS
Number of times n appears in A230099.
LINKS
MAPLE
with(LinearAlgebra):
read transforms; # to get digprod
M:=1000;
lis1:=Array(0..M);
lis2:=Array(0..M);
ctmax:=4;
for i from 0 to ctmax do ct[i]:=Array(0..M); od:
for n from 0 to M do
m:=n+digprod(n);
lis1[n]:=m;
if (m <= M) then lis2[m]:=lis2[m]+1; fi;
od:
t1:=[seq(lis1[i], i=0..M)]; # A230099
t2:=[seq(lis2[i], i=0..M)]; # A230103
COMPl(t1); # A230104
for i from 1 to M do h:=lis2[i];
if h <= ctmax then ct[h]:=[op(ct[h]), i]; fi; od:
len:=nops(ct[0]); [seq(ct[0][i], i=1..len)]; # A230104 again
len:=nops(ct[1]); [seq(ct[1][i], i=1..len)]; # A230105
PROG
(PARI) a(n) = if (n==0, return(1)); sum(k=1, n, k+vecprod(digits(k)) == n); \\ Michel Marcus, Sep 18 2020
(Python)
from math import prod
def b(n): return n + prod(map(int, str(n)))
def a(n): return sum(1 for m in range(n+1) if b(m) == n)
print([a(n) for n in range(103)]) # Michael S. Branicky, Jan 09 2023
(Python) # faster version for initial segment of sequence
from math import prod
from collections import Counter
def b(n): return n + prod(map(int, str(n)))
def aupto(n):
c = Counter(b(m) for m in range(n+1))
return [c[k] for k in range(n+1)]
print(aupto(102)) # Michael S. Branicky, Jan 09 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Oct 13 2013
STATUS
approved