Q11: Iterate
“Fret! For now the path ahead shall be more hostile!"

You look in awe at this old piece of text carved on a large tree trunk. The tree is efficiently placed behind a group of sturdy boulders, which had protected the mark from weathering agents. You look for clues on the surrounding boulders, and find something: a large triangle made up of tiny stars towers above you. Maybe if you can match which of these stars correspond to the dots on the boulder opposite ... maybe at high noon ... you wonder ...
The $n$th Triangular number, $T_n$, is the sum of the first $n$ natural numbers. For instance, $T_0 = 0$, $T_1=1$, $T_2=1+2=3$, $T_3=1+2+3=6$, and so on. As you think about them, Aditya tells you about a different sequence he's thinking about: he calls then curly natural numbers, denoted $a_n$ such that $a_0 = 0$, $a_1 = 1$ and $a_n = a_{n-1} + \operatorname{sum}(n)$ for $n\geq 2$. Here, $\operatorname{sum}(n)$ denotes the sum of digits of $n$.
How many numbers less than $400$ are both triangular and curly?
Submit