Friday, 14 February 2020

House Numbers

When turning 25884 days old today, I discovered that 25884 is a house number. This was new to me and not surprising because the previous such number was 23101. I turned 23101 days old over 7.6 years ago. So I needed to discover what house numbers are. They are named not after some mathematician named House but because they can be represented as houses. A diagram is helpful at this point. See Figure 1.


Figure 1

Clearly such numbers are figurate but consist of two conjoined shapes: a cube on top of which sits a square-based pyramid. Here a definition from Numbers Aplenty:

The \(n\)-th house number \(h_n\) is a figurate number made by a cube of side \(n+1\), surmounted by a square pyramidal number with side \(n\), thus:$$h_n = (n+1)^3 + \sum_{k=1}^nk^2$$An alternative way of representing this is as: $$h_n=\frac{8n^3+21n^2+19n+6}{6}$$The generating function for this sequence is:$$\frac{1+5x+2x^2}{(x-1)^4}$$In Figure 2, the SageMath code is shown that makes use of this function to generate the coefficients of the polynomial that are the terms of the sequence (the output is truncated for display purposes):


Figure 2: permalink

Figure 3 shows the SageMath code to generate the coefficients by themselves, removed from the polynomial. The output has been truncated to fit the display. These are the house numbers. The sequence of house numbers forms  OEIS A051662. Below is the list of terms, up to and including 25884:

1, 9, 32, 78, 155, 271, 434, 652, 933, 1285, 1716, 2234, 2847, 3563, 4390, 5336, 6409, 7617, 8968, 10470, 12131, 13959, 15962, 18148, 20525, 23101, 25884, ...

Figure 3: permalink

The next house number is 28882, so it's quite some way off. There's nothing very deep about house numbers but they form an interesting variation on the figurate numbers that I'm familiar with. They are the sum of two different and independent figurate numbers that have been combined to form a composite shape, in this case a house. There's no reason that one couldn't combine other shapes together from these or different components.

For example, adding a square-based triangular pyramid to each of the six faces of the cube would produce a sort of stellated cube. The formula would be:$$h_n = (n+1)^3 + 6 \sum_{k=1}^nk^2$$ADDENDUM: May 7th 2020

Today I turned 25967 days old and this number turns out to be a 24-hedral number with formula:$$(2n + 1)(8n^2 + 14n + 7) \text{ where }n=11$$It can be considered as being made up out of a central cube and six square pyramids. The central cube number is given by OEIS A016755:$$CCub(n) = (2n + 1)^3$$The figurate number represented by the square pyramids is given by OEIS A000447:$$ P^{(4)}(n) = \frac{(1 + n)(1 + 2n)(3 + 2n)}{3}$$Therefore, for our 24-hedral number, we have:$$24H(n) = CCub(n) + 6P^{(4)}(n)$$ $$24H(n)=(2n+1)^3 + \frac{6(1+n)(1+2n)(3+2n)}{3}$$ $$24H(n)= (2n+1)(8n^2 +14n+7)$$Figure 4 shows the example for when \(n=11\):

Figure 4: link

Saturday, 25 January 2020

The Möbius Function and Mertens Function

I had come across the Möbius function before but didn't see it as all that important. However, I was reminded of it recently when I encountered a Numberphile video on Mertens conjecture (uploaded 23rd January 2020).


In number theory, we define the Mertens function as:$$M(n) = \sum_{1\le k \le n} \mu(k)$$where \( \mu (k)\) is the Möbius function. The Mertens conjecture is that for all \(n > 1\): $$\left| M(n) \right| < \sqrt { n }$$To quote from Wikipedia:
In mathematics, the Mertens conjecture is the disproven statement that the Mertens function \(M(n)\) is bounded by \( \sqrt {n}\), which implies the Riemann hypothesis. It was conjectured by Thomas Joannes Stieltjes in an 1885 letter to Charles Hermite (reprinted in Stieltjes (1905)) and Franz Mertens (1897), and disproved by Andrew Odlyzko and Herman te Riele (1985). It is a striking example of a mathematical proof contradicting a large amount of computational evidence in favour of a conjecture.
I set about writing a program in SageMath to plot the first million values of the Mertens function. I managed to execute it in SageMathCell but the code was clunky as I had to get the program to determine the values of -1, 0 and 1 based on the factorisation. Later I realised that the Möbius function would replace the need for this. In SageMath, the spelling is moebius and moebius(1) --> 1 etc. So let's define the Möbius function:

