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!)
A335040 Numbers whose binary representation encodes a (binary) max-heap on elements from the set {0,1} with root at the most significant bit. 4

%I #12 May 22 2020 12:37:32

%S 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,

%T 41,48,50,52,54,56,57,58,59,60,61,62,63,64,80,81,82,83,96,100,104,108,

%U 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126

%N Numbers whose binary representation encodes a (binary) max-heap on elements from the set {0,1} with root at the most significant bit.

%H Alois P. Heinz, <a href="/A335040/b335040.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#Most_significant_bit">Most significant bit</a>

%p q:= proc(n) local i, l; l:= convert(n, base, 2);

%p for i from 2 to nops(l) do

%p if l[-i]>l[-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..70);

%Y Cf. A000225 (subsequence), A335039, A335041, A335042 (subsequence).

%K nonn,base

%O 1,3

%A _Alois P. Heinz_, May 20 2020

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 April 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)