login
Lexicographic first sequence of positive integers such that a(n)*a(n+1) has a digit 7, and no term occurs twice.
10

%I #4 Feb 23 2018 09:49:43

%S 1,7,10,17,11,16,36,2,35,5,14,27,21,13,6,12,23,9,3,19,4,18,15,25,28,

%T 24,30,26,22,8,34,50,54,31,37,20,38,44,29,33,39,43,32,46,45,55,65,42,

%U 41,47,51,53,49,56,62,48,57,61,52,63,59,64,58,72,66,83,69,40,68,70,71,67,81,75,73,79,60,95,74,78,86,82,85,84,80,88,77,91,87

%N Lexicographic first sequence of positive integers such that a(n)*a(n+1) has a digit 7, and no term occurs twice.

%C A permutation of the positive integers.

%e a(1) = 1 is the least positive integer, and a(1) has no other constraint to satisfy.

%e a(2) = 7 is the least positive integer > a(1) = 1 such that a(2)*a(1) = 7 has a digit 7.

%e a(3) = 10 is the least positive integer not in {1, 7} such that a(3)*a(2) (= 70) has a digit 7: All smaller choices (2, ..., 6) do not satisfy this.

%e a(4) = 17 is the least positive integer not in {1, 7, 10} such that a(4)*a(3) (= 170) has a digit 7: All smaller choices 2,...,16 do not satisfy this.

%o (PARI) A299997(n,f=1,d=7,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}

%Y Cf. A299402, A299403, A298974, ..., A298979, A299996: analog with digit 2, 3, 4, ..., 9, 6.

%Y Cf. A299957, A299969, ..., A299988 (analog with addition instead of multiplication, and different digits).

%K nonn,base

%O 1,2

%A _M. F. Hasler_, Feb 22 2018