A crate of eggs is stacked with eggs such that eggs are stacked on eggs in the crate until it is fully occupied and no egg can sit on another egg comfortably
Derive a mathematical formula to determine the total number of eggs stacked on the crate hence using your formula calculate how many eggs can be stacked on a crate that can contain 6 eggs per row and 5 eggs per column as the base
I was able to solve this in python programming by looking at the problem this way: For a crate that can contain n eggs by x eggs, The first layer(ground layer) will contain a total of n*x eggs The second layer will contain (n-1) * (x-1) eggs The third layer will contain (n-2) * (x-2) eggs In that order until n=0 or x=0 Now taking the sum of the total number of eggs on the 1st, 2nd, 3rd,…nth layers, we get the total number of eggs in the stack
Now how do I generate a mathematical formula for this problem?
Here is my python code
def eggCount(row,column):
totalEggs = 0
while row>0 and column>0:
eggs_on_layer = row * column
totalEggs += eggs_on_layer
row -= 1
column -= 1
return totalEggs
print(eggCount(6,5))