OFFSET
0,3
COMMENTS
Any nonnegative number can be written as a sum of distinct primes + e, where e is 0 or 1 (see A007924, which uses a greedy algorithm for writing n). However in this sequence a(n) is generated by using a minimizing algorithm that gives the smallest binary vector for select members from the sequence Q = (1 union primes) that when summed gives n. Without the minimizing condition there is ambiguity -- for example, 8 = 7+1 = 5+3 = 5+2+1 has three representations.
LINKS
Wikipedia, "Complete" sequence. [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]
FORMULA
Let Q be the ordered sequence of (1 union primes), then a(n) x Q = n, where x is the inner product and the binary vector a(n) is in ascending powers of 2 with infinite trailing zeros.
EXAMPLE
8 = 7+1 = 5+3 = 5+2+1, so a(8) = 1011.
MATHEMATICA
aprime[n_] := If[n==0, 1, Prime[n]]; 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]
CROSSREFS
KEYWORD
nonn
AUTHOR
Frank M Jackson, Feb 08 2012
STATUS
approved