

A322523


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.


1



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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,8


COMMENTS

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.
The variant where we drop the condition "i < j" corresponds to A007814.  Rémy Sigrist, Sep 06 2019


LINKS

Aidan Clarke, Table of n, a(n) for n = 1..995


FORMULA

a(n) = 0 iff n belongs to A033627.  Rémy Sigrist, Sep 06 2019


EXAMPLE

a(1) = 0.
a(2) = 0.
a(3) = 1 (because a(1) and a(2) both equal 0).
a(5) = 1 (because a(1) and a(4) both equal 0).
a(8) = 2 (because a(1) and a(7) equal 0, and a(3) and a(5) equal 1).


MAPLE

for n from 1 to 100 do
forbid:= {seq(A[i], i= select(i > A[i]=A[ni], [$1..(n1)/2]))};
if forbid = {} then A[n]:= 0 else A[n]:= min({$0..max(forbid)+1} minus forbid) fi;
od:
seq(A[i], i=1..100); # Robert Israel, Sep 06 2019


PROG

(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); }
lista(nn) = {my(v = vector(nn)); for (n=1, nn, v[n] = least(v, n); ); v; } \\ Michel Marcus, Sep 07 2019


CROSSREFS

Cf. A007814, A033627.
Sequence in context: A193863 A273496 A286576 * A333210 A285193 A213209
Adjacent sequences: A322520 A322521 A322522 * A322524 A322525 A322526


KEYWORD

nonn


AUTHOR

Aidan Clarke, Aug 28 2019


STATUS

approved



