Ms Math's kindergarten class has 16 registered students. The classroom has a very large number, N, of play blocks which satisfies the conditions:
(a) If 16, 15, or 14 students are present in the class, then in each case all the blocks can be distributed in equal numbers to each student, and
(b) There are three integers 0 < x < y < z < 14 such that when x, y, or z students are present and the blocks are distributed in equal numbers to each student, there are exactly three blocks left over.
Find the sum of the distinct prime divisors of the least possible value of N satisfying the above conditions.
[Edit: corrected to show only the distinct prime factors]
lcm(14,15,16) = 1680, so the number of blocks is 1680*k
Program Output:
220080 [9, 11, 13]
[2, 3, 5, 7, 131]
154
-----------------
N = 220080
(x,y,z) = (9,11,13)
The requested sum is 148
for x in range(0,10000000,1680):
leftover3 = 0
kidnums = []
for kids in range(2,14):
if x%kids == 3:
leftover3 += 1
kidnums.append(kids)
# if x > 1000000:
# print(' ',x, kids )
if leftover3 == 3:
print(x, kidnums )
break
# print(prime_factor(x)) ######## commented out
print(list(set(prime_factor(x))))
# print(sum(prime_factor(x))) ####### commented out
print(sum(list(set(prime_factor(x)))))
Edited on April 24, 2024, 10:43 am
|
Posted by Larry
on 2024-04-23 21:35:41 |