|
|
A299402
|
|
Lexicographic first sequence of positive integers such that a(n)*a(n+1) has a digit 2, and no term occurs twice.
|
|
15
|
|
|
1, 2, 6, 4, 3, 7, 16, 8, 9, 14, 13, 17, 12, 10, 20, 11, 19, 15, 18, 24, 5, 25, 21, 22, 26, 27, 23, 34, 28, 29, 32, 31, 33, 37, 35, 36, 42, 30, 40, 38, 39, 48, 43, 44, 46, 45, 47, 41, 49, 50, 51, 52, 53, 54, 55, 59, 58, 56, 57, 60, 62, 61, 66, 64, 63, 67, 69, 68, 65, 80, 74, 71, 72, 73, 77, 76, 70, 75, 79, 78, 84, 83, 81, 82, 86, 87, 95, 96, 92
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
A permutation of the positive integers.
|
|
LINKS
|
|
|
EXAMPLE
|
a(1) = 1 is the least positive integer, it has no other requirement to satisfy.
a(2) = 2 is the least positive integer > a(1) = 1, and a(2)*a(1) = 2 has a digit 2.
a(3) = 6 is the least positive integer > a(2) = 2 such that a(3)*a(2) (= 12) has a digit 2: The smaller choices 3, 4 or 5 do not satisfy this.
a(4) = 4 is the least positive integer > a(2) = 2 such that a(4)*a(3) (= 24) has a digit 2: The smaller choice 3 yields 3*6 = 18 and does not satisfy this.
Now, the least available positive integer a(5) = 3 is such that 3*4 = 12, which has again a digit 2. And so on.
|
|
MAPLE
|
N:= 100: # to get a(1)..a(n) where a(n+1) > N
S:= [$2..N]: nS:= N-1:
R:= 1: x:= 1; found:= true;
while found do
found:= false;
for i from 1 to nS do
if member(2, convert(S[i]*x, base, 10)) then
found:= true;
x:= S[i];
R:= R, x;
S:= subsop(i=NULL, S);
nS:= nS-1;
break
fi
od
od:
|
|
PROG
|
(PARI) a(n, f=1, d=2, a=1, u=[a])={for(n=2, n, f&&if(f==1, print1(a", "), write(f, n-1, " "a)); for(k=u[1]+1, oo, setsearch(u, k)&&next; setsearch(Set(digits(a*k)), d)&&(a=k)&&break); u=setunion(u, [a]); while(#u>1&&u[2]==u[1]+1, u=u[^1])); a}
|
|
CROSSREFS
|
Cf. A299957, A299969, ..., A299988 (analog with addition instead of multiplication, and different digits).
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|