Published on

EPI 5.7 - Generalized conversion between bases


Continuing on from EPI 5.6, this problem is to convert an integer encoded as S1 in base b1, to S2 in base b2:


The easiest way is to use the techniques in EPI 5.6 and simply do:

base1ToBase2 b1 s1 b2 = intToString b2 (stringToInt b1 s1)

Anybody looking for a version without the intermediate conversion to base 10?