login
a(n) is the least positive integer not yet in the sequence in which the largest digit of a(n-2) appears among its digits, and a(n) cannot share digits with a(n-1); a(1) = 1, a(2) = 2.
2

%I #53 Apr 02 2024 14:33:58

%S 1,2,10,22,11,20,13,24,3,4,23,14,30,41,32,40,31,42,33,44,35,46,5,6,15,

%T 26,45,16,25,36,50,61,52,60,51,62,53,64,55,63,54,66,57,68,7,8,17,28,

%U 37,18,27,38,47,58,67,48,70,81,72,80,71,82,73,84,75,83,74,85,76,88,77,86,79,108,9,78,19,87

%N a(n) is the least positive integer not yet in the sequence in which the largest digit of a(n-2) appears among its digits, and a(n) cannot share digits with a(n-1); a(1) = 1, a(2) = 2.

%C The only pairs of consecutive numbers are 1, 2; 3, 4; 5, 6; 7, 8.

%C The 2-digit numbers that are not in the sequence are 12, 21, 34, 43, 56, 65, 89, 98 (78 and 87 do appear at n = 76 and n = 78, respectively).

%C The last 2-digit number to appear is 91 at n = 113.

%C Starting from a(73) = 79, the first term of alternating terms must contain 9, and the second term must contain 8.

%C If the initial terms of this sequence are swapped (by defining a(1)=2 and a(2)=1) then the resulting sequence is identical to this for n>12. - _R. J. Cano_, Apr 13 2018

%H Rémy Sigrist, <a href="/A302566/a302566.gp.txt">PARI program for A302566</a>

%H R. J. Cano, <a href="/A302566/a302566_3.txt">Sequencer program in PARI</a>

%e a(4) = 22 since it contains the largest digit from a(2) = 2, and can't be 12 since the digit 1 appears in a(3) = 10.

%t Nest[Append[#, Block[{k = 2, d}, While[Nand[FreeQ[#[[All, 1]], k], MemberQ[Set[d, IntegerDigits[k]], Max[#[[-2, -1]] ] ], ! IntersectingQ[d, #[[-1, -1]]] ], k++]; {k, d}]] &, Transpose@ {#, IntegerDigits@ #} &@ Range[2], 73][[All, 1]] (* _Michael De Vlieger_, Apr 12 2018 *)

%o (PARI) \\ See Links section.

%Y Cf. A011531-A011540, A300907.

%K nonn,base

%O 1,2

%A _Enrique Navarrete_, Apr 09 2018