Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the course I'm currently teaching, we're testing our understanding of elementary school arithmetic algorithms by working in base 5. Each day, I write up several example problems for them to try along with the answer (so that they'll know if they've gone awry). Invariably, if I churn out a list of twenty practice problems by hand, one or two of my answers are wrong. This is frustrating to both me and the student, since they always double and triple check their work before daring to ask if I've made a mistake. In order to check my work before this happens, I wonder:

Is there a simple program (either online or in Maple/Matlab) for performing arithmetic in alternate bases?

share|cite|improve this question
Not worth an actual answer, but if you're on a Unix-based system then the 'dc' app (still built in to most versions) offers up basic arithmetic in arbitrary bases (and good ol' RPN): just enter, e.g., '5 k' and then '22 31 + p' to get '103'. – Steven Stadnicki Oct 6 '14 at 23:40
up vote 1 down vote accepted

I tried 13 base 5+22 base 5 in Wolfram Alpha. One of the answers I got was $40_5$.

share|cite|improve this answer
I feel silly for not thinking of Wolfram Alpha. It seems to be handling everything nicely. Many thanks from me and my frustrated students. – Austin Mohr Sep 17 '11 at 22:41
Wolfram Alpha supports an abbreviated form: 5^^13+5^^22 – J. M. Sep 18 '11 at 1:51

I’ve not tried it, but this freeware Windows program would at least be a workable stopgap measure if it works as described, as would this one. This site has a rather clunky on-line converter. I’ve not run across any actual base-$n$ calculators.

share|cite|improve this answer
You are correct that the internet is littered with converters. I have been using such a solution, but it is rather clunky, as you say. – Austin Mohr Sep 17 '11 at 22:39

You may use GAP for this. After installing GAP, download two files, and Then you can work as follows:

gap> Read("/path/to/file/");
gap> Read("/path/to/file/"); 
gap> R := SystematicNumbersRing( 2 ); 
Integers base 2 
gap> a := SystematicNumber( R, 2 ); 
gap> b := SystematicNumber( R, 3 ); 
gap> a+b; a*b; a^b; a=b; a<b;

If the base is larger than 10, brackets will be used for "long digits":

gap> H := SystematicNumbersRing( 16 ); 
Integers base 16 
gap> h1 := SystematicNumber( H, 10 ); 
gap> h2 := SystematicNumber( H, 13 ); 
gap> h1+h2; 
gap> SystematicNumber( H, 23 );      
gap> h3 := SystematicNumber( H, 16 ); 
gap> h3^2; 
gap> h3+h3; 

Please ask me if anything is unclear. This is the code written by my student for a mini-project in 2005, and I haven't revisited it for a while.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.