A065938 Position of sqrt(n) in the mapping N2QuQR1 given in A065936.
1, 6, 14, 7, 120, 248, 16160, 1019, 127, 32640, 65408, 16373, 8386032, 4194056, 4194239, 32767, 2147450880, 4294934528, 4611672824287851743, 268435343, 8796091842564, 1125899889968159, 70368744112268, 70368744161279
Offset: 1
Keywords
Links
- Eric Weisstein's World of Mathematics, Continued Fraction.
Crossrefs
Programs
-
Maple
[seq(frac2position_in_0_1_SB_tree(sqrt_n_confrac2binfrac(j)),j=1..40)]; sqrt_n_confrac2binfrac := proc(n) local c,t; c := CONFRACS_FOR_sqrt_N[n]; t := `if`((1 = nops(c)),[],`if`((0 = (nops(c) mod 2)),[op(c[2..nops(c)]),op(c[2..nops(c)])],c[2..nops(c)])); RETURN( (((2^c[1])-1) + `if`(1 = nops(c),0,(runcounts2binexp0(t) / ((2^(convert(t,`+`)))-1)))) / (2^c[1])); end; runcounts2binexp0 := proc(c) local i,e,n; n := 0; for i from 0 to nops(c)-1 do e := c[i+1]; n := ((2^e)*n) + ((i mod 2)*((2^e)-1)); od; RETURN(n); end; CONFRACS_FOR_sqrt_N := [[1], [1, 2], [1, 1, 2], [2], [2, 4], [2, 2, 4], [2, 1, 1, 1, 4], [2, 1, 4], [3], [3, 6], etc., adapted from Weisstein's encyclopedia entry for Continued Fractions]
Comments