# It's n-onacci this time!

$$14$$ and $$197$$ are somewhat special numbers. How?

• $$14:$$ Number of digits in $$14$$ is $$2$$. Trying to make a n-onacci sequence with $$n=2$$ $1,4,(1+4=)5,(4+5=)9,(5+9=)14...$ Thus, 14 lies in 2-onacci sequence started from its digits.

• 197: Number of digits in $$197$$ is $$3$$. Repeating the above steps with $$n=3$$, $1,9,7,(1+9+7=)17,(9+7+17=)33,(7+17+33=)57 \\ ,(17+33+57=)107,(33+57+107)=197...$ Thus, 197 lies in 3-onacci sequence started from its digits.

Such special numbers are called Keith Numbers, with $$14$$ being the smallest number that satisfy such property.

Calculate the sum of the 20th and 40th Keith Numbers.

Details and Assumptions:

• $$\text{n-onacci}$$ is a name given by me only.

• $$\text{Fibonacci sequence}$$ is an example of 2-onacci sequence starting with $$[0,1]$$.

• $$\text{Tribonacci sequence}$$ is an example of 3-onacci sequence starting with $$[0,0,1]$$.

×