The objective of this challenge is to write a program to convert an inputed string of what can be assumed as containing only letters and numbers from as many bases between 2 and 36 as possible, and find the base 10 sum of the results.
The input string will be converted to all the bases in which the number would be defined according to the standard alphabet for bases up to 36: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
. For example, the input 2T
would be valid in only bases 30 and up. The program would convert 2T from bases 30 through 36 to decimal and sum the results.
You may assume that the input string contains only letters and numbers. Your program may use uppercase or lowercase; it can, but does not need to, support both.
Test cases
Sample input: 2T
Chart of possible bases
Base Value
30 89
31 91
32 93
33 95
34 97
35 99
36 101
Output: 665
Sample input: 1012
Chart of possible bases:
Base Value
3 32
4 70
5 132
6 224
7 352
8 522
9 740
10 1012
11 1344
12 1742
13 2212
14 2760
15 3392
16 4114
17 4932
18 5852
19 6880
20 8022
21 9284
22 10672
23 12192
24 13850
25 15652
26 17604
27 19712
28 21982
29 24420
30 27032
31 29824
32 32802
33 35972
34 39340
35 42912
36 46694
Output: 444278
Sample input: HELLOworld
Chart of possible bases
Base Value
33 809608041709942
34 1058326557132355
35 1372783151310948
36 1767707668033969
Output: 5008425418187214
An input of 0
would be read as 0
in all bases between 2 and 36 inclusive. There is no such thing as base 1.
This is code golf. Standard rules apply. Shortest code in bytes wins.
0
\$\endgroup\$0
an important test case?0
is0
in every base, and there's no such thing as base 1. \$\endgroup\$HELLOworld
implies that the program must be able to output greater than 32-bit integers. Is this correct or can we just 32 bit outputs? If not, do we do just up to 64 bit integers, or do we need to arbitrary precision? \$\endgroup\$