Mayan Calculation puzzle discussion


Hello, I have the same problem with the 'Base 20" validator.

Anyone have an idea of why ?



I’m validating all the tests but the test “Divisions” is the only one not validated after. Am I the only one ?

Thanks !


J’ai validé tous les tests mais le tests “Divisions” lui ne passe pas et je ne comprend pas pourquoi. Suis-je le seul ?

Merci !


Same for me !

Idem pour moi !


Hi, I also have a failed final Division test, but on the test execution it’s green and other tests also are green. Maybe issue in our code, but without additional test cases it’s hard to understand what’s working in the wrong way. Does anyone has additional test data for the division test?

UPD: What kind of output should be if divisor is 0?


Totally stuck here. All the tests work except for the large multiplication one.

Don’t want to give away any answers here, but my last value I’m printing is 8 (printing the equivalent text). This is the last of 7 numbers that were printed.

Can someone please tell me if I’m on the right track.

I have the first value as 12345 and second 789012 given it’s multiplied that leaves me with 1150418548


Was using INTs instead of Int64


With regard to Base20 test case, I had that problem as well. The solution was to revisit the portion where you “read in” and convert each number (1 and 2) into a decimal. In my situation, I was mistakenly assigning 2 lines to a numeral, instead of 1 (which is what the height is), and that was because of a faulty logic in my if() clause. I think if you review that portion and try to print debug messages, you’ll find where you make a mistake. It certainly helped me.



I agree with @connie_zest - your issue should be in a function that reads initial input (var numeral). I had an error in statements of FOR loop (JavaScript). Here is a brief explanation of this error:

var numeral = “0123456789ABCDEFGHIJ”; (20 symbols)

my wrong loop:

for(var a=1; a<numeral.length; a++){…} (reads only 19 symbols)

so I only needed to update the middle statement in my loop:

for(var a=1; a<**=**numeral.length; a++){…}

In this exercise it is important not to forget that BASE20 system has 20 numerals, starting from 0. (comment for myself mainly) :relaxed: Although, interesting thing is that my code passed the initial BASE20 test without “J” numeral.

I hope this helps!


I got the same problem, when submitting my code, ‘division’ test fails. Does someone has a solution, an idea ?


I have the same problem: validation test with “Division” fails.

Logically, it seems unlikely that there would be a problem in parts of code that converts symbols to numbers, base20 to base10 and vice versa or everything else would’ve failed.

So it’s likely that it’s a problem that is unique to division. I went back to my code and put int() in front of every division so a float doesn’t show up and made sure all /'s are read correctly.

I ran the code in IDLE with some test cases I generated myself that does division and everything works fine.

I’m at a loss. Coding in python3.


I figured out my problem.

The part of code that converts base10 back into base20 was faulty and unable to handle base10 numbers like 20, 400, 8000 correctly.

So maybe if you’re failing only the divisions validation, this could be your problem, too.


Hi !

I do not understand I have that “great multiplication” of incorrect and this is wrong at the first Mayan figure.

My total result is 1150418548 and the nearest power divisor is 64000000

I therefore deduce that the first figure is 17. But the program tells me that he expects the number 7 (in Maya).

I have done it by hand by displaying the variables, I get the same result as my program (17) and this is the only one where I cale :frowning:

EDIT : My bad it was because the type int is limited ^^


Hi !
I have a little problem in C++. My code doesn’t pass the “big multiplication” test. So I’ve tried with long long int : same problem. Then i’ve manually tried to print the result of 12345*789012 and the result is wrong ! Same issue in C, but not in python.
What’s wrong ?


Are your ints long enough?


Yeah, but the probleme is that even typing “cout<<12345*789012;” the result is wrong…


You are doing int-multiplication with integers that are too big. Try cout<<12345L*789012; or cout<<(long)12345*789012. Thats the long-multiplication.

Your problem is probably this:

int x = 12345;
int y = 789012;
long r = x*y; // wrong: int*int -> int-multiplication

The values for x and y are small enough, so you can save them in ints. The result is too big for an int, so you save it in a long. So far so good. But if you take x*y you get the int result of two ints, not the long result you want.

You have to make sure you use the long multiplication. Details depend on the language. That’s why your Python code works and your C code doesn’t.

int x = 12345;
int y = 789012;
long r = (long)x*y; // right: long*int -> long-multiplication
long x = 12345;
long y = 789012;
long r = x*y; // right: long*long -> long-multiplication


I did not know that ! Thank you ! :slight_smile:


Hi, I had the same issue, and your message helped me: I checked the reading of numeral variable and appeared that function parsed first 20 symbols without “J” (and test BASE20 passed so as in your case).


Regarding Base 20 I am having a problem.
In base 10 the desired result after applying the operator is 134668800 (=160320*840).
As I pass to base 20 I get 221DC00, which eems to be the true value.
However, the the correct solution accepted here is 221DC.
Am I missing something? Or is the solution accepted wrong?
Thanks in advance!


Although I didn’t understand your problem, are you sure you have all values in LONG and not INT?