login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A204009 a(n) is a binary vector for selecting distinct terms from A000124 that when summed give n; it uses the greedy algorithm. 2

%I #13 Jun 11 2023 23:30:09

%S 0,1,10,11,100,101,110,1000,1001,1010,1011,10000,10001,10010,10011,

%T 10100,100000,100001,100010,100011,100100,100101,1000000,1000001,

%U 1000010,1000011,1000100,1000101,1000110,10000000,10000001,10000010,10000011,10000100

%N a(n) is a binary vector for selecting distinct terms from A000124 that when summed give n; it uses the greedy algorithm.

%C a(n) is a binary vector for selecting terms from A000124 that when summed give n. It uses the greedy algorithm to select from multiple solutions.

%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 A000124 = n, where x is the inner product and the binary vector is in ascending powers of 2 with infinite trailing zeros.

%e 14 can be written as 7+4+2+1, i.e., 1111, or as 11+2+1, i.e., 10011, and the latter is chosen because it uses the greedy algorithm for selection.

%t complete[m_Integer] := (m(m+1)/2+1); gentable[n_Integer] := (m=n; ptable={0}; While[m!=0, (i=0; While[complete[i]<=m&&ptable[[i+1]]!=1, (AppendTo[ptable, 0]; i++)]; ptable[[i]]=1; m=m-complete[i-1])]; ptable); decimal[n_Integer] := (gentable[n]; Sum[2^(k-1)*ptable[[k]], {k, 1, Length[ptable]}]); Table[IntegerString[decimal[s], 2], {s, 0, 100}]

%Y Cf. A000124, A072638.

%K nonn

%O 0,3

%A _Frank M Jackson_, Jan 09 2012

%E Edited by _N. J. A. Sloane_, May 20 2023

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 11 23:39 EDT 2024. Contains 374237 sequences. (Running on oeis4.)