Implement the function calculate_foodchain_length which calculates the maximum length of a food chain based on the initial energy and reduction factor.
Functionality:
The function should receive two integer parameters:
E: an integer representing the initial energy at the lowest trophic level.
K: an integer representing the factor by which energy reduces at each trophic level.
The function should determine how many trophic levels can be sustained before the energy at the next level becomes zero or negative.
Input/Output Requirements:
Input:
An integer E (1 ≤ E ≤ 10^9) representing the initial energy.
An integer K (2 ≤ K ≤ 10^9) representing the reduction factor.
Output:
An integer representing the maximum length of the food chain.
Implementation:
Write the function in a file called /app/solution.py.
Example:
python
calculate_foodchain_length(100, 2) # Should return 7
calculate_foodchain_length(50, 3) # Should return 4