| Bytes | Lang | Time | Link |
|---|---|---|---|
| 144 | Haskell + hgl | 240621T173545Z | Wheat Wi |
| 072 | Charcoal | 240516T100421Z | Neil |
Haskell + hgl, 144 bytes
f k v b n|q<-bS b n,c<-k+l q,t<-(k+)<isx 0 q,p<-fn(fe t)$n:>v,mF(>c)p,fsw t$n:>v=n:f c p b(n+1)|T=f k v b$n+1
g 2=2:4:5:7:f 15[]2 9
g b=f 1[]b 3
I might figure out a better way to do this in the future ...
Charcoal, 77 72 bytes
NθNη≔⎇⁼θ²I⪪245¹⟦⁺³⁼³θ⟧υW‹Lυη«⊞υ⌈υ≔1ζW¬⁼⌕Aζ1Φυ‹λLζ≔⪫00⭆⊞Oυ⊕⊟υ⍘λ⭆θ¬νζ»I…υη
Try it online! Link is to verbose version of code. Outputs the first k terms. Explanation:
NθNη
Input n and k.
≔⎇⁼θ²I⪪245¹⟦⁺³⁼³θ⟧υ
If n=2, start with 2, 4, 5, otherwise if n=3 then start with 4 otherwise start with 3.
W‹Lυη«
Repeat until enough terms have been collected.
⊞υ⌈υ
Start with the previous number.
≔1ζ
Start with an invalid base representation, so that the following loop always executes at least once.
W¬⁼⌕Aζ1Φυ‹λLζ
Find the position of all of the 1s in the string (corresponding to the 0s in the actual base representation) and compare this to the values of the list that are less than the length of the string, and until a valid number is found...
≔⪫00⭆⊞Oυ⊕⊟υ⍘λ⭆θ¬νζ
... increment the trial number and convert the list into base n using 1 for the 0 digit and 0 for all other digits. (I could possibly do slightly better with the newer version of Charcoal on ATO.) Join the strings and wrap the entire result in a leading and trailing 0; the leading 0 is for 1-indexing and the trailing 0 is because the next number is known to begin with a non-0 digit.
»I…υη
Output k terms.