All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Power of Two Sequence (Posted on 2025-03-03) Difficulty: 2 of 5
The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 16, . . . is formed from all positive integers that are either a power of 2 or a sum of two distinct powers of 2. Find the 200th term of this sequence.

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution same answer Comment 2 of 2 |
Answer:  524544
-----------
from itertools import combinations
big = 20
pow2s = [2**i for i in range(big)]
sum2s = []
for comb in combinations(pow2s, 2):
    mysum = sum(comb)
    if mysum not in sum2s:
        sum2s.append(mysum)

combined = sorted(pow2s + sum2s)
print(combined[199])

  Posted by Larry on 2025-03-03 19:29:58
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (8)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2025 by Animus Pactum Consulting. All rights reserved. Privacy Information