Skip to content

Instantly share code, notes, and snippets.

@mr21
Created December 17, 2021 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mr21/204e16b54bfe67a98d784c0cc7179c27 to your computer and use it in GitHub Desktop.
Save mr21/204e16b54bfe67a98d784c0cc7179c27 to your computer and use it in GitHub Desktop.
function numberBase( n ) {
const base = "abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWYXZ";
const len = BigInt( base.length );
let N = BigInt( n );
let s = "";
do {
s = base[ N % len ] + s;
N = N / len | 0n;
} while ( N > 0n );
return s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment