login
Lexicographically earliest sequence of distinct terms > 0 such that any digit d jumping to the right over d digits lands on a prime digit.
7

%I #13 Oct 29 2023 22:03:49

%S 1,2,3,4,5,6,7,8,20,22,23,25,27,9,21,32,10,24,12,26,33,11,35,28,37,13,

%T 29,15,52,14,53,55,57,30,72,31,73,34,75,36,38,77,39,50,51,222,223,220,

%U 221,224,225,226,227,228,229,230,54,56,16,58,59,70,71,232,233,74,231,235,76,78,17,79,202,237,203

%N Lexicographically earliest sequence of distinct terms > 0 such that any digit d jumping to the right over d digits lands on a prime digit.

%C The prime digits are 2, 3, 5 and 7. This is not a permutation of the natural numbers as 100 and 101 cannot be part of the sequence, for instance.

%e a(5) = 5 jumps over 5 digits and lands on the first 2 of 22, a prime digit;

%e a(6) = 6 jumps over 6 digits and lands on the 2 of 23, a prime digit;

%e a(7) = 7 jumps over 7 digits and lands on the 2 of 25, a prime digit;

%e a(8) = 8 jumps over 8 digits and lands on the 2 of 27, a prime digit;

%e a(9) = 20: the 2 of 20 jumps over 2 digits and lands on the last 2 of 22, a prime digit;

%e a(9) = 20: the 0 of 20 jumps over 0 digit and lands on the first 2 of 22, a prime digit; etc.

%t a[1]=1;a[n_]:=a[n]=(k=1;While[MemberQ[ar=Array[a,n-1],k]||(vp=Flatten[IntegerDigits/@Join[ar,{k}]];

%t And@@(PrimeQ@Union@Table[If[IntegerQ[s=vp[[k+1+vp[[k]]]]],s,2],{k,Length@vp}])

%t )==False,k++];k);Array[a,75]

%Y Cf. A366943, A366944, A366945, A366946, A366947, A366948, A366949.

%K base,nonn

%O 1,2

%A _Eric Angelini_ and _Giorgos Kalogeropoulos_, Oct 25 2023