Construction of Cyclic Numbers
Cyclic numbers can be constructed by the following procedure:
Let b be the number base (10 for decimal)
Let p be a prime that does not divide b.
Let t = 0.
Let r = 1.
Let n = 0.
loop:
- Let t = t + 1
- Let x = r · b
- Let d = int(x / p)
- Let r = x mod p
- Let n = n · b + d
- If r ≠ 1 then repeat the loop.
if t = p − 1 then n is a cyclic number.
This procedure works by computing the digits of 1 /p in base b, by long division. r is the remainder at each step, and d is the digit produced.
The step
- n = n · b + d
serves simply to collect the digits. For computers not capable of expressing very large integers, the digits may be outputted or collected in another way.
Note that if t ever exceeds p/ 2, then the number must be cyclic, without the need to compute the remaining digits.
Read more about this topic: Cyclic Number
Famous quotes containing the words construction of, construction and/or numbers:
“When the leaders choose to make themselves bidders at an auction of popularity, their talents, in the construction of the state, will be of no service. They will become flatterers instead of legislators; the instruments, not the guides, of the people.”
—Edmund Burke (17291797)
“The construction of life is at present in the power of facts far more than convictions.”
—Walter Benjamin (18921940)
“Out of the darkness where Philomela sat,
Her fairy numbers issued. What then ailed me?
My ears are called capacious but they failed me,
Her classics registered a little flat!
I rose, and venomously spat.”
—John Crowe Ransom (18881974)