#R, 90 bytes
R, 90 bytes
A horribly long solution, but it's better than the 108 I originally had. I suspect that there is a lot better way to do this, but I can't see it at the moment.
function(n,x=0:1){repeat`if`(n,{x=c(x,sum(scan(t=gsub('',' ',x))))[-1];n=n-1},break);x[1]}
This is an unnamed function that uses gsub
and scan(t=
to split the numbers in the vector into digits. The sum of these is added to the vector while the first item is dropped. repeat
is used to step through the sequence n
times and the result is the first item of the vector.