# Mysterius semiprime fact in other number bases

So you have a semiprime n
n = p*q where p < q

A curious fact about bases is that if a number x ends with a zero in base y, then x is divisible by y. Therefor, if we where to represent n in all bases from 2 to n, then n would only end with a zero in base p, q and n.

Bellow is n represented in all the bases from n and downwards:  10 ... p0 ... 11x ... 1(q-p)0 ... 

• The first entry is n in base n
• The second entry is base q. In base q, n would end with a zero and the first digit would be digit number p
• The third entry is the point where we go from 2 to 3 digits. I don't know what x is
• The forth entry is base p. For some reason, if n is a semiprime then the second digit will be digit number (q-p)
• Between the first and the second entry, the first digit is going to increment in a curve that is very flat at the beginning, and very steep towards the end

Can anyone explain why the second digit of n represented in base p is equal to q-p?

• I think that the "curious fact about bases" is actually a very basic fact. No pun intended. – Robert Soupe Jan 24 '16 at 3:25

If you divide $n$ by $p$, you obtain remainder $0$ (this is the last digit) and the quotient is $q$.
Now, if you divide $q$ by $p$, the remainder is $q-p$ only when $q<2p$, so the conclusion is, generally speaking, false, but it is true when $p<q<2p$.
For example, if $p=3$ and $q=7$, $pq$ in base $p$ is $210$ and $1\neq7-3$.
The second digit is not necesarily equal to $q-p$. For example, if $n=14$, you have $p=2$, $q=7$, and then $n$ in base $p$ is equal to $1110$, which is a four digit number, and if you have $n=21$, you have $p=3$, $q=7$, and then $n$ in base $p$ is $210$, even though $7-3=4$.