login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A298208 a(n) is the smallest positive integer not yet in the sequence that shares a digit with a(n-2) and shares no digit with a(n-1); a(1) = 0, a(2) = 1. 1

%I #31 Feb 09 2018 15:49:21

%S 0,1,20,11,2,10,22,13,24,3,4,23,14,25,16,5,6,15,26,17,28,7,8,27,18,29,

%T 31,9,12,39,21,30,19,32,41,33,40,35,42,36,44,37,45,38,46,53,47,50,34,

%U 51,43,52,48,55,49,56,74,58,64,57,60,54,61,59,62,75,63,70

%N a(n) is the smallest positive integer not yet in the sequence that shares a digit with a(n-2) and shares no digit with a(n-1); a(1) = 0, a(2) = 1.

%C Initial fixed points are 47, 52, 56, 58, 72, 81, 94, 101, 13661, 13663. - Corrected and extended by _Robert Israel_, Feb 09 2018

%C Inverse: 0, 1, 4, 9, 10, 15, 16, 21, 22, 27, 5, 3, 28, 7, 12, 17, 14, 19, 24, 32, 2, 30, 6, 11, 8, 13, 18, 23, 20, 25, 31, ..., . - _Robert G. Wilson v_, Feb 09 2018

%H Robert Israel, <a href="/A298208/b298208.txt">Table of n, a(n) for n = 1..10000</a>

%p N:= 1000: # to get all terms before the first term > N

%p a[1] := 0: a[2] := 1: first := 2:

%p Next := Array(2 .. N, i -> i+1):

%p Prev := Array(2 .. N, i -> i-1): Prev[2] := 0:

%p for n from 0 to N do

%p digs[n] := convert(convert(n, base, 10), set)

%p od:

%p for n from 3 do

%p D1 := digs[a[n-1]];

%p D2 := digs[a[n-2]];

%p t := first;

%p while digs[t] intersect D2 = {} or digs[t] intersect D1 <> {} do

%p t := Next[t];

%p if t > N then break fi

%p od;

%p if t > N then break fi;

%p a[n] := t;

%p if Prev[t] = 0 then first := Next[t] else Next[Prev[t]] := Next[t] fi; if Next[t] <= N then Prev[Next[t]] := Prev[t] fi

%p od:

%p seq(a[i],i=1..n-1); # _Robert Israel_, Feb 09 2018

%t f[s_List] := Block[{a = Union@ IntegerDigits@ s[[-2]], b = Union@ IntegerDigits@ s[[-1]], k = 2}, While[id = Union@ IntegerDigits@ k; MemberQ[s, k] || Intersection[a, id] == {} || Intersection[b, id] != {}, k++]; Append[s, k]]; Nest[f, {0, 1}, 66] (* _Robert G. Wilson v_, Feb 09 2018 *)

%Y Cf. A107353 (where each term must share a digit with the preceding term).

%Y Cf. A297418.

%K nonn,base,look

%O 1,3

%A _Enrique Navarrete_, Jan 15 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 20 02:01 EDT 2024. Contains 371798 sequences. (Running on oeis4.)