For any positive integer n, \(μ(n)\) has values in {−1, 0, 1} depending on the factorisation of \(n\) into prime factors:$$\mu(n) =
  \begin{cases}
    1       & \quad \text{if } n \text{ is a square-free positive integer with an even number of prime factors}\\
   -1  & \quad \text{if } n \text{ is a square-free positive integer with an odd number of prime factors}\\
0  & \quad \text{if } n \text{ has a squared prime factor}
  \end{cases}$$Figure 1 shows the results of plotting the first one million values of the Möbius function. Here is the permalink to the SageMathCell calculation.

Figure 1

The square root of \( \pm \) 1,000,000 is \( \pm \) 1,000 and as can be seen the function is well within those bounds. However, as mentioned earlier, the bounds are eventually exceeded. Sometimes, instead of \(M(n) \), the function \(m(n) \) is used where:$$m(n)=\frac{M(n)}{\sqrt{n}}$$For the Mertens conjecture to hold, the following condition would be necessary: \(-1 <m(n)<1\). However, for enormously large values of \(n\), it has been shown that \(m(n)<-1.837625 \) and \(m(n)>1.826054\) are possible.

Saturday, 18 January 2020

Proth Numbers

Today I turned 25857 days old and was surprised to come across a number property in Numbers Aplenty that I hadn't encountered before. Or so I thought. The property referred to Proth Numbers and the previous such number was 25601 that occurred on May 7th 2019. On that occasion, I'd chosen to ignore it for whatever reason.

Proth numbers are named after a French mathematician François Proth (1852–1879). He was a French self-taught mathematician farmer who lived near Verdun, France. He doesn't earn an entry in the MacTutor History of Mathematics archive. However, David Wells mentions him in his book Prime Numbers: The Most Mysterious Figures in Math. Figures 1 and 2 contain the reference:

Figure 1
He continues on the next page:

Figure 2

In the case of 25857, the number can be represented as \( 101 \times 2^8 + 1 \) but it is not prime because it factorises to \( 3^2 \times 13^2 \times 17 \). The previous Proth number 25601 however, is a Proth prime and can be represented as \( 25 \times 2^{10}+1 \). I downloaded the proth.exe program referred to in Wells' book and ran it on my Mac using Wine. The program hasn't been updated since May of 2004 but it still does the job. A result, identifying 25601 as a prime, is shown in Figure 3:

Figure 3

The \( a =19\) refers to the fact that when N is prime, then:$$ a^{\frac{N-1}{2}}+1 \equiv 0 \mod{N}$$So when \(N = 25601\) we have:$$ 19^{\frac{25601-1}{2}}+1 \equiv 0 \mod{25601}$$The Wikipedia page on Proth primes has some interesting references including the following in reference to the primality test:
This test is a Las Vegas algorithm: it never returns a false positive but can return a false negative; in other words, it never reports a composite number as "probably prime" but can report a prime number as "possibly composite".
The Wikipedia link to the Las Vegas algorithm states that:
Las Vegas algorithms were introduced by László Babai in 1979, in the context of the graph isomorphism problem, as a dual to Monte Carlo algorithms. Babai introduced the term "Las Vegas algorithm" alongside an example involving coin flips: the algorithm depends on a series of independent coin flips, and there is a small chance of failure (no result). However, in contrast to Monte Carlo algorithms, the Las Vegas algorithm can guarantee the correctness of any reported result.
The next Proth number after today's 25857 is 26113 and it is also a Proth prime with \(a=7\). This will occur on Wednesday, September 30th 2020. Thus:$$7^{\frac{26113-1}{2}}+1 \equiv 0 \mod{26113}$$

