The 11th, 12th and 23rd day of a month can be called a φ-day (pronounced fy-day). Why so? Because those numbers are consecutive entries in the famous Fibonacci sequence, which offers better and better approximations to a mathematical constant called φ = (√5 + 1) / 2 = 1.6180339887498948…:
Each number after the second is the sum of the preceding two (so 11, 12, 23… could be the start of a similar sequence). When you divide fib(i) by fib(i-1), you get these approximations to φ:
Today is the 23rd and not just a φ-day but a Friday (or φriday). So here’s one of the interesting results I’ve recently found while playing with the Fibonacci sequence. As any recreational mathematician kno, you can also find the Fibonacci sequence — and φ — with this little algorithm:
“The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents.” So said HPL in “The Call of Cthulhu” (1926). But I’d still like to correlate the contents of mine a bit better. For example, I knew that φ, the golden ratio, is the most irrational of all numbers, in that it is the slowest to be approximated with rational fractions. And I also knew that continued fractions, or CFs, were a way of representing both rationals and irrationals as a string of numbers, like this:
But I didn’t correlate those two contents of my mind: the maximal irrationality of φ and the way continued fractions work.
That’s why I was surprised when I was looking at the continued fractions of 2..(n-1) / n for 3,4,5,6,7… That is, I was looking at the continued fractions of 2/3, 3/4, 2/5, 3/5, 4/5, 5/6, 2/7, 3/7… (skipping fractions like 2/4, 2/6, 3/6 etc, because they’re reducible: 2/4 = ½, 2/6 = 1/3, 3/6 = ½ etc). I wondered which fractions set successive records for the length of their continued fractions as one worked through ½, 2/3, 3/4, 2/5, 3/5, 4/5, 5/6, 2/7, 3/7… And because I hadn’t correlated the contents of my mind, I was surprised at the result. I shouldn’t have been, of course:
Which n1/n2 set records for the length of their continued fractions (with n2 > n1)? It’s the successive Fibonacci fractions, fib(i)/fib(i+1), of course. I didn’t anticipate that answer because I didn’t understand φ and continued fractions properly. And I still don’t, because I’ve been surprised again today looking at palindromic CFs like these:
Now it’s the successive Fibonacci skip-one fractions, fib(i)/fib(i+2), that set records for the length of their palindromic continued fractions. But I think you’d have to be very good at maths not to be surprised by that result.
After that, I continued to be compelled by the Call of CFulhu and started to look at the CFs of Fibonacci skip-n fractions in general. That’s contfrac(fib(i)/fib(i+n)) for n = 1,2,3,… And I’ve found more interesting patterns, as I’ll describe in a follow-up post.
It’s a very simple function that raises a very difficult question. An unanswered question, in fact. Take any whole number. If it’s odd, multiply it by 3 and add 1. If it’s even, divide it by 2. Repeat until you reach 1. That’s the hailstone function, because the numbers rise and fall like hailstones being formed in a cloud. Here are some examples:
But is this function truly a hailstone function? That is, does every number fall finally to earth and reach 1? So far, for every number tested, the answer has been yes. But do all numbers reach 1? The Collatz conjecture says they do. But no-one can prove it. Or disprove it. All it would take is one number failing to fall to earth. Mathematicians don’t think there is one, but numbers can take a surprising length of time to get to the ground. Here’s 27:
27 takes 111 steps to reach 1. And the 111 made me think of another question. If the function hail(n) returns the number of steps required for n to reach 1, then hail(27) = 111. But what about hail(n) = 666? That is, what is the first number that requires 666 steps to reach 1? I say “first number”, because one very big number is guaranteed to take 666 steps:
Put another way, 666 = hail(2^666), because for any power of 2, hail(2^p) = p. But is there a smaller number, which I’ll call satan, for which hail(satan) = 666? Here’s a tantalizing taster of the task:
Here’s a question I haven’t answered: if satanic numbers are those n satisfying hail(n) = 666, how many satanic numbers are there? We’ve already seen two of them: 666 = hail(2^666) = hail(26597116). But how many more are there? Not infinitely many, because for n > 2^666, hail(n) > 666. In fact, after satan = 26597116, the next three satanic numbers arrive very quickly:
So there are four consecutive satanic numbers. But it isn’t unusual for a run of consecutive numbers to have the same hail(). Here’s a graph of the values of hail(n) for n = 1,2,3… (running left-to-right, down-up, with 1,2,3… in the lower lefthand corner). When n is divisible by 10, hail(n) is represented in red; when n is odd and divisible by 5, hail(n) is green. Note how many runs of identical hail(n) there are:
Graph for hail(n)
Here are successive records for runs of identical hail(n):
To understand clock-arithmetic, simply picture a clock-face with one hand and a big fat 0 in place of the 12. Now you can do some clock-arithmetic. For example, set the hour-hand to 5, then move on 4 hours. You’ve done this sum:
5 + 4 → 9
Now try 9 + 7. The hour-hand is already on 9, so move forward 7 hours:
9 + 7 → 4
Now try 3 + 8 + 1:
3 + 8 + 1 → 0
And 3 * 4:
4 * 3 = 4 + 4 + 4 → 0
That’s clock-arithmetic. But you’re not confined to 12-hour clocks. Here’s a 7-hour clock, where the 7 is replaced with a 0:
Another name for clock-arithmetic is modular arithmetic, because the clocks model the process of dividing a number by 12 or 7 and finding the remainder or residue — 12 or 7 is known as the modulus (and modulo is Latin for “by the modulus”).
5 + 4 = 9 → 9 / 12 = 0*12 + 9
(5 + 4) modulo 12 = 9
3 + 8 + 1 = 12 → 12 / 12 = 1*12 + 0
(3 + 8 + 1) modulo 12 = 0
19 / 12 = 1*12 + 7
19 mod 12 = 7
3 + 1 = 4 → 4 / 7 = 0*7 + 4
(3 + 1) mod 7 = 4
2 + 4 + 1 = 7 → 7 / 7 = 1*7 + 0
(2 + 4 + 1) mod 7 = 0
19 / 7 = 2*7 + 5
19 mod 7 = 5
Modular arithmetic can do wonderful things. One small but beautiful example is the way it can uncover hidden fractals in Pascal’s triangle:
But you don’t need to consider those ever-growing numbers in the triangle when you’re finding fractals with modular arithmetic. When the modulus is 2, you just work with 0 and 1, that is, you add the previous numbers in the triangle and find the sum modulo 2. When the modulus is 4, you just work with 0, 1, 2 and 3, adding the numbers and finding the sum modulo 4. When it’s 8, you just work with 0, 1, 2, 3, 4, 5, 6 and 7, finding the sum modulo 8. And so on.
At least, I think it’s a fractal. I came across it when I was counting the ways in which the integers can be the sum of distinct Fibonacci numbers. Here for reference is the Fibonacci sequence, the beautiful and endlessly fertile sequence that’s seeded with “1, 1” and continued by summing the two previous numbers:
I also noticed a pattern relating to the maximum count reached in the numbers between the 1s. Suppose the function max(fib(i)-1..fib(i+1)-1) returns the highest count of ways to represent the numbers from fib(i)-1 to fib(i+1)-1. Notice how max() increases:
The pattern is described like this at the Online Encyclopedia of Integer Sequences:
a(n) = 1 if and only if n+1 is a Fibonacci number. The length of such a quasi-period (from Fib(i)-1 to Fib(i+1)-1, inclusive) is a Fibonacci number + 1. The maximum value of a(n) within each subsequent quasi-period increases by a Fibonacci number. For example, from n = 143 to n = 232, the maximum is 13. From 232 to 376, the maximum is 16, an increase of 3. From 376 to 609, 21, an increase of 5. From 609 to 986, 26, increasing by 5 again. Each two subsequent maxima seem to increase by the same increment, the next Fibonacci number. – Kerry Mitchell, Nov 14 2009
The maxima of the quasi-periods are in A096748. – Max Barrentine, Sep 13 2015 — See commentary for A000119 at OEIS
The red square represents 1, with 2 as the white block immediately to its right and 3 immediately above 2. Then 5 is the white block one space to the left of 3 and 7 the white block one space below 5. Then 11 is the white block right beside 2 and 13 the white block one space above 11. And so on. The primes aren’t regularly spaced on the spiral but patterns are nevertheless appearing. Here’s the Ulam spiral at higher resolutions:
The Ulam spiral x2
The Ulam spiral x4
The primes are neither regular nor random in their distribution on the spiral. They stand tantalizingly betwixt and between. So the numbers represented on this Ulam-like spiral, which looks like an aerial view of a city designed by architects who occasionally get drunk:
Ulam-like spiral of abundant numbers
The distribution of abundant numbers is much more regular than the primes, but is far from wholly predictable. And what are abundant numbers? They’re numbers n such that sum(divisors(n)-n) > n. In other words, when you add the divisors of n less than n, the sum is greater than n. The first abundant number is 12:
Are all abundant numbers even? No, but the first odd abundant number takes a long time to arrive: it’s 45045. The abundance of 45045 was first discovered by the French mathematician Charles de Bovelles or Carolus Bovillus (c. 1475-1566), according to David Wells in his wonderful Penguin Dictionary of Curious and Interesting Numbers (1986):
Here’s the spiral of abundant numbers at higher resolutions:
Abundant numbers x2
Abundant numbers x4
Negating the spiral of the abundant numbers — almost — is the spiral of the deficient numbers, where sum(divisors(n)-n) < n. Like most odd numbers, 15 is deficient:
15 = 3 * 5 → 1 + 3 + 5 = 9 < 15
Here’s the spiral of deficient numbers at various resolutions:
Deficient numbers on Ulam-like spiral
Deficient numbers x2
Deficient numbers x4
The spiral of deficient numbers doesn’t quite negate (reverse the colors of) the spiral of abundant numbers because of the very rare perfect numbers, where sum(divisors(n)-n) = n. That is, their factor-sums are exactly equal to themselves:
Now let’s try numbers n such than sum(divisors(n)) mod 2 = 1 (“n mod 2″ gives the remainder when n is divided by 2, i.e. n mod 2 is either 0 or 1). For example:
There’s not a circle in sight, so you wouldn’t expect to find π amid the pyramids. But it’s there all the same. You can get π from this formula using the square pyramidal numbers:
π from a formula using square pyramidal numbers (Wikipedia)
Here are the approximations getting nearer and near to π:
It’s obvious that the sequences are different at each successive step: 1 ≠ 15, 3 ≠ 31, 6 ≠ 48, 10 ≠ 66, 21 ≠ 85, and so on. But seven numbers occur in both sequences: 15, 66, 105, 171, 561, 1326 and 5460. And that’s it — 7 is the 14-th entry in A309507 at the Encyclopedia of Integer Sequences:
I decided to take create graphs of shared numbers in compared sequences like this. In the 135×135 grid below, the brightness of the squares corresponds to the count of shared numbers in the sequence-pair sum(x..x+n) and sum(y..y+n), where x and y are the coordinates of each individual square. I think the grid looks like a city of skyscrapers bisected by a highway:
Count of shared numbers in sequence-pairs sum(x..x+n) and sum(y..y+n)
Note that the bright white diagonal in the grid corresponds to the sequence-pairs where x = y. Because the sequences are identical in each pair, the count of shared numbers is infinite. The grid is symmetrically reflected along the diagonal because, for example, the sequence-pair for x=12, y=43, where sum(12..12+n) is compared with sum(43..43+n), corresponds to the sequence pair for x=43, y=12, where sum(43..43+n) is compared with sum(12..12+n). The scale of brightness runs from 0 (black) to 255 (full white) and increases by 32 for each shared number in the sequence. Obviously, then, the brightness can’t increase indefinitely and some maximally bright squares will represent sequence-pairs that have different counts of shared pairs.
Now try altering the size of the step in brightness. You get grids in which the width of the central strip increases (smaller step) or decreases (bigger step). Here are grids for steps for 1, 2, 4, 8, 16, 32 and 64 (I’ve removed the bright x=y diagonal for the first few grids, because it’s too prominent against duller shades):
12 is an interesting number in a lot of ways. Here’s one way I haven’t seen mentioned before:
12 = 3^1 * 2^2
The digits of 12 represent the powers of the primes in its factorization, if primes are represented from right-to-left, like this: …7, 5, 3, 2. But I couldn’t find any more numbers like that in base 10, so I tried a power flip, from right-left to left-right. If the digits from left-to-right represent the primes in the order 2, 3, 5, 7…, then this number is has prime-power digits too:
I haven’t found any more left-to-right prime-power digital numbers in base 10, but there are more in other bases. Base 5 yields at least three (I’ve ignored numbers with just two digits in a particular base):
When I searched for 81312000 at the Online Encyclopedia of Integer Sequences, I discovered that these are Meertens numbers, defined at A246532 as the “base n Godel encoding of x [namely,] 2^d(1) * 3^d(2) * … * prime(k)^d(k), where d(1)d(2)…d(k) is the base n representation of x.”
Even if you can’t work out the full rule generating the sequence, you may be able to deduce that the next number is… 51. There’s a pattern involving 0:
The first number after each 0 is 1 more than the first number before the 0. The second number after the 0 is equal to 2 * (first-number-after 0) + 1. So:
The sum of the first two integers (1+2) equals the next integer (3). The sum of the next three integers (4+5+6) equals the sum of the next two integers (7+8). The sum of the next four integers (9+10+11+12) equals the sum of the next three integers (13+14+15). And so on. The sequence is based on an adaptation of that pattern:
If you work out the partial sums of the additions and subtractions, you get the sequence I started with, which regularly rises to a new high, then falls back to 0:
When you represent the numbers of the sequence on an Ulam-like spiral, you get this pattern of lines (and zigzags) against a haze of less regular points:
I’ll call the lines spiral artefacts. I don’t know what generates all of them, but the zigzag diagonal from top left to bottom right is partly created by the square numbers. Here’s the spiral at higher resolutions:
Spiral for pos2neg1 (x2)
Spiral for pos2neg1 (x4)
You’ll find more of the lines if you look at Ulam-like spirals for adaptations of the original sequence. Suppose you add the first three integers, then take away the next two, then add the next four integers, then take away the next three, and so on: 1 + 2 + 3 – 4 – 5 + 6 + 7 + 8 + 9 – 10 – 11 – 12 + 13 + 14… Here are the partials sums of these additions and subtractions:
If the original sequence is pos2neg1 (add first two integers, take away next one integer, etc), this adapted sequence is pos3neg2 (add first three integers, take away next two, etc). Here’s the spiral for pos3neg2 (with negative numbers represented as positive):
Note that the spiral is incomplete and some of the lines not fully extended, because the lines are easier to see when the sequence doesn’t carry on too long and clutter the screen. Here are more adapted sequences shown on Ulam-like spirals (again, some of the spirals are incomplete):