OFFSET
1,2
COMMENTS
a(18) is the first term that is neither a repunit nor the product of a repunit and a power of 10.
LINKS
David Radcliffe, Table of n, a(n) for n = 1..28
EXAMPLE
MAPLE
A004290:= proc(n)
local L, x, m, r, k, j;
for x from 2 to n-1 do L[0, x]:= 0 od:
L[0, 0]:= 1: L[0, 1]:= 1;
for m from 1 do
if L[m-1, (-10^m) mod n] = 1 then break fi;
L[m, 0]:= 1;
for k from 1 to n-1 do
L[m, k]:= max(L[m-1, k], L[m-1, k-10^m mod n])
od;
od;
r:= 10^m; k:= -10^m mod n;
for j from m-1 by -1 to 1 do
if L[j-1, k] = 0 then
r:= r + 10^j; k:= k - 10^j mod n;
fi
od;
if k = 1 then r:= r + 1 fi;
r
end proc:
A004290(1):= 1:
count:= 0: m:= 0;
for n from 1 to 20000 do
v:= A004290(n);
if v > m then
count:= count+1;
A[count]:= v;
m:= v;
fi
od:
seq(A[i], i=1..count); # Robert Israel, Feb 09 2016
CROSSREFS
KEYWORD
nonn,base
AUTHOR
David Radcliffe, Feb 08 2016
EXTENSIONS
a(1)=0 prepended to terms, b-file and Maple by Georg Fischer, Jun 24 2020
Initial 0 removed for consistency with change in A004290 by Sean A. Irvine, Feb 19 2024
STATUS
approved