Saturday, 21 December 2019

The Original Taxi Cab Number in a New Light

Today I turned 25829 days old and, amongst the number's many different properties, one in particular caught my eye. The property was that it is a member of OEIS A262054: Euler pseudoprimes to base 7: composite integers such that:$$ |7^{(n-1)/2}| \equiv 1 \pmod {n}$$Now there's no sign of 1729, the original taxi cab number, but we'll get there. Firstly however, how did 1729 earn its sobriquet? Here an excerpt from Wikipedia:
The name is derived from a conversation in about 1919 involving mathematicians G. H. Hardy and Srinivasa Ramanujan. As told by Hardy: 
"I remember once going to see him [Ramanujan] when he was lying ill at Putney. I had ridden in taxi-cab No. 1729, and remarked that the number seemed to be rather a dull one, and that I hoped it was not an unfavourable omen. "No," he replied, "it is a very interesting number; it is the smallest number expressible as the sum of two [positive] cubes in two different ways."
Figure 1

The two different ways are: \(1^3 + 12^3\) and \(9^3 + 10^3\).

I won't go further into taxicab numbers here as the Wikipedia article explains things well enough. What I want to do is cast a new light on 1729, the number that Hardy originally thought was a rather dull number. The light I'm casting comes from the Euler pseudoprimes. 

I've already discussed pseudoprimes in two earlier posts: Fermat Pseudoprimes and Carmichael Numbers. I did make make passing mention of Euler pseudoprimes in the former post but didn't go into the matter further. Figure 1 shows a screenshot of part of what Wikipedia has to say about Euler pseudoprimes. 

The excerpt in Figure 1 concludes with the observation that:
The absolute Euler pseudoprimes are a subset of the absolute Fermat pseudoprimes, or Carmichael numbers, and the smallest absolute Euler pseudoprime is 1729 = 7×13×19.
It's surprising then that a mathematician of Hardy's calibre should not have recognised 1729 as having quite some claim to fame. In fact, the Online Encyclopaedia of Integer Sequences (OEIS) has 794 entries for the number so it is far from dull. Let's consider some of the other entries for 1729 in the OEIS. 

One entry is not surprising when the factorisation of 1729 is considered and the factors are arranged in descending order: 19 x 13 x 7. Let's add a 1 to give 19 x 13 x 7 x 1. The numbers 19, 13, 7 and 1 form an arithmetic sequence and this shows 1729 to be a so-called sextuple factorial. This can be written as 19!!!!!! or 19!6.

1729 counts the ways that a 2 x 2 matrix can be populated with integers from -7 to +7 in such a way that every matrix is singular (that is has a determinant of zero). It thus forms part of OEIS A209981

Figure 2: 35 points in a body-centered cubic lattice, 
forming two cubical layers around a central point

In the realm of figurate numbers, 1729 is a centred cube number. These are numbers of the form:\((n+1)^3+n^3\) and of course 1729 can be written as \(10^3+9^3\). Figure 2 shows the example of the centred cube number 35 and Wikipedia explains:
A centred cube number is a centred figurate number that counts the number of points in a three-dimensional pattern formed by a point surrounded by concentric cubical layers of points, with \(i^2\) points on the square faces of the \(i\)-th layer. Equivalently, it is the number of points in a body-centred cubic pattern within a cube that has \(n + 1\) points along each of its edges. 
The first few centred cube numbers are:
1, 9, 35, 91, 189, 341, 559, 855, 1241, 1729, 2331, 3059, 3925, 4941, 6119, 7471, 9009, ... (sequence A005898 in the OEIS).
1729 is also an heptagonal number, a 12-gonal or dodecagonal number, a 24-gonal or icosotetragonal number but that's probably enough for the moment.

