This problem is the companion to Cody Problem 60782. The proper primary system of expressing non-negative numbers has three digits: m, x, and p, which correspond to -1, 0, and 1. The places in a proper primary number correspond to the prime numbers. For example, the number 6 would be ppm in proper primary notation because . Similarly, the number 20 would be ppxxp in proper primary notation.
Because integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a non-negative number can exist. However, numbers in proper primary notation adhere to the following requirement: when m, x, and p are replaced with 0, 1, and 2, respectively, the resulting decimal number is minimal.
For instance, 5 can be represented as pp, pxx, and pxxm; since 22 is smaller than 211 or 2100, pp is the proper primary representation of 5. The number 12 can be represented as pxpp and ppxx; since 2122 is less than 2211, pxpp is the proper primary representation of 12. The number -15 can be represented as mmmx and mmxpx; since 1 is less than 121, mmmx is the proper primary representation of -15.
Write a function to convert non-negative integers in base 10 to proper primary notation.

Solution Stats

3 Solutions

3 Solvers

Last Solution submitted on Jan 09, 2025

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...