login
Lexicographically earliest sequence of distinct positive terms such that for any n > 0, the n-th term and the n-th digit have the same parity.
1

%I #11 Sep 08 2023 07:33:40

%S 1,2,3,4,5,6,7,8,9,11,13,15,17,19,21,23,25,27,29,10,31,12,33,14,35,16,

%T 37,18,39,41,20,43,45,47,22,49,51,53,24,55,57,59,26,61,63,65,28,67,69,

%U 30,71,32,34,36,73,38,75,40,77,42,44,46,79,81,83,85,87

%N Lexicographically earliest sequence of distinct positive terms such that for any n > 0, the n-th term and the n-th digit have the same parity.

%C This sequence is a variant of A324282; here we have equal parity, there different parity.

%C This sequence is a permutation of the natural numbers.

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

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%e The first terms, alongside the corresponding digits, are:

%e n a(n) n-th digit

%e -- ---- ----------

%e 1 1 1

%e 2 2 2

%e 3 3 3

%e 4 4 4

%e 5 5 5

%e 6 6 6

%e 7 7 7

%e 8 8 8

%e 9 9 9

%e 10 11 1

%e 11 13 1

%e 12 15 1

%e 13 17 3

%e 14 19 1

%e 15 21 5

%t a[1]=1;a[n_]:=a[n]=(k=1;While[MemberQ[s=Array[a,n-1],k]||OddQ@k!= OddQ[Flatten[IntegerDigits/@Join[s,{k}]][[n]]],k++];k);Array[a,100] (* _Giorgos Kalogeropoulos_, Sep 07 2023 *)

%o (PARI) See Links section.

%Y Cf. A324282.

%K nonn,base

%O 1,2

%A _Rémy Sigrist_, Jan 06 2020