Tuesday, 10 December 2019

Mathematics in Everyday Life

How many times have I opened a box of tissues by removing the elliptical cover on the top of the box? Every time I do it, I'm aware of its elliptical shape but I never paused to consider the resulting ellipse of cardboard that I held in my hand. It would be discarded as rubbish. Today however, I paused and really looked at what I had in my hand (see Figure 1).

Figure 1

There's even a little semi-circular tab on the right that can be depressed to facilitate the removal of the cover. I'd never noticed that before. Turning the cardboard ellipse over reveals blank cardboard on which I marked in the major and minor axes and measured their lengths, to the nearest millimetre (see Figure 2).

Figure 2

These measurements enable calculation of the eccentricity \(e\) of the ellipse and so in this case, with \(a=28\) and \(b=62.5\) where \(a\) and \(b\) are the lengths of the semi-minor and semi-major axes respectively, we have:$$e=\sqrt {1-\frac{a^2}{b^2}}=\sqrt {1-\frac{28^2}{62.5^2}} \approx 0.894$$This of course is highly elliptical, especially if it's compared with the eccentricities of the planets of the solar system (see Figure 3).



Figure 3

As can be seen in Figure 3, Mercury and Pluto have the most eccentric orbits but much less eccentric than my cardboard ellipse. The other planets have elliptical orbits that would be hard to distinguish from circles if their proportions were displayed on a cardboard cut-out similar to that shown in Figure 2. Coincidentally, there is a centaur with an eccentricity of 0.894 as the table shown in Figure 4 reveals. The academic paper that the table was taken from is quite an interesting but I won't go into here but this is the link, the same as the one shown in Figure 4.


Figure 4

As explained in Figure 4, centaurs are planetesimals with perihelia (closest distance to the Sun) exterior to the orbit of Jupiter and aphelia (farthest distance from the Sun) interior to the orbit of Neptune. The most famous of the centaurs in Chiron, the first to be discovered in 1977 but the somewhat less famous C/2012 H2 (McNaught) does have an orbit that exactly matches that of the cardboard ellipse shown in Figures 1 and 2. Figure 5 provides a little more information about this object.

Figure 5

To calculate the length \(F\) from the centre of the ellipse to the two foci, the following formula can be used involving once again the lengths of the semi-minor and semi-major axes:$$F=\sqrt{b^2-a^2}=\sqrt{62.5^2-28^2} \approx 55.9$$These foci for the cardboard ellipse are shown in Figure 6.


Figure 6

The mathematics in this post is very basic but that was my intention. Though basic, the shape of the cardboard ellipse is nonetheless reflected in the shape of a particular centaur's orbit and it's pretty cool to find a connection between an everyday household item and the solar system in which we are immersed.

Monday, 25 November 2019

The Goldbach Conjecture and Lucky Numbers

I've written before about Lucky Numbers (Generating Lucky Numbers in Python and Lucky Numbers) as well as the Goldbach Conjecture (Goldbach's Conjecture and Zeckendorf's Theorem and Goldbach's Conjecture Revisited) but now it's time to combine the two topics. The reason we can do this is that primes and lucky numbers have similar distributions. The table in Figure 1 attests to this:
Figure 1: source URL

As stated on the site from which the table was taken:
What's most interesting about lucky numbers is the fact that they share a lot of properties with primes. As can be seen from the next table the density of the lucky numbers is close to the density of the primes. This seems also be true for the density of the twin luckies and the twin primes. In addition a lot of conjectures about primes seem also to be true for the luckies. For example one of the most famous ones, the Goldbach conjecture, stating that each even integer is the sum of at most two primes seems also to be true.
Goldbach decompositions are numerous and so, as with the decomposition into primes, we are interested in the minimal decomposition but first let's state the Goldbach conjecture for lucky numbers:

Every even number can be expressed as a sum of two lucky numbers

