OFFSET
0,1
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
EXAMPLE
a(11) = -1 because no number ending in 11 is 7-smooth. See explanation at A376303.
a(22) = 13122 because 13122 = 2 * 3^8 is 7-smooth and ends in 22, and no smaller number works.
MAPLE
dmax:= 2: # for a(0) .. a(10^dmax - 1)
N:= 10^dmax-1: V:= Array(0..N, -1):
with(priqueue):
V[0]:= 10:
for d from 1 to dmax do
A:= Array(0..10^d-1, -1);
initialize(pq);
insert([-1, 0, 0, 0, 0], pq);
while pq[0] <> 0 do
t:= extract(pq);
x:= -t[1];
xd:= x mod 10^d;
if A[xd] = -1 then
A[xd]:= x;
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 fi od;
V[10^(d-1) .. 10^d-1]:= A[10^(d-1) .. 10^d-1];
od:
convert(V, list);
CROSSREFS
KEYWORD
sign,base
AUTHOR
Robert Israel, Sep 19 2024
STATUS
approved