login
A387396
a(n) is the smallest positive number with a total of exactly n 2's in the decimal digits of its divisors.
4
1, 2, 12, 22, 72, 84, 168, 264, 252, 756, 504, 672, 1260, 1512, 2184, 2640, 2772, 2016, 2520, 4032, 5544, 5040, 6048, 6720, 7392, 13104, 12096, 16632, 10080, 15120, 18144, 21840, 33600, 25200, 34320, 22176, 20160, 34272, 30240, 42840, 45360, 36960, 50400, 52416, 55440, 94248, 65520, 66528, 60480
OFFSET
0,2
COMMENTS
a(n) is the least number k such that A387394(k) = n.
LINKS
FORMULA
A387394(a(n)) = n.
EXAMPLE
a(3) = 22 because of the divisors of 22, 2 has one 2, 22 has two, for a total of 3, and 22 is the smallest number that works.
MAPLE
ff:= proc(n) option remember; numboccur(2, 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[{k=1}, While[Count[IntegerDigits[Divisors[k]]//Flatten, 2]!=n, k++]; k]; Array[a, 49, 0] (* Stefano Spezia, Aug 29 2025 *)
PROG
(PARI) f(n) = sumdiv(n, d, #select(x->(x==2), digits(d))); \\ A387394
a(n) = my(k=1); while(f(k) !=n, k++); k; \\ Michel Marcus, Aug 28 2025
(Python)
from sympy import divisors
from itertools import count, islice
def f(n): return sum(str(d).count("2") 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(), 50))) # Michael S. Branicky, Aug 29 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Israel, Aug 28 2025
STATUS
approved