A335039 Numbers whose binary representation encodes a (binary) max-heap on elements from the set {0,1} with root at the least significant bit.
0, 1, 3, 5, 7, 11, 15, 19, 23, 27, 31, 37, 39, 47, 55, 63, 69, 71, 79, 87, 95, 101, 103, 111, 119, 127, 139, 143, 155, 159, 175, 191, 207, 223, 239, 255, 267, 271, 283, 287, 303, 319, 335, 351, 367, 383, 395, 399, 411, 415, 431, 447, 463, 479, 495, 511, 531
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, Least 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..59);
Comments