%I
%S 0,0,1,0,1,1,0,2,2,0,2,1,0,1,2,0,3,2,0,3,1,0,1,3,0,3,3,0,3,1,0,1,3,0,
%T 2,2,0,2,1,0,1,2,0,4,3,0,4,1,0,1,4,0,4,3,0,4,1,0,1,4,0,2,2,0,2,1,0,1,
%U 2,0,4,4,0,4,1,0,1,4,0,4,4,0,4,1,0,1,4,0,2,2,0,2,1,0,1,2,0,3,4,0
%N a(n) is the least nonnegative integer k for which there does not exist i < j with i+j=n and a(i)=a(j)=k.
%C If x is an integer that we are checking whether it is an option for a(n), at position n = 3(3^(x+1)1)/2 there appears to begin a repeating sequence (containing 3^(x+1) terms) of whether it can or cannot be used for a(n) that continues infinitely.
%C The variant where we drop the condition "i < j" corresponds to A007814.  _Rémy Sigrist_, Sep 06 2019
%H Aidan Clarke, <a href="/A322523/b322523.txt">Table of n, a(n) for n = 1..995</a>
%F a(n) = 0 iff n belongs to A033627.  _Rémy Sigrist_, Sep 06 2019
%e a(1) = 0.
%e a(2) = 0.
%e a(3) = 1 (because a(1) and a(2) both equal 0).
%e a(5) = 1 (because a(1) and a(4) both equal 0).
%e a(8) = 2 (because a(1) and a(7) equal 0, and a(3) and a(5) equal 1).
%p for n from 1 to 100 do
%p forbid:= {seq(A[i],i= select(i > A[i]=A[ni],[$1..(n1)/2]))};
%p if forbid = {} then A[n]:= 0 else A[n]:= min({$0..max(forbid)+1} minus forbid) fi;
%p od:
%p seq(A[i],i=1..100); # _Robert Israel_, Sep 06 2019
%o (PARI) least(v, n) = {my(found = []); for (i=1, n, if (i >= ni, break, if (v[i] == v[ni], found = Set(concat(found, v[i]))));); if (#found == 0, return(0)); my(m = vecmax(found)); for (i=0, m, if (!vecsearch(found, i), return (i))); return (m+1);}
%o lista(nn) = {my(v = vector(nn)); for (n=1, nn, v[n] = least(v, n);); v;} \\ _Michel Marcus_, Sep 07 2019
%Y Cf. A007814, A033627.
%K nonn
%O 1,8
%A _Aidan Clarke_, Aug 28 2019
