(I apologize for the following lack of clarity, I know next to nothing. Links would be cool if the answer would take to long, I simply don't know how to even google these questions )(adsbygoogle = window.adsbygoogle || []).push({});

Question 1, non decimal numbers:

I have a set of parameters I'd like to encode. Each parameter is in the form XX, under a base 62 number system using the characters (0-9, a-z, A-Z). If there are two of these "digits", how many numbers do they represent?

My guess is that it's BASE^DIGITS, so 62^2 which gives me 3844. 2^62 yields a bazillion which can't be correct (right?). Is BASE^DIGITS even how you do it?

Question 2, converting non decimal to decimal:

Given a decimal number, say 1337, how do I convert this to my 62-base and vice versa? I have no idea where to begin with this.

Question 3, encoding combinations as tightly as possible:

Let's say I have 4 options (A, B, C, D), how can I best fit these options into 2 characters in my base-62 number system. Here's my guess (I'm lol'ing at the thought of how I'm going to try and word this):

Each option is either "on" or "off", 1 or 0. Therefore:

A = 1 or 0

B = 1 or 0

C = 1 or 0

D = 1 or 0

If I make each option represent one of these bits so that they are in the order of A B C D and reverse it, D C B A then:

A = 1

B = 2

C = 4

D = 8

E = 16

F = 32...

Therefore, if my 62-base encoding in Question 1 is 0a (which equals 10 in decimal), then I know that I have options B and D because 2 + 8 = 10, and I can't combine A, B, C, or D in any other way to make 10.

Am I on the right track with this? So if my encoding equates to 23, I know it must represent options E + C + B + A because 16 + 4 + 2 + 1

This feels correct to me. I just don't know how to actually determine 23 is E + C + B + A algorithmically.

***

Background:

I'm returning to school this Spring after several years without any formal education and would like to catch myself back up in Math (I'm retaking Trig to be on the safe side). To do this, I am developing a web app which spits out math problems.

I'd like to develop what I call "sessions", which is a set of questions that fit certain parameters. I'd like to encode a session into a URL such that you would have something like:

mathiom.com/?session=AAXXYYZZ...AAXXYYZ

where

AA = The ID of an area of mathematics (Algebra, Geometry, Calculus, etc)

XX = Is a certain type of problem within that area (Solve for X, Area of a triangle, limits, etc)

YY = Is some type of modifier (only use integers, use real numbers, etc)

ZZ = Number of problems

The number system is base 62 (characters a-z, A-Z, 0-9), and each parameter is a pair of digits to make it easier. Therefore, each parameter has 62^2 = 3844 possibilites.

***

Ugly Alternative

The ugly alternative to this would simply be to not encode and do something like:

mathiom.com/?field=calculus & type=limit & modifier=integers & count=10

which would return 10 limit problems using only integers (whatever that means lol). If I were to create a complex session with 100 problems using all types of modifiers then the query string above would grow ridiculously long.

This project will be hosted on GitHub, so people can add extra fields of math, modifications, etc. This means there will be no server-side language and therefore I can't simply keep a database of shortcuts (ie, mathiom.com/?session=1 would equal the above).

Yes, this is a lot of work just to get nice URLs...but it's the best way I can think of that doesn't resort to a URL shortening service like bit.ly

**Physics Forums - The Fusion of Science and Community**

# Questions on encoding and combinatorics for an equation generator web app

Know someone interested in this topic? Share a link to this question via email,
Google+,
Twitter, or
Facebook

Have something to add?

- Similar discussions for: Questions on encoding and combinatorics for an equation generator web app

Loading...

**Physics Forums - The Fusion of Science and Community**