Rather than explicitly computing T(i = 1 + 2 + 3 + ... + i) = 1 + 2 + 3 + ... + i, we start with t = 0 = 0 and iteratively subtract t+1t + 1 from n while t < n < n, incrementing t at each iteration. When the condition is not fulfilled anymore, a total of T(t)t has been subtracted from n and the output is updated accordingly. We repeat the process until n = 0 = 0.
Rather than explicitly computing T(i) = 1 + 2 + 3 + ... + i, we start with t = 0 and iteratively subtract t+1 from n while t < n, incrementing t at each iteration. When the condition is not fulfilled anymore, T(t) has been subtracted from n and the output is updated accordingly. We repeat the process until n = 0.
Rather than explicitly computing Ti = 1 + 2 + 3 + ... + i, we start with t = 0 and iteratively subtract t + 1 from n while t < n, incrementing t at each iteration. When the condition is not fulfilled anymore, a total of Tt has been subtracted from n and the output is updated accordingly. We repeat the process until n = 0.
Rather than explicitly computing T(i) = 1 + 2 + 3 + ... + i, we start with t = 0 and iteratively subtract t+1 from n while t < n, incrementing t at each iteration. When the condition is not fulfilled anymore, T(t) has been subtracted from n and the output is updated accordingly. We repeat the process until n = 0.
Rather than explicitly computing T(i) = 1 + 2 + 3 + ... + i, we start with t = 0 and iteratively subtract t+1 from n while t < n, incrementing t at each iteration. When the condition is fulfilled, T(t) has been subtracted from n and the output is updated accordingly. We repeat the process until n = 0.
Rather than explicitly computing T(i) = 1 + 2 + 3 + ... + i, we start with t = 0 and iteratively subtract t+1 from n while t < n, incrementing t at each iteration. When the condition is not fulfilled anymore, T(t) has been subtracted from n and the output is updated accordingly. We repeat the process until n = 0.
###How?
Rather than explicitly computing T(i) = 1 + 2 + 3 + ... + i, we start with t = 0 and iteratively subtract t+1 from n while t < n, incrementing t at each iteration. When the condition is fulfilled, T(t) has been subtracted from n and the output is updated accordingly. We repeat the process until n = 0.
Below is a summary of all operations for n = 100.
n | t | t < n | output
----+----+-------+--------
100 | 0 | yes | ""
99 | 1 | yes | ""
97 | 2 | yes | ""
94 | 3 | yes | ""
90 | 4 | yes | ""
85 | 5 | yes | ""
79 | 6 | yes | ""
72 | 7 | yes | ""
64 | 8 | yes | ""
55 | 9 | yes | ""
45 | 10 | yes | ""
34 | 11 | yes | ""
22 | 12 | yes | ""
9 | 13 | no | "d"
----+----+-------+--------
9 | 0 | yes | "d"
8 | 1 | yes | "d"
6 | 2 | yes | "d"
3 | 3 | no | "d3"
----+----+-------+--------
3 | 0 | yes | "d3"
2 | 1 | yes | "d3"
0 | 2 | no | "d32"
###Test cases
###Test cases
###How?
Rather than explicitly computing T(i) = 1 + 2 + 3 + ... + i, we start with t = 0 and iteratively subtract t+1 from n while t < n, incrementing t at each iteration. When the condition is fulfilled, T(t) has been subtracted from n and the output is updated accordingly. We repeat the process until n = 0.
Below is a summary of all operations for n = 100.
n | t | t < n | output
----+----+-------+--------
100 | 0 | yes | ""
99 | 1 | yes | ""
97 | 2 | yes | ""
94 | 3 | yes | ""
90 | 4 | yes | ""
85 | 5 | yes | ""
79 | 6 | yes | ""
72 | 7 | yes | ""
64 | 8 | yes | ""
55 | 9 | yes | ""
45 | 10 | yes | ""
34 | 11 | yes | ""
22 | 12 | yes | ""
9 | 13 | no | "d"
----+----+-------+--------
9 | 0 | yes | "d"
8 | 1 | yes | "d"
6 | 2 | yes | "d"
3 | 3 | no | "d3"
----+----+-------+--------
3 | 0 | yes | "d3"
2 | 1 | yes | "d3"
0 | 2 | no | "d32"
###Test cases