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

Home > Numbers
7^23 As The Product Of Five Numbers (Posted on 2025-02-28) Difficulty: 3 of 5
In how many ways can 7^23 be expressed as a product of five natural numbers?

Also repeat the problem for 7^22.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer solution Comment 2 of 2 |
The 5 factors are all powers of 7, from 7^0 up to 7^23.
This is equivalent to taking the integers 0 through 23, putting them into 5 bins provided the sum of the 5 bins is 23.  I figured both combinations and permutations.

Output:
7^23:
If order does not matter: 
 291
If order matters:
 17550

7^22
If order does not matter: 
 255
If order matters:
 14950


I wrote a function for dividing n items into g groups.  

def groups(smallest,n,g,listing=False):
    """ Ways to divide n items into g groups, when the smallest number of items in a bin is 'smallest'; returns the full list of ways if the 4th parameter is True, or just the count if False. """
   
    poss = [i for i in range(smallest, n+1)]
    ans = []
    for comb in combinations_with_replacement(poss,g):
        comb = list(comb)
        if comb != sorted(comb):
            continue
        if sum(comb) != n:
            continue
        ans.append(comb)
    if listing:
        return ans
    else:
        return len(ans)

number = 23
bins = 5

print('If order does not matter:',' ', groups(0,number,bins))

print('If order matters:')
mylist = groups(0,number,bins,True)
grandlist = []
for m in mylist:
    instances = []
    for digit in set(m):
        instances.append(m.count(digit))
    factorial_list = [fact(d) for d in instances]
    grandlist.append(int(fact(bins)/product(factorial_list)))

print('',sum(grandlist))

Edited on February 28, 2025, 7:23 pm
  Posted by Larry on 2025-02-28 17:04:06

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