#######################
##  A100982 Musings  ##
#######################

A100982 is the sequence of the counts of admissible sequences per <order>.

That <order> is the hammingweight of each admissible sequence, when binary encoded.
This binary encoding is the common T(x) parity sequence, 
when traveling the (3x+1)/2 trajectory from x to its drop.


A100982(0) = 1: {0}
A100982(1) = 1: {10}
A100982(2) = 1: {1100}
A100982(3) = 2: {11010,11100}
A100982(4) = 3: {1101100,1110100,1111000}
...


PARI/GP code:

a_iter(N) = {
  my( a= List([[0, 0, 2, 1, 1, 0]]), p0=#a, p1=#a );
  for(p3=0, N-1
  , my( p2=logint(3^p3,2)+1, m=if(logint(3^(p3+1), 2)>p2, 2, 1) );
    for(p=p0, p1
    , my( s= a[p][1] );
      for(i=0, if(s, valuation(s, 2)-1, 0)
      , my( t= [(a[p][1]+(1<<i))<<m,0,0,p2+m,0,p3+1] );
        listput(a, t);
      )
    );
    p0= p1+1;
    p1= #a;
  );
  for(i=2, #a
  , my( t=a[i][1], p2=a[i][4], p3=a[i][6], r=0 );
    for(j=1, p2, r=if(bittest(t, p2-j), 3*r+1, r) / 2);
    a[i][2]= numerator(r);
    a[i][3]= -r * (2^p2) / (3^p3) % (2^p2);
    a[i][5]= a[i][3] * 3^p3 / 2^p2 + r;
  );
  Vec(a);
}

? printp( Mat(a_iter(5)~) )
[  0   0   2 1   1 0]
[  2   1   1 2   1 1]
[ 12   5   3 4   2 2]
[ 26  23  11 5  10 3]
[ 28  19  23 5  20 3]
[108  85  59 7  38 4]
[116  73   7 7   5 4]
[120  65  15 7  10 4]
[218 319 123 8 118 5]
[220 287 219 8 209 5]
[234 283 199 8 190 5]
[236 251  39 8  38 5]
[242 259  79 8  76 5]
[244 227 175 8 167 5]
[248 211  95 8  91 5]

Reformatted, using columns 3-6 as {v2,p2,v3,p3},
where p3 is the <order>:

 v2 + i*2^p2 --> v3 + i*3^p3
===-------==----===-------==-
  2 + i*2^ 1 ->   1 + i*3^ 0
  1 + i*2^ 2 ->   1 + i*3^ 1
  3 + i*2^ 4 ->   2 + i*3^ 2
 11 + i*2^ 5 ->  10 + i*3^ 3
 23 + i*2^ 5 ->  20 + i*3^ 3
 59 + i*2^ 7 ->  38 + i*3^ 4
  7 + i*2^ 7 ->   5 + i*3^ 4
 15 + i*2^ 7 ->  10 + i*3^ 4
123 + i*2^ 8 -> 118 + i*3^ 5
219 + i*2^ 8 -> 209 + i*3^ 5
199 + i*2^ 8 -> 190 + i*3^ 5
 39 + i*2^ 8 ->  38 + i*3^ 5
 79 + i*2^ 8 ->  76 + i*3^ 5
175 + i*2^ 8 -> 167 + i*3^ 5
 95 + i*2^ 8 ->  91 + i*3^ 5
===-------==----===-------==-


CROSSREFS
A079946, A014682, A070939, A119733, A126241, A177789, A243115.


[Graph code]
var url = "https://library.fridoverweij.com/codelab/math_editors/code_your_math_picture.html"

function f (x) {
  return x * (ln(3)/ln(2) - 1)
}

var fstr = f.toString().replace(/\s+/g," ");
fstr = fstr.match(/(?<=[{]).*(?=[}])/).toString();
fstr = fstr.replace(/\s*return\s+/,"");
fstr = fstr.replace(/\bln[(]/g,"log(");
fstr = "y = " + fstr

var w = 8, h = 5

initPicture(-0.9,w+.6,-0.9,h+.4)
axes(1, 1, true)
gridstroke = "lightgrey"
grid()
text([0,0], "0", "belowleft")

fontsize = "12"
text([-0.5,-0.5], url, "belowright")

strokewidth = "1"
stroke = "tomato"
line([0,0],[w+.5,f(w+.5)])

fontstroke = stroke
fontfill = fontstroke
fontsize = "18"
text([0.1,h+.1], fstr, "right")

stroke = "blue"
fontstroke = stroke
fontfill = fontstroke
fontsize = "14"

line([0,0],[w+.5,0])

var v = ["0", "(1)/2²", "(5)/2⁴", "(23,19)/2⁵", "(85,73,65)/2⁷", "(319,287,283,251,259,227,211)/2⁸"];

fontstroke = "purple"
fontfill = fontstroke
pointsize = 3

var x0 = 0, y0 = 1
for (x=x0; x<=w; x++) {
  var y = floor(f(x))+1
  line([x,0],[x,y])
  if (y0 < y) {
    line([x,y0],[w+.5,y0])
  }
  y0 = y
  point([x,y], "open")
  text([x-0.05-((x>0)*0.1),y+(x>3?0.1:0.15)], v[x], x>3?20:0)
}

text([-0.2,0.1], 0)
text([-0.22,0.5], "/2")
text([0.1,0.1], "*3/2+1/2")

stroke = "purple"
strokewidth = 2
path([[0,0.2],[0,0.8]],"arrow")
path([[0.2,0],[0.8,0]],"arrow")
[/Graph code]