|
Search: id:A136322
|
|
|
| A136322 |
|
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. |
|
+0 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; listen)
|
|
|
OFFSET
|
1,2
|
|
|
LINKS
|
Paul Stoeber (pstoeber(AT)uni-potsdam.de), Mar 25 2008, Table of n, a(n) for n = 1..96
|
|
EXAMPLE
|
a(8)=107 because 256+107,...,511 are plentiful and 256,...,256+107-1 are not.
|
|
PROGRAM
|
{- 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: A108758 A018085 A107949 this_sequence A094057 A119267 A018254
Adjacent sequences: A136319 A136320 A136321 this_sequence A136323 A136324 A136325
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
Paul Stoeber (pstoeber(AT)uni-potsdam.de), Mar 25 2008
|
|
|
Search completed in 0.002 seconds
|