login
A376301
a(n) is the smallest 7-smooth number ending with n, or -1 if there is none.
2
10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, 12, -1, 14, 15, 16, -1, 18, -1, 20, 21, 13122, 1323, 24, 25, 126, 27, 28, 729, 30, -1, 32, -1, 1134, 35, 36, -1, 7938, -1, 40, 441, 42, 243, 144, 45, 2646, 147, 48, 49, 50, -1, 252, -1, 54, -1, 56, -1, 1458, -1, 60, 6561, 162, 63, 64, -1, 39366, 567, 168
OFFSET
0,1
LINKS
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