+ 2
20 Goats
Is that Possible.? There are 20 goats and we have to cut them in 5 days . We can't cut them in even way we have to cut them in odd numbers only, we have to cut them each day (5 days)
3 Respostas
+ 4
You are right, the sum of 5 odd numbers is always odd, cannot be 20.
+ 1
I guess sum of odd number, odd time gives odd number only.
+ 1
#or you can verify it very naively by brute force computation.😁
from itertools import combinations_with_replacement
#generate odd number list
oddnums = []
for i in range(1,29):
if i%2!=0:
oddnums.append(i)
#collect all possible sums of 5 odd numbers from the list, repetitions included.
sums =[]
for n in combinations_with_replacement(oddnums,5):
sums.append((sum(n)))
print(f'{len(sums) = }')
print(f'{min(sums) = }')
print(f'{max(sums) = }')
#check if there is a 20 in there.
print(f'{set(sums) = }')
print(f'{20 in sums = }')