login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 n first 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

LINKS

Paul Stoeber, Table of n, a(n) for n = 1..96 [from (pstoeber(AT)uni-potsdam.de), Mar 25 2008]

EXAMPLE

Alternative 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.

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

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

AUTHOR

Paul Stoeber (pstoeber(AT)uni-potsdam.de), Mar 25 2008

EXTENSIONS

I simplified the definition and mentioned the old definition as an example. - Vincent Nesme, Nov 04 2008

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified May 24 10:57 EDT 2013. Contains 225619 sequences.