cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A298208 #31 Feb 09 2018 15:49:21
%S A298208 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 A298208 31,9,12,39,21,30,19,32,41,33,40,35,42,36,44,37,45,38,46,53,47,50,34,
%U A298208 51,43,52,48,55,49,56,74,58,64,57,60,54,61,59,62,75,63,70
%N 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.
%C A298208 Initial fixed points are 47, 52, 56, 58, 72, 81, 94, 101, 13661, 13663. - Corrected and extended by _Robert Israel_, Feb 09 2018
%C A298208 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 A298208 Robert Israel, <a href="/A298208/b298208.txt">Table of n, a(n) for n = 1..10000</a>
%p A298208 N:= 1000: # to get all terms before the first term > N
%p A298208 a[1] := 0: a[2] := 1: first := 2:
%p A298208 Next := Array(2 .. N, i -> i+1):
%p A298208 Prev := Array(2 .. N, i -> i-1): Prev[2] := 0:
%p A298208 for n from 0 to N do
%p A298208   digs[n] := convert(convert(n, base, 10), set)
%p A298208 od:
%p A298208 for n from 3 do
%p A298208   D1 := digs[a[n-1]];
%p A298208   D2 := digs[a[n-2]];
%p A298208   t := first;
%p A298208   while digs[t] intersect D2 = {} or digs[t] intersect D1 <> {} do
%p A298208     t := Next[t];
%p A298208     if t > N then break fi
%p A298208   od;
%p A298208   if t > N then break fi;
%p A298208   a[n] := t;
%p A298208   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 A298208 od:
%p A298208 seq(a[i],i=1..n-1); # _Robert Israel_, Feb 09 2018
%t A298208 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 A298208 Cf. A107353 (where each term must share a digit with the preceding term).
%Y A298208 Cf. A297418.
%K A298208 nonn,base,look
%O A298208 1,3
%A A298208 _Enrique Navarrete_, Jan 15 2018