# Thought Process

Nice to have a simpler problem every now and then.

1. I made a function, build_next_stack(curr_round), that builds a list of possibilities. I memoize because I will need to call it a lot of times

• if curr_round = 0, returns ['1', '2']

• if curr_round = 1, returns ['10', '11', '12', '20', '21', '22'] -> etc

2. I made a function, construct_sequence(n), thats takes a number n and then goes through the first list, checks if its divisible, then builds the next list of possibilities using build_next_stack

3. Then I just go through each n and add construct_sequence(n) to a total.

It goes very quickly except for 9,999 where construct_sequence(9,999) = 11,112,222,222,222,222,222, which is really large and memory intensive.

Like everyone else I noticed

1. construct_sequence(9) = 12,222

2. construct_sequence(99) = 1,122,222,222

3. construct_sequence(999) = 111,222,222,222,222

And I found the pattern!

# Interactive Code

Input an integer (yourinput)

Code will output ∑ f(n)/n where 1 ≤ n ≤ yourinput