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

Home > Numbers
Some 2 Powers Sum to Factorial (Posted on 2023-02-27) Difficulty: 3 of 5
Determine all possible triplets (p, q, n) of nonnegative integers that satisfy this equation:
                 2p + 2q = n! 
Provide valid argument for your answer.

*** Adapted from a problem which appeared at the Harvard/MIT math Olympiad.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution | Comment 3 of 5 |
A program finds only three such triplets for (p, q, n), if p <= q:
(0, 0, 2)
(1, 2, 3)
(3, 4, 4)
p and q can be swapped in the last two bringing the total to 5.

Completeness argument:
There can be no value of n greater than 6.  
Every factorial greater than or equal to 7! is divisible by 7.  But powers of 2 can only be {1,2,4} mod 7.  So there is no way to add two powers of 2 to get 0 mod 7. So the largest n! can be is 6! = 720.  Since 2^10 > 720, there is no need to test any p or q > 10
"""
def fac(n):
    """ Factorial """
    if n == 1 or n == 0:
        return 1
    else:
        return n*fac(n-1)

big = 100
factorials = [fac(i) for i in range(0,big)]

for p in range(11):
    for q in range(p,11):
        if (2**p + 2**q)%7 == 0:
            print(p,q)
        if 2**p + 2**q  in factorials:
            print('({}, {}, {})'.format    (p,q, factorials.index(2**p + 2**q))   )
  Posted by Larry on 2023-02-27 16:02:12
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 (15)
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