All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Stairway Ascension Ascertainment (Posted on 2023-03-07) Difficulty: 3 of 5
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.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts a start | Comment 1 of 6
tl;dr
a) beginnings of a Combinatorics methodology
b) base 4 trick which works, but only for smaller numbers of steps.

a)  Any method of ascending will utilize some subset of {1,2,3,4} of which there are 15 subsets.  For each subset, there will be some number of repetitions of each member of the subset to achieve the goal.
Consider the subset {3,4}.  You get to 100 with [0,25], [4,22], [8,19], ... etc reps of 3 and 4
Finally, consider the reps [4,22] of the subset {3,4}, so 4 3s and 22 4s.  You have to figure the number of ways to list that many 3s and 4s.  Consider spacing out all the 3s.  Now you have 5 gaps, 3 gaps between 3s and 1 more gap at each end.  The problem becomes how many ways can the number 22 be the sum of 5 integers, with repetition and with 0 being allowed.  I know there is a formula for this, but I don't recall it.

So, time to switch gears.

b)  Consider zero-less base 5 numbers with sod = 100.  Done.  Only problem is you have to count up to a series of 100 1s in base 5 which is (5^100 - 1)/(5-1) ~ 2 x 10^69 in base 10.

OK, instead use base 4 numbers, where 0 counts as 1 step, ... and 3 counts as 4 steps.  Compute sod plus nod (the number of digits).  Then any result that is 100 or less will correspond to a single unique method of ascending.  Just imagine leading zeros (single steps) so the total sod plus nod is 100. Now the largest number you have to count is (base 4) 1 followed by 98 zeros = 4^98 ~ 10^59 in base 10.  Still pretty bad.  But OK for finding results of smaller numbers of total steps.  Here then, are the results for 0 to 12 steps.
[0, 1, 2, 4, 8, 15, 29, 56, 108, 208, 401, 773, 1490]
This sequence is not in oeis.  [edit: but if you remove the initial zero then that IS in oeis as shown by Jer in a later comment]

The largest base 10 numbers needed, using this base 4 trick, for increasing numbers of steps starting with zero steps:
[1, 1, 1, 4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576]

mylist = []
bignumbers = []
for steps in range(0,13):
    largest = '1' + '0'*(steps-2)
    largest10 = base2base(largest,4,10)
    count = 0
    for i in range(largest10 + 1):
        i4 = base2base(i,10,4)
        x = sod(i4) + len(str(i4))
        if x <= steps:
            count += 1
    
    print(steps, count)
    mylist.append(count)
    bignumbers.append(largest10)

print(mylist)

Edited on March 7, 2023, 10:01 am
  Posted by Larry on 2023-03-07 08:08:59

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information