%I #28 Jul 12 2023 11:08:14
%S 0,1,10,11,101,110,111,1010,1011,1101,1110,1111,10001,10010,10011,
%T 10101,10110,10111,11010,11011,11101,11110,11111,100111,101010,101011,
%U 101101,101110,101111,110001,110010,110011,110101,110110,110111,111010,111011
%N Write n as a sum of distinct terms from A203074; if there is more than one way, choose the smallest binary number.
%C a(n) is a binary vector for selecting terms from the complete sequence, A203074 that when summed gives n. It uses a miserly algorithm that chooses the smallest binary vector if there are multiple solutions. Somewhat similar to, although different from, A014417 and A104326.
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Complete_sequence">"Complete" sequence</a>. [Wikipedia calls a sequence "complete" (sic) if every positive integer is a sum of distinct terms. This name is extremely misleading and should be avoided. - _N. J. A. Sloane_, May 20 2023]
%F a(n) x A203074 = n, where x is the inner product and the binary vector a(n) is in ascending powers of 2 with infinite trailing zeros.
%e 5 can be written as 5, i.e., 1000, or as 3+2, i.e., 110, and we choose the smaller.
%e 18 can be written as 17+1, i.e., 100001, or as 11+5+2, i.e., 11010, and again we choose the smaller.
%t nextprime[n_Integer] := (k=n+1;While[!PrimeQ[k], k++];k);aprime[m_Integer] := (If[m==0, 1, nextprime[2^(m-1)]]);seqtable[l_] := (stable=Table[aprime[j], {j, 0, l}];stable);inttable[p_] := (itable=Reverse[IntegerDigits[p, 2]];itable);h=1;otable={0};ttable={};While[h<100, (inttable[h];seqtable[Length[itable]-1];test=itable.stable;If[!MemberQ[ttable, test], AppendTo[otable, h], Null];AppendTo[ttable, test];h++)];IntegerString[otable, 2]
%Y Cf. A203974, A203076, A014417, A104326.
%K nonn
%O 0,3
%A _Frank M Jackson_ and _N. J. A. Sloane_, Dec 28 2011