login
Store the natural numbers in a triangular array such that values on each row have the same number of bits. Start a new row with the smallest number not yet recorded. a(n) represents the initial terms in the resulting array.
1

%I #19 Mar 03 2023 20:32:34

%S 0,1,3,4,7,9,15,21,24,31,41,45,63,64,72,74,83,94,127,139,140,173,197,

%T 207,234,255,268,284,288,339,349,390,426,445,467,511,522,553,569,634,

%U 689,706,734,797,838,934,950,951,1023,1036,1052,1078,1179,1236

%N Store the natural numbers in a triangular array such that values on each row have the same number of bits. Start a new row with the smallest number not yet recorded. a(n) represents the initial terms in the resulting array.

%C A067576 describes the sequences with a fixed number of binary bits using antidiagonals.

%H Alois P. Heinz, <a href="/A086772/b086772.txt">Table of n, a(n) for n = 0..10000</a>

%e The array begins:

%e 0

%e 1 2

%e 3 5 6

%e 4 8 16 32

%e 7 11 13 14 19

%e 9 10 12 17 18 20

%e 15 23 27 29 30 39 43

%e ...

%e so the initial terms are 0 1 3 4 7 9 15 ...

%p A086772aux := proc(n,k)

%p option remember;

%p local a,npr,kpr,fnd ;

%p if n = 0 then

%p return 0;

%p end if;

%p if k = 0 then

%p for a from 1 do

%p fnd := false;

%p for npr from 1 to n-1 do

%p for kpr from 0 to npr do

%p if procname(npr,kpr) = a then

%p fnd := true;

%p break;

%p end if;

%p end do:

%p end do:

%p if not fnd then

%p return a;

%p end if;

%p end do:

%p else

%p for a from 1 do

%p if wt(a) = wt(procname(n,0)) then

%p fnd := false;

%p for npr from 1 to n-1 do

%p for kpr from 0 to npr do

%p if procname(npr,kpr) = a then

%p fnd := true;

%p break;

%p end if;

%p end do:

%p end do:

%p for kpr from 0 to k-1 do

%p if procname(n,kpr) = a then

%p fnd := true;

%p break;

%p end if;

%p end do:

%p if not fnd then

%p return a;

%p end if;

%p end if;

%p end do:

%p end if;

%p end proc:

%p A086772 := proc(n)

%p A086772aux(n,0) ;

%p end proc: # _R. J. Mathar_, Sep 15 2012

%Y Cf. A000079, A001477, A018900, A014311, A014312, A014313, A023688, A023689, A023690, A023691.

%K nonn,base

%O 0,3

%A _Alford Arnold_, Aug 03 2003