%I #16 May 13 2022 14:04:37
%S 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,31,23,33,25,35,27,
%T 37,29,39,30,51,32,53,34,55,36,57,38,59,41,71,43,73,45,75,47,77,49,79,
%U 50,91,52,93,54,95,56,97,58,99,61,111,63,113,65,115,67,117,69,119,70,131,72,133,74,135,76,137,78,139,81,151,83,153,85,155,87,157,89,159
%N The pair [a(n),a(n+1)] uses only one even digit.
%C The sequence starts with a(1) = 1 and was always extended with the smallest integer not yet used that doesn't lead to a contradiction.
%H Michael S. Branicky, <a href="/A275776/b275776.txt">Table of n, a(n) for n = 1..10000</a>
%e The pair [1,2] uses only one even digit (2).
%e The pair [2,3] uses only one even digit (2).
%e The pair [3,4] uses only one even digit (4).
%e The pair [4,5] uses only one even digit (4).
%e The pair [5,6] uses only one even digit (6).
%e The pair [6,7] uses only one even digit (6).
%e The pair [7,8] uses only one even digit (8).
%e The pair [8,9] uses only one even digit (8).
%e The pair [9,10] uses only one even digit (0).
%e The pair [10,11] uses only one even digit (0).
%e The pair [11,12] uses only one even digit (2).
%e etc.
%t a[1]=1;a[n_]:=a[n]=Block[{k=1},While[MemberQ[Array[a,n-1],k]||Length@Select[Flatten[IntegerDigits/@{a[n-1],k}],EvenQ]!=1,k++];k];Array[a,89] (* _Giorgos Kalogeropoulos_, May 12 2022 *)
%o (Python)
%o from itertools import islice
%o def one_even(s): return sum(1 for d in s if d in "02468") == 1
%o def agen(): # generator of terms
%o an, aset, mink = 1, {1}, 2
%o while True:
%o yield an
%o k, stran = mink, str(an)
%o while k in aset or not one_even(stran + str(k)): k += 1
%o an = k
%o aset.add(an)
%o while mink in aset: mink += 1
%o print(list(islice(agen(), 89))) # _Michael S. Branicky_, May 12 2022
%K nonn,base
%O 1,2
%A _Eric Angelini_, Aug 08 2016
|