I kinda have a solution in mind for this and it goes like so:
there are a total of 10! permutations (10 digits total), the first 9! (from 1 - 9!) solutions contain 0 as the first digit, second 9! (9! - 9!*2) contain 1 as the first and so on until 9!*10 which contains 9 as the first digit, when u find the range of the first digit you know you will have now 9! options, first 9! will contain 0 (or 1 if you have 0 as the first digit), second 9! (9!-9!*2) will contain 1(or 0 if you have 1 as the first digit) and you reapeat this procces until 2! = 2 (then you will have only one option), how do you bring this idea into (fast running if possible) code?

thanks in advance
Edit: i meant 8! in the second digit, idea is to decrement the factorial every digit you go

I want to output the n-th lexicograpthic permutation, and I don’t wanna google it cuz I don’t want to see solutions but rather actually do it myself (with some hints from here)

are you really sure that’s what you want?
a permutation algorithm is something matemathics try to invent

if you want to invent one yourself I would have no idea what hints to give

wikipedia has a lexographic order permutation algorithm in the Permutation article. It’s not a solution, you still have to do all the work of implementing it in javascript.