The smallest even number is 2 and that can expressed as 1 + 1. This is a little different to the primes where 1 is not regarded as a prime. Thus the Goldbach Conjecture for primes requires the even number to be greater than 2. The next even number is 4 and that can be expressed as 1 + 3 and so on. Let's take a number like 25800 and find it's minimal decomposition using SageMath. Figure 2 depicts the results using a screenshot from SageMathCell (permalink).

Figure 2: permalink

An interesting observation made on the website is that "no lucky number can have a digital root of 2, 5 and 8. This fact can sometimes be used to determine quickly that a given number is not lucky." I was able to find an explanation of why this is so thanks to a reference in Gardner's Workout by Martin Gardner. This is shown in Figure 3.

Figure 3

To see this, consider \(\frac{3k+2}{9}\). If \(k=1\) then the remainder is 5, if \(k=2\) then the remainder is 8, if \(k=3\) then the remainder is 2 and so on. The only remainders that can occur are 2, 5 and 8.

1 2 3 4 5 6 7 8 9
1 x 3 x 5 x 7 x 9 : first step of sieving process, all multiples of 2 are removed
1 x 3 x x x 7 x x : second step of sieving process, all multiples of 5 are removed

It is this sieving process, similar to the Sieve of Eratosthenes that causes the lucky numbers to have properties similar to the primes.

There are lots more "extensions" to the original Goldbach conjecture. One such one is the ternary Golbach conjecture described in the following abstract of a 79 page paper presented in 2014:
THE TERNARY GOLDBACH CONJECTURE IS TRUE
H. A. HELFGOTT 
Abstract. The ternary Goldbach conjecture, or three-primes problem, asserts that every odd integer n greater than 5 is the sum of three primes. The present paper proves this conjecture. 
Both the ternary Goldbach conjecture and the binary, or strong, Goldbach conjecture had their origin in an exchange of letters between Euler and Goldbach in 1742. We will follow an approach based on the circle method, the large sieve and exponential sums. Some ideas coming from Hardy, Littlewood and Vinogradov are reinterpreted from a modern perspective. While all work here has to be explicit, the focus is on qualitative gains. 
The improved estimates on exponential sums are proven in the author’s papers on major and minor arcs for Goldbach’s problem. One of the highlights of the present paper is an optimized large sieve for primes. Its ideas get reapplied to the circle method to give an improved estimate for the minor-arc integral.
A certain Zoltan Galantai has also investigated generalisations to the Goldbach conjecture at this site

Saturday, 23 November 2019

Cyclic Numbers

To quote from the source of all wisdom, Wikipedia:
A cyclic number is an integer in which cyclic permutations of the digits are successive integer multiples of the number. The most widely known is the six-digit number 142857, whose first six integer multiples are 
142857 × 1 = 142857
142857 × 2 = 285714
142857 × 3 = 428571
142857 × 4 = 571428
142857 × 5 = 714285
142857 × 6 = 857142
To qualify as a cyclic number, it is required that consecutive multiples be cyclic permutations. Thus, the number 076923 would not be considered a cyclic number, because even though all cyclic permutations are multiples, they are not consecutive integer multiples: 
076923 × 1 = 076923
076923 × 3 = 230769
076923 × 4 = 307692
076923 × 9 = 692307
076923 × 10 = 769230
076923 × 12 = 923076 
If leading zeros are not permitted on numerals, then 142857 is the only cyclic number in decimal, due to the necessary structure given in the next section. Allowing leading zeros, the sequence of cyclic numbers begins: 
(\(10^6-1\)) ÷ 7 = 142857 (6 digits)
(\(10^{16}-1\)) ÷ 17 = 0588235294117647 (16 digits)
(\(10^{18}-1\)) ÷ 19 = 052631578947368421 (18 digits)
(\(10^{22}-1\)) ÷ 23 = 0434782608695652173913 (22 digits)
(\(10^{28}-1\)) ÷ 29 = 0344827586206896551724137931 (28 digits)
However, it was in the realm of repeating decimals that I first encountered cyclic numbers. Specifically, I was looking at OEIS entries for 25801, a number representing my diurnal age at the time of composing this blog post, and I came across this entry:
A056215: primes \(p\) for which the period of reciprocal = \( \displaystyle \frac{p-1}{10} \) 
281, 521, 1031, 1951, 2281, 2311, 2591, 3671, 5471, 5711, 6791, 7481, 8111, 8681, 8761, 9281, 9551, 10601, 11321, 12401, 13151, 13591, 14831, 14951, 15671, 16111, 16361, 18671, 21191, 21521, 21881, 24281, 24551, 25391, 25801, ...
Sure enough, when I checked on SageMathCell, the period of this reciprocal is indeed 2580 (see Figure 1):

