

A136322


a(n) is the ceiling of 2^n * (sqrt(2)1), i.e., a(n)1 is the number whose binary representation gives the first n bits of sqrt(2)1.


1



1, 2, 4, 7, 14, 27, 54, 107, 213, 425, 849, 1697, 3394, 6787, 13573, 27146, 54292, 108584, 217168, 434335, 868669, 1737338, 3474676, 6949351, 13898701, 27797402, 55594804, 111189607, 222379213, 444758426, 889516852, 1779033704, 3558067408
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

Previous definition: Call an integer m >= 1 plentiful iff the square of m has twice as many bits (floor log_2 plus one) as m. For each n >= 1 there is a unique k >= 0 so that an m with 2^n <= m < 2^(n+1) is plentiful iff m >= 2^n+k. a(n) is this k.
This sequence has a geometric interpretation. Let 2^(n+1) be the length of the fixed base of all integer isosceles triangles whose equal sides are shorter than its base. Then a(n) is the number of these isosceles triangles whose height above the base is < 2^n. It includes the degenerate isosceles triangle of height 0.  Frank M Jackson, Sep 16 2017


LINKS

Paul Stoeber, Table of n, a(n) for n = 1..95 [corrected by Andrew Howroyd, Feb 28 2018]


EXAMPLE

a(8)=107 because 256 + 107, ..., 511 are plentiful and 256, ..., 256 + 107  1 are not.


MATHEMATICA

hcount[c_] := Module[{n=0, m}, Do[If[Sqrt[m(c+m)]<c/2, n++], {m, 0, c/2}]; n]; Table[hcount[2^(n+1)], {n, 1, 20}] (* Frank M Jackson, Sep 16 2017 *)


PROG

{ Haskell (replace leading dots with spaces!) }
bits :: Integer > Integer
bits n = if n==1 then 1 else 1+bits (n`div`2)
plentiful :: Integer > Bool
plentiful n = bits (n*n) == 2*bits n
bisect a b = let c = (a+b)`div`2 in
.. if c==a then b else if plentiful c then bisect a c else bisect c b
a :: Integer > Integer
a n = bisect (2^n) (2^(n+1)1)  2^n
main = print [a n  n<[1..]]


CROSSREFS

Sequence in context: A190822 A107949 A155099 * A160113 A171231 A094057
Adjacent sequences: A136319 A136320 A136321 * A136323 A136324 A136325


KEYWORD

nonn,base


AUTHOR

Paul Stoeber (pstoeber(AT)unipotsdam.de), Mar 25 2008


EXTENSIONS

New simplified definition by Vincent Nesme, Nov 04 2008


STATUS

approved



