%I #12 May 12 2022 15:17:49
%S 1,12,23,134,145,65,567,278,289,910,110,10112,1213,1413,15014,16154,
%T 16817,17018,18719,19201,2120,2218,10223,2324,24251,2526,27026,52827,
%U 28291,29303,30310,3231,32733,6334,34351,35036,36373,37388,39385,139240,4041,41428,34342,15443,4445,45461,46847,34847,48149
%N Lexicographically earliest sequence of distinct positive integers such that a(n), a(n+1) and the product a(n)*a(n+1) have in common the substring n.
%e a(1) = 1, a(2) = 12 and the product a(1)*a(2) = 12 have n = 1 in common;
%e a(2) = 12, a(3) = 23 and the product a(2)*a(3) = 276 have n = 2 in common;
%e a(3) = 23, a(4) = 134 and the product a(3)*a(4) = 3082 have n = 3 in common;
%e a(4) = 134, a(5) = 145 and the product a(4)*a(5) = 19430 have n = 4 in common;
%e ...
%e a(120) = 11912061, a(121) = 1012120 and their product 12056435179320 share the substring 120; etc.
%t a[1]=1;a[n_]:=a[n]=Block[{k=1},While[MemberQ[Array[a,n-1],k]||!(Q=StringContainsQ)[(T=ToString)@k,T@n]||!And@@(Q[T@#,T[n-1]]&/@{a[n-1],k,a[n-1]*k}),k++];k];Array[a,26] (* _Giorgos Kalogeropoulos_, May 12 2022 *)
%Y A333722 (presents the same idea, but without the constraint of the substring being n).
%K base,nonn
%O 1,2
%A _Jean-Marc Falcoz_ and _Eric Angelini_, Apr 10 2020
|