Figure 1: permalink

After 2580 decimal places, the digits do repeat (shown in red):

0.0000387581876671446843145614511065462578969807371807294290918956629588000465098252005736211774737413278555094763768846168753149102747955505600558117902406883454129684895934266113716522615402503778923297546606720669741482888260144955621875121119336459827138483004534707957055928064803689779465912173946746250145343203751792566179605441649548467113677764427735359094608736095500174411844502151079415526529979458160536413317313282430913530483314600209294213402581295298631835975349792643695980775938917096236579977520251153056083097554358358203170419751172435176931126700515483895973024301383667299717065230029843804503701406922212317352040618580675167629161660400759660478276035812565404441688306654780822448742296810201154993992480911592573931242975078485330025967985736986938490756172241385992790977093911088717491570094182396031161582884384326188907406689663191349172512693306460989884113018875237393899461261191426688888027595829619007015231967753187860935622650284872679353513429712026665633114995542808418278361303825433122747180341847215224216115654431998759737994651370101934033564590519747296616410216658269059338785318398511685593581644122320840277508623696755939692259989922871206542382078214022712297972946785008333010348436107127630711987907445447850858493856827254757567536142009999612418123328553156854385488934537421030192628192705709081043370411999534901747994263788225262586721444905236231153831246850897252044494399441882097593116545870315104065733886283477384597496221076702453393279330258517111739855044378124878880663540172861516995465292042944071935196310220534087826053253749854656796248207433820394558350451532886322235572264640905391263904499825588155497848920584473470020541839463586682686717569086469516685399790705786597418704701368164024650207356304019224061082903763420022479748846943916902445641641796829580248827564823068873299484516104026975698616332700282934769970156195496298593077787682647959381419324832370838339599240339521723964187434595558311693345219177551257703189798845006007519088407426068757024921514669974032014263013061509243827758614007209022906088911282508429905817603968838417115615673811092593310336808650827487306693539010115886981124762606100538738808573311111972404170380992984768032246812139064377349715127320646486570287973334366885004457191581721638696174566877252819658152784775783884345568001240262005348629898065966435409480252703383589783341730940661214681601488314406418355877679159722491376303244060307740010077128793457617921785977287702027053214991666989651563892872369288012092554552149141506143172745242432463857990000387581876 ...

Now the Wikipedia article states that:
If the digital period of \( \displaystyle \frac{1}{p}\) where \(p\) is prime is \(p − 1\), then the digits represent a cyclic number.
That clearly isn't the case with 25801. However, in the comments to the OEIS entry, it states:
Cyclic numbers of the tenth degree (or tenth order): the reciprocals of these numbers belong to one of ten different cycles. Each cycle has the following number of digits: 
\( \displaystyle \frac{number- 1}{10} \)
So 25801 is not a prime that produces a cyclic number. The nearest smaller prime that does this is 25793 and the nearest larger prime that does this is 25847. The primes that produce cyclic numbers are known as reptend primes. In this regard, Wikipedia states that:
Cyclic numbers are related to the recurring digital representations of unit fractions. A cyclic number of length \(L\) is the digital representation of: 
\(\displaystyle \frac{1}{L + 1} \)
Conversely, if the digital period of \( \displaystyle \frac{1} {p} \), where \(p \) is prime, is \(p-1\), then the digits represent a cyclic number. 
For example: 
\( \displaystyle \frac{1}{7}\) = 0.142857 142857…. 
Multiples of these fractions exhibit cyclic permutation: 

