Problem 60782. Convert integers from primary notation to base 10

The primary system of expressing numbers has three digits: m, x, and p, which correspond to -1, 0, and 1. The places in a primary number correspond to the prime numbers. For example, the number 6 could be ppm in primary notation because 6 = 5*1 + 3*1 + 2*(-1). Similarly, the number 20 could be ppxxp in primary notation.
Because integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a number can exist. Cody Problem 60783 deals with proper primary notation.
Write a function to convert integers expressed in primary notation to base 10.

Solution Stats

77.78% Correct | 22.22% Incorrect
Last Solution submitted on Jan 28, 2025

Solution Comments

Show comments

Problem Recent Solvers7

Suggested Problems

More from this Author291

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!