ROSECODE 154
Brute interrogation - revisited
See the following code:
What is the smallest N for which function(N) returns 100000001?
[My timing: <1m]
function(N) begin UP=101 DOWN=211 FACTOR=-2 temp=0 loop for each decimal digit of N from left to right begin // loop if digit is equal to 1; add UP to temp else if digit is equal to 2; subtract DOWN from temp else if digit is equal to 3; multiply temp by FACTOR end // loop return temp end
What is the smallest N for which function(N) returns 100000001?
[My timing: <1m]