\( \displaystyle \frac{1}{7}\) = 0.142857 142857…


\( \displaystyle \frac{2}{7}\) = 0.285714 285714…


\( \displaystyle \frac{3}{7}\) = 0.428571 428571…


\( \displaystyle \frac{4}{7}\) = 0.571428 571428…


\( \displaystyle \frac{5}{7}\) = 0.714285 714285…


\( \displaystyle \frac{6}{7}\) = 0.857142 857142….


Checking reveals the nearby primes to 25801, namely 25793 and 25847, do have periods of 25792 and 25846 respectively. These periods are decimal maximal periods, the maximum length that a repeating decimal of this form can have. See Figure 2.

Figure 2: permalink

I accidentally typed in 258487 when checking and it turns out that the period of its reciprocal is 258486 and so it is a reptend prime as well. However, as stated earlier, 25801 is not a reptend but is regarded as a cyclic number of the tenth degree or tenth order. The terminology can get confusing. Let's start again with the reptend primes. These are also referred to as long period primes and form part of a categorisation involving different values of \(k\):$$\text{Primes }p \text{ such that the period of }\displaystyle \frac{1}{p} \text{ is } \displaystyle \frac{p-1}{k} \text{ where }k=1,2,3,4, ...$$The sequences generated by applying these formulae are listed in the cross references for the original OEIS A056215 entry:
A006883A097443A055628A056157A056210A056211A056212A056213A056214A056215A056216A056217A098680, which are sequences of primes \(p \) where the period of the reciprocal is \( \displaystyle \frac{p-1}{k}\) for \(k=1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13\) respectively.
So I think my confusion has been clarified. It is only when \(k=1\) that the reciprocal produces a cyclic number. The Wikipedia goes on to state that:
From the relation to unit fractions, it can be shown that cyclic numbers are of the form of the Fermat quotient:$$ \displaystyle \frac {b^ {\,p-1}-1}{p}$$ where \(b\) is the number base (10 for decimal), and \(p\) is a prime that does not divide \(b\). Primes \(p\) that give cyclic numbers in base \(b \) are called full reptend primes or long primes in base \(b\). 
For example, the case \(b = 10\), \(p = 7\) gives the cyclic number 142857, and the case \(b = 12\), \(p = 5\) gives the cyclic number 2497. 
Not all values of \(p\) will yield a cyclic number using this formula; for example, the case \(b = 10\), \(p = 13\) gives 076923076923, and the case \(b = 12\), \(p = 19\) gives 076B45076B45076B45. These failed cases will always contain a repetition of digits (possibly several).
I won't go into the other number bases here and I haven't followed up on the link to Fermat primes. Here is a Numberphile YouTube video about cyclic numbers:


The video highlights how some of the formulae arise. For example:$$ \begin{align}\frac{1}{7} &=0.142857142857142857142857 ... \\
10^6 \times \frac{1}{7} &=142857.142857142857142857142857 ... \\
\frac{10^6}{7}-142857 &=0.142857142857142857142857 ...\\
\frac{10^6}{7}-142857 &=\frac{1}{7} \\
142857&=\frac{10^6-1}{7}\\
\end{align}$$Interestingly, there is even a reference to Gurdjieff in this video because the number 142857 features in his enneagram as shown in Figure 3.

Figure 3: 

As explained in Wikipedia:
The Fourth Way enneagram is a figure published in 1949 in In Search of the Miraculous by P.D. Ouspensky, and an integral part of the Fourth Way esoteric system associated with George Gurdjieff. The term "enneagram" derives from two Greek words, ennea (nine) and gramma (something written or drawn).
I won't further into that here as this blog focuses purely on Mathematics but I may follow up on it in my other blogs.

on February 27th 2021