We can read each number as follows:
The number 0 is represented by nothing at all.
A single dash represents the number 1.
If there's no connector at the top, it's a prime power:
The prime index is found at the tip of the arc - read the number recursively, then move this many primes forwards. In the examples above, we see that the number 29 is encoded as p_9 because it's the tenth prime, number 2 being p_0.
The power is found at the bottom of the arc - also to be read recursively. In the examples above, we see that 27 is encoded as 3^3.
Composite numbers are encoded as the product of their primes factors, starting with the smallest prime. In this case, the prime indexes for subsequent primes start at the next prime after the one to the left of it. We can see it in number 15, which is encoded as p_1 * q_0.
As for the number the second image, it's
p_{3^2 * 11} = p_99 = ...
require 'prime'; Prime.take(100).last
... = 541