OFFSET
0,2
COMMENTS
a(n) is the least number k such that A387463(k) = n.
LINKS
Robert Israel, Table of n, a(n) for n = 0..345
FORMULA
A387463(a(n)) = n.
EXAMPLE
a(4) = 132 because of the divisors of 132, 3 and 132 each have one 3 and 33 has two, for a total of 4, and no smaller number works.
MAPLE
ff:= proc(n) option remember; numboccur(3, convert(n, base, 10)) end proc:
f:= proc(n) local d; add(ff(d), d=numtheory:-divisors(n)) end proc:
V:= Array(0..50): count:= 0:
for x from 1 while count < 51 do
v:= f(x); if v <= 50 and V[v] = 0 then V[v]:= x; count:= count+1; fi
od:
convert(V, list);
MATHEMATICA
a[n_]:=Module[{i=0}, Until[Count[IntegerDigits/@Divisors[i]//Flatten, 3]==n, i++]; i]; Array[a, 45, 0] (* James C. McMahon, Sep 05 2025 *)
PROG
(Python)
from sympy import divisors
from itertools import count, islice
def f(n): return sum(str(d).count("3") for d in divisors(n, generator=True))
def agen(): # generator of terms
n, adict = 0, dict()
for k in count(1):
v = f(k)
if v not in adict:
adict[v] = k
while n in adict: yield adict[n]; n += 1
print(list(islice(agen(), 45))) # Michael S. Branicky, Aug 29 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Israel, Aug 29 2025
STATUS
approved
