![]() ![]() Using Newton's identities, knowing b i allows to compute This reduces the problem to solving the system of equations Remember sum of i-th powers, where i=1,2.,k. Here's a summary of Dimitris Andreou's link. Now find your database-record with WHERE id = 19158 and do the redirect.Įxample implementations (provided by commenters) ![]() You just do a reverse lookup in your alphabet.Į9a 62 will be resolved to "4th, 61st, and 0th letter in the alphabet".Į9a 62 = 4×62 2 + 61×62 1 + 0×62 0 = 19158 10 ![]() How to resolve a shortened URL to the initial ID With 2 → c and 1 → b, you will receive cb 62 as the shortened URL. This is how your mapping (with an array for example) could look like: 0 → a Now map the indices 2 and 1 to your alphabet. This requires the use of integer division and modulo. Now you have to convert 125 10 to X 62 (base 62). Take an auto-generated, unique numerical key (the auto-incremented id of a MySQL table for example).įor this example, I will use 125 10 (125 with a base of 10).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |