%I #13 May 21 2020 20:56:03
%S 0,1,2,3,4,6,7,8,10,12,14,15,16,20,24,26,28,30,31,32,40,48,52,56,58,
%T 60,62,63,64,80,96,100,104,108,112,116,120,122,124,126,127,128,160,
%U 192,200,208,216,224,228,232,236,240,244,248,250,252,254,255,256,320
%N Numbers whose binary representation encodes a (binary) max-heap on elements from the set {0,1} with root at the most significant bit and a min-heap with root at the least significant bit.
%C All odd terms are in A000225.
%H Alois P. Heinz, <a href="/A335042/b335042.txt">Table of n, a(n) for n = 1..10000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Heap.html">Heap</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Binary_heap">Binary heap</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Bit_numbering#Least_significant_bit">Least significant bit</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Bit_numbering#Most_significant_bit">Most significant bit</a>
%F { A335040 } intersect { A335041 }.
%p q:= proc(n) local i, l; l:= convert(n, base, 2);
%p for i from 2 to nops(l) do if (h-> l[i]<l[h]
%p or l[-i]>l[-h])(iquo(i, 2)) then return false fi
%p od; true
%p end:
%p a:= proc(n) option remember; local k: for k from 1+
%p `if`(n=1, -1, a(n-1)) while not q(k) do od; k
%p end:
%p seq(a(n), n=1..62);
%Y Cf. A000225 (subsequence), A335039, A335040, A335041.
%K nonn,base
%O 1,3
%A _Alois P. Heinz_, May 20 2020