# Calculator for Arithmetic in Alternate Bases

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?

-
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

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

-
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.

-
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, sysnum.gd and sysnum.gi. Then you can work as follows:

gap> Read("/path/to/file/sysnum.gd");
gap> R := SystematicNumbersRing( 2 );
Integers base 2
gap> a := SystematicNumber( R, 2 );
10
gap> b := SystematicNumber( R, 3 );
11
gap> a+b; a*b; a^b; a=b; a<b;
101
110
1000
false
true


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 );
(10)
gap> h2 := SystematicNumber( H, 13 );
(13)
gap> h1+h2;
17
gap> SystematicNumber( H, 23 );
17
gap> h3 := SystematicNumber( H, 16 );
10
gap> h3^2;
100
gap> h3+h3;
20


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.

-