# C, <s>126</s> <s>116</s> 109 bytes

Port of [my R answer](https://codegolf.stackexchange.com/a/269079/17360). 

-10 bytes by rearranging loop logic printing leading 2, inspired by pajonk, and some small optimizations.

-7 bytes by using `C` with zeros instead of ones, credit 
chux - Reinstate Monica. Previously, the initialization of array `C` to 1s is a GNU extension.
 

```c
i=500,d=2,j,t,C[255];main(){while(i--){putchar(d+48);d=0;j=254;while(j-->2)t=10*C[j]+d+10,d=t/j,C[j]=t%j-1;}}
```

[Attempt This Online!](https://ato.pxeger.com/run?1=m700OT49OXnBgqWlJWm6FjdzM21NDQx0UmyNdLJ0SnSco41MTWOtcxMz8zQ0q8szMnNSNTJ1dTWrC0pLkjMSizRStE0sNK1TbA2ss2yNTE2sIUqydHXtjDRLbA0NtJyjs2K1U7QNQWaW6GfpgPi2JapZuobWtbUQS6F2w9wAAA)