A335040 Numbers whose binary representation encodes a (binary) max-heap on elements from the set {0,1} with root at the most significant bit.
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 13, 14, 15, 16, 20, 24, 25, 26, 27, 28, 29, 30, 31, 32, 40, 41, 48, 50, 52, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 80, 81, 82, 83, 96, 100, 104, 108, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126
Offset: 1
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..10000
- Eric Weisstein's World of Mathematics, Heap
- Wikipedia, Binary heap
- Wikipedia, Most significant bit
Programs
-
Maple
q:= proc(n) local i, l; l:= convert(n, base, 2); for i from 2 to nops(l) do if l[-i]>l[-iquo(i, 2)] then return false fi od; true end: a:= proc(n) option remember; local k: for k from 1+ `if`(n=1, -1, a(n-1)) while not q(k) do od; k end: seq(a(n), n=1..70);