OFFSET
1,2
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
EXAMPLE
a(23) = 2304 = 2^8*3^2 is the smallest 7-smooth number beginning with 23. (23, 230, 231, 232, ..., 239, 2301, 2302, 2303 etc. have a divisor > 10.)
MAPLE
N:= 300: # for a(1) .. a(N)
V:= Vector(N): count:= 0:with(priqueue):
initialize(pq);
insert([-1, 0, 0, 0, 0], pq);
while count < N do
t:= extract(pq);
x:= -t[1];
for d from ilog10(x) to 0 by -1 do
xd:= floor(x/10^d);
if xd > N then break fi;
if V[xd] = 0 then V[xd]:= x; count:= count+1; fi;
od;
insert([-7*x, t[2], t[3], t[4], t[5]+1], pq);
if t[5]=0 then
insert([-5*x, t[2], t[3], t[4]+1, 0], pq);
if t[4] = 0 then
insert([-3*x, t[2], t[3]+1, 0, 0], pq);
if t[3] = 0 then
insert([-2*x, t[2]+1, 0, 0, 0], pq);
fi fi fi;
od:
convert(V, list); # Robert Israel, Sep 18 2024
MATHEMATICA
a[n_] := Module[{d = IntegerDigits[n], k = 1}, While[Max[FactorInteger[k][[;; , 1]]] > 7 || Length[IntegerDigits[k]] < Length[d] || IntegerDigits[k][[1 ;; Length[d]]] != d, k++]; k]; Array[a, 60] (* Amiram Eldar, Apr 30 2022 *)
PROG
(PARI) hc(n) = local(f); f = factor(n); f[matsize(f)[1], 1] < 10;
a(n) = local(d, x); if (hc(n), return(n)); d = 1; while (d, for (i = 1, 10^d - 1, x = n*10^d + i; if (hc(x), return(x))); d++); \\ David Wasserman, Feb 11 2005
(Python)
from itertools import count
from sympy import integer_log
def A085908(n):
if n<2: return n
def f(x):
c = 0
for i in range(integer_log(x, 7)[0]+1):
for j in range(integer_log(m:=x//7**i, 5)[0]+1):
for k in range(integer_log(r:=m//5**j, 3)[0]+1):
c += (r//3**k).bit_length()
return c
for l in count(0):
kmin, kmax = n*10**l-1, (n+1)*10**l-1
mmin, mmax = f(kmin), f(kmax)
if mmax>mmin:
while kmax-kmin > 1:
kmid = kmax+kmin>>1
mmid = f(kmid)
if mmid > mmin:
kmax, mmax = kmid, mmid
else:
kmin, mmin = kmid, mmid
return kmax # Chai Wah Wu, Sep 17 2024
CROSSREFS
KEYWORD
AUTHOR
Amarnath Murthy, Jul 09 2003
EXTENSIONS
Corrected and extended by David Wasserman, Feb 11 2005
Name corrected by J. Lowell, Apr 30 2022
STATUS
approved