A stairway consists of 100 steps which can be ascended by one step at a time, two steps, three steps or, by four steps.
Determine the total number of ways to ascend the staircase.
(In reply to
Iterative approach by Steve Herman)
Steve Herman's iterative approach agrees with the results obtained from the "base 4 trick".
The solution appears to be 17943803336550012914104102513
f = [1,2,4,8]
for i in range(100):
if i < 4:
continue
f.append(f[i-1]+f[i-2]+f[i-3]+f[i-4])
[1, 2, 4, 8, 15, 29, 56, 108, 208, 401, 773, 1490, 2872, ... , 17943803336550012914104102513]
|
Posted by Larry
on 2023-03-07 09:42:19 |