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

Home > Just Math
Odd divisor summation (Posted on 2024-03-21) Difficulty: 3 of 5
For each positive integer n, let Dn be the greatest odd divisor of n. (For example, D168 = 21.) Find D1 + D2 + D3 + ⋅ ⋅ ⋅ + D2048.

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer solution | Comment 2 of 4 |
1,398,102

-------------
def largestOddDivisor(n):
    """ input integer, output the largest odd divisor  """
    if n%2 == 1:
        return n
    for i in range(int(n/2)+1-int(n/2)%2 , 0, -2):
        if n%i == 0:
            return i
    return None

mysum = 0
for n in range(1,2049):
    mysum += largestOddDivisor(n)

print(mysum)

  Posted by Larry on 2024-03-21 11:30:55
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 (21)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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