cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A125508 Lowest number having a particular shape of factor decomposition binary tree.

Original entry on oeis.org

1, 2, 4, 8, 16, 20, 32, 40, 64, 72, 88, 128, 160, 176, 200, 220, 256, 272, 288, 320, 336, 360, 400, 420, 460, 480, 512, 540, 544, 640, 704, 864, 880, 920, 1024, 1056, 1152, 1184, 1200, 1280, 1344, 1440, 1600, 1640, 1680, 1800, 1840, 1920, 2048, 2176, 2368
Offset: 1

Views

Author

Paul Richards, Jan 18 2007

Keywords

Comments

For a natural number, n, make it the root node of a binary tree. The left child node (L) is the largest divisor of n which is greater than 1 but less than or equal to the square root of n, if this exists. The right child node is n/L, if the left node exists. Thus if n is a prime it is a leaf node; otherwise if it is composite then it is the product of its two children. If n = 1 then we have an empty tree. A term in this sequence a(n) is such that no number (x) exists 1<=x

Examples

			a(8) = 40, make this the root node.
40 is first decomposed into 5 and 8; 5 is a leaf node.
8 is decomposed into 2 and 4; 2 is a leaf node.
4 is decomposed into 2 and 2; both are leaf nodes.
There is no number x (where 1 <= x < 40) which has a factor decomposition binary tree isomorphic to this.
		

Programs

  • PARI
    fissr(n) = {if (isprime(n), n, my(d = divisors(n)); my(nddt = #d\2 + 1); if (#d % 2, [fissr(d[nddt]),n,fissr(d[nddt])], [fissr(d[nddt-1]),n,fissr(d[nddt])]););}
    fiss(n) = if (n==1, [], if (type(fv = fissr(n))== "t_INT", [fv], fv));
    empty(v) = {my(nv = vector(#v)); for (i=1, #v, if (type(v[i]) == "t_INT", nv[i] = 0, nv[i] = empty(v[i]));); nv;}
    eqvec(va, vb) = {if (type(va) != type(vb), return (0)); if (type(va) == "t_INT", return (va == vb)); if (#va != #vb, return (0)); for (i=1, #va, if (!eqvec(va[i], vb[i]), return (0));); return (1);}
    isalready(erep, vrep) = {if (! #vrep, return (0)); for (j=1, #vrep, if (eqvec(erep, vrep[j]), return (1););); return (0);}
    addrep(erep, vrep) = {nvrep = vector(#vrep+1, i, if (i <= #vrep, vrep[i], 0)); nvrep[#vrep+1] = erep; nvrep;}
    lista(nn) = {vrep = []; for (n=1, nn, rep = fiss(n); erep = empty(rep); if (! isalready(erep, vrep), print1(n, ", "); vrep = addrep(erep, vrep);););} \\ Michel Marcus, May 25 2014