login
A366838
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
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, 29, 15, 52, 14, 53, 55, 57, 30, 72, 31, 73, 34, 75, 36, 38, 77, 39, 50, 51, 222, 223, 220, 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
OFFSET
1,2
COMMENTS
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.
EXAMPLE
a(5) = 5 jumps over 5 digits and lands on the first 2 of 22, a prime digit;
a(6) = 6 jumps over 6 digits and lands on the 2 of 23, a prime digit;
a(7) = 7 jumps over 7 digits and lands on the 2 of 25, a prime digit;
a(8) = 8 jumps over 8 digits and lands on the 2 of 27, a prime digit;
a(9) = 20: the 2 of 20 jumps over 2 digits and lands on the last 2 of 22, a prime digit;
a(9) = 20: the 0 of 20 jumps over 0 digit and lands on the first 2 of 22, a prime digit; etc.
MATHEMATICA
a[1]=1; a[n_]:=a[n]=(k=1; While[MemberQ[ar=Array[a, n-1], k]||(vp=Flatten[IntegerDigits/@Join[ar, {k}]];
And@@(PrimeQ@Union@Table[If[IntegerQ[s=vp[[k+1+vp[[k]]]]], s, 2], {k, Length@vp}])
)==False, k++]; k); Array[a, 75]
KEYWORD
base,nonn
AUTHOR
STATUS
approved