Packages

p

root package

package root

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Value Members

  1. object ABCDEFGHPPP

    Problem: (ABCD = EF) + GH = PPP

    Problem: (ABCD = EF) + GH = PPP

       AB
     - CD
    -----
       EF
     + GH
    -----
      PPP
    

    The values for A, B, C, D, E, F, G, H, and P are distinct and in the range of [0, 9].

    It is not possible to sum two numbers and get zero, unless they are also zero, so P can't be zero.

    The two-digit numbers should be actual two-digit numbers, so A, C, E, G cannot be 0.

    Example:

    ABCDEFGHPPP.solve(10) // Decimal

    It's possible to solve for other base number systems than just decimal:

    ABCDEFGHPPP.solve(16) // Hex system

    However, a brute-force heuristic is used, so complexity severely limits the capability to solve bases larger than 16.

    There is an important optimization available for filtering out possible solutions based on the following assumptions about P:

    1. PPP can't be 000, by adding two 2-digit numbers.
    2. PPP can't be 222 or greater, by subtracting two 2-digit numbers.
    3. PPP can't be anything else, so PPP can only be 111.
  2. object Main

    Command-line driver of ABCDEFGHPPP problem.

Ungrouped