On the Subject of Hereditary Base Notation

I'm not really sure why we invented fancy number systems. We now have to deal with our creation, in an explosive way.

See Appendix H for the description of Hereditary Base-N Notation.

On this module, there are two number displays and 18 buttons, labeling 0 to 9, A to F, Clear, and Submit.

The bottom display shows a non-hereditary base-N number where N is a number ranging from 3 to 7.

Use the bomb and its edgework and count the number of true statements in the table below. This number will determine the base value K.

Statements
Lit indicator FRK is present. The last digit of serial number is odd. The first digit of the serial number is even.
Unlit indicator SIG is present. There are more than 36 modules on the bomb. There is exactly 1 module with "Forget" in its name.
The first two characters of the serial number are letters. Lit indicator BOB is present. Unlit indicator IND is present.
More unlit indicators than lit indicators. The initial time is 15 minutes or less. There are Ternary Converter, Simon Stores, or UltraStores modules on the bomb.
There are more than 4 batteries on the bomb. There are 2, 3, or 5 battery holders on the bomb. There are Bases or Indigo Cipher modules on the bomb.
There are exactly 2 digits in the serial number. Serial number contains any letter from "GOODSTEIN". There are more than 2 AA batteries on the bomb.

If the number is less than 2, then K = 10.
If the number is more than 16, then K = 8.
Otherwise, K is the number of true statements.

The answer is required to be submitted in non-hereditary base-K number.

The number N is determined by 3 plus the number of indicators and the last digit of the serial number. Subtract 5 from N until N is between 3 to 7.

Once the base-N of the number is found, convert it to hereditary base-N number and replace all the base digits N with new digits N + 1. Then, subtract 1 from the entire number and rewrite the number into hereditary base-(N + 1) number.

Once the hereditary base-(N + 1) number is calculated, take all the digits of the number in hereditary base-(N + 1) notation and do the following:

  • If N and K are both odd or even, add all digits together to get the final number.
  • Otherwise, take the sum of all digits equal to N + 1, and multiply it with the sum of all digits not equal to N + 1 to get the final number.
  • Modulo the result with 8,000 if the result is more than 8,000.
  • Ignore any digit 0 as it will not be used in any of the calculation.

The result will be the answer. Convert this result to non-hereditary base-K number and submitting it will solve the module.

Submitting an incorrect number will incur a strike.

Do not include any leading zeros in the solution. The module only considers numbers without leading zeros to be valid answers. Submitting any number with leading zeros (except the number 0 itself) will incur a strike in every case.

Appendix H: Hereditary Base-N notation

Normally, any non-hereditary base-N number can be written in the following way. If the number that we want to convert is X, then:

For example, 47 in base-3 is

A hereditary base-N notation imposes an additional requirement that every number, except the base of an exponent, must be less than the base itself. This means that each of the exponent must be converted into base-N number. If, after conversion, the exponent of an exponent is still greater than or equal to the base value N, this exponent must also be converted to a base-N number. Repeat this process until every digit that is not the base is less than the base itself.

For the purpose of zero ambiguity, 1 that are coefficients of the base to the power s and 1 that are the exponents of the base must be written explicitly. The term that contains base to the power of 0 will only have its coefficient written. For example, 3201 in hereditary base-4 is