Formulas Focal to the Flesh

Here’s an interesting formula:

fr(1) = 1/2; mx = 3
fr(i) = fr(i-1) + 1/fr(i-1)
if fr(i) > mx, fr(i) = fr(i) – mx

Early terms look like this:

0.5, 2.5, 2.9, 3.244827586…, 4.329334628…, 2.081590666…, 2.561992513…, 2.952313716…, 3.291031107…, 3.727089920…, 2.102435627…, 2.578074447…, 2.965960841…, 3.303119709…, 3.602146368…, 2.262872154…, 2.704788415…, 3.074503101…, 13.49676325…, 10.59203071…, 7.723747777…, 4.935444092…, 2.452121378…, 2.859931533…, 3.209590254…, 4.980804482…, 2.485649867…, 2.887959143…, 3.234224430…, 4.503633905…, 2.168689406…

Can you see any patterns emerging? I’d guess not. And I’d guess a thousand more terms wouldn’t help you see any better. It’s hard for humans to see patterns in a jumble of numbers. Our eyes don’t work as well on numbers as on shapes. That’s why you can make that formula focal to the flesh, as it were, by plotting the numbers on a graph. Or part of the numbers, anyway. Suppose you take the fractional parts of each pair of terms and use them to map (x,y) on a FractL (my name for a graph whose arms run from 0 to 1). For example, the terms 4.935444092… and 2.452121378… would yield x = 0.935444092… and y = 0.452121378… (or vice versa). The resultant graph makes the formula focal to the flesh. And it’s replete with patterns:

fr(i)+=1/fr(i-1); if fr(i)>3, fr(i)-=3; x = frac(fr(i)), y = frac(fr(i+1))


I can’t explain the patterns and they may arise from limited precision in the decimal digits. But I like them however they arise. The graph doesn’t change when mx = 4 (although it creates the lines in a different order):

if fr(i)>4, fr(i)-=4


But it does change when mx = 4/3. The lines almost vanish, except for a tiny comet-like mark towards the upper right-hand corner:

if fr(i)>4/3, fr(i)-=4/3


When mx = 7/2, the graph of mx = 3|4 is back in a slightly different form:

if fr(i)>7/2, fr(i)-=7/2


And again with 7/3:

if fr(i)>7/3, fr(i)-=7/3


There’s a big change with 7/4, Most of the lines disappear:

if fr(i)>7/4, fr(i)-=7/4


And only the main lines appear with 9/5:

if fr(i)>9/5, fr(i)-=9/5


And so on till you try fr -= 2/f, as noted below:

if fr(i)>11/5, fr(i)-=11/5


if fr(i)>11/6, fr(i)-=11/6


if fr(i)>15/8, fr(i)-=15/8


if fr(i)>29/15, fr(i)-=29/15


Now try fr += 2/fr and fr += 3/fr. This is what happens:

fr += 2/fr; if fr(i)>3, fr(i)-=3


fr += 2/fr; if fr(i)>8/3, fr(i)-=8/3


fr += 2/fr; if fr(i)>11/4, fr(i)-=11/4


fr += 3/fr; if fr(i)>6, fr(i)-=6


And what about these graphs?




They’re created by seeding a sum, s, with a fraction, then adding more fractions < 1 whose numerators = 1,2,3… and whose denominators are the prime numbers 1, s -= 1. When s > 1, s -= 1. Then you take the fractional parts of s(i) and s(i+1) and graph (x,y) as above.


Post-Performative Post-Scriptum

The title of this post refers to Morbid Angel’s Formulas Fatal to the Flesh (1998). I’ve never heard it, but I like Morbid Angel’s alphabetically alliterative album-titles.

Fibonacci Friday Factors

Today’s a Phiday Friday or Φiday Friday or Φriday, so let’s have some more Fibonacci Fun. Here is the famous Fibonacci sequence, where each number (after seeding with “0, 1”) is formed by adding the previous two numbers:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, … — A000045 at the Online Encyclopedia of Integer Sequences (OEIS)

It’s obvious that the numbers get bigger for ever and that no number repeats except 1. But what happens to the final digit of the Fibonacci numbers, as underlined here?:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, …

If you think about it, you’ll realize that the final digit has to repeat. Look for the “0, 1, 1” re-appearing:

0, 1, 1, 2, 3, 5, 8, 3, 1, 4, 5, 9, 4, 3, 7, 0, 7, 7, 4, 1, 5, 6, 1, 7, 8, 5, 3, 8, 1, 9, 0, 9, 9, 8, 7, 5, 2, 7, 9, 6, 5, 1, 6, 7, 3, 0, 3, 3, 6, 9, 5, 4, 9, 3, 2, 5, 7, 2, 9, 1, 0, 1, 1, 2, 3, 5, 8, 3, 1, 4, 5, 9, 4, 3, 7, 0, 7, 7, 4, 1, 5, 6, 1, 7, 8, 5, 3, 8, 1, 9, 0, 9, 9, 8, 7, 5, 2, 7, 9, 6, 5, … — A003893 at the OEIS, “a(n) = Fibonacci(n) mod 10”

As you’ll see, all the numbers 0 to 9 appear in that sequence. But what about the final two digits of the Fibonacci sequence? Do all the numbers 0 to 99 appear before the sequence repeats?

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 44, 33, 77, 10, 87, 97, 84, 81, 65, 46, 11, 57, 68, 25, 93, 18, 11, 29, 40, 69, 9, 78, 87, 65, 52, 17, 69, 86, 55, 41, 96, 37, 33, 70, 3, 73, 76, 49, 25, 74, 99, 73, 72, 45, 17, 62, 79, 41, 20, 61, 81, 42, 23, 65, 88, 53, 41, 94, 35, 29, 64, … — A105471 at the OEIS, “a(n) = Fibonacci(n) mod 100”


And what about the the final three digits and the numbers 0 to 999?

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 597, 584, 181, 765, 946, 711, 657, 368, 25, 393, 418, 811, 229, 40, 269, 309, 578, 887, 465, 352, 817, 169, 986, 155, 141, 296, 437, 733, 170, 903, 73, 976, 49, 25, 74, 99, 173, 272 … — A248740 at the OEIS, “a(n) = Fibonacci(n) mod 1000”


In fact, some numbers do go missing as the final block of digits gets longer. But all that is based on the representation of the Fibonacci numbers in base 10. What about other bases? I had a look at that question and came up with some interesting patterns when I represented the final-block numbers on an Ulam-like spiral, where numbers are represented as squares on a spiral rotating counter-clockwise. This is the spiral for powers of 2 (the red square marks the center of the spiral and the number 1):

Spiral of final Fib-digits modulo 2^p


Fib-spiral mod 2^p (smaller scale)


Fib-spiral mod 2^p (smaller scale still)


What fraction of numbers are missing from the spiral? Watch this space. In the meantime, here’s the Fib-spiral for powers of 3:

Fib-spiral mod 3^p


It’s completely filled, because no numbers are missing (the red square marks “1” at the center of the spiral). What about powers of 4? Well, we’ve already seen that Fib-spiral, because all powers of 4 are also powers of 2:

Fib-spiral mod 4^p


The Fib-spiral for powers of 5 is the same as the Fib-spiral for powers of 3: it’s completely filled again. But the Fib-spiral for powers of 6 is interesting:

Fib-spiral mod 6^p


Fib-spiral mod 6^p (smaller scale)


Fib-spiral mod 6^p (smaller scale still)


And here are more Fib-spirals and more interesting patterns:

Fib-spiral mod 7^p


Fib-spiral mod 10^p — identical to the Fib-spiral for 2^p


Fib-spiral mod 11^p


Fib-spiral mod 11^p (smaller scale)


Fib-spiral mod 13^p


Fib-spiral mod 13^p (smaller scale)


Fib-spiral mod 17^p


Fib-spiral mod 17^p (smaller scale)


Fib-spiral mod 19^p


Fib-spiral mod 19^p (smaller scale)


Fib-spiral mod 41^p


Fib-spiral mod 41^p (smaller scale)


Fib-spiral mod 47^p


Elsewhere Other-Accessible…

Friday is Φday — a first look at Phiday on Friday

Run Fun

I was looking at numbers where the digit-runs of n in one base, b1, represented the digits of n in another base, b2. To understand digit-runs, take the number 775555111 (in whatever base). The function digitrun(775555111) = 2,4,3, because reading 775555111 left-to-right you see two 7s, four 5s, three 1s. Here’s one pattern I found:

10000011111 in base 2 = 1055 in base 10. The digit runs of 10000011111 are 1,5,5 and 15530 = 105510 = 100000111112.
10000022222 in base 3 = 59291 in base 10. The digit runs of 10000022222 are again 1,5,5 and 155241 = 5929110 = 100000222223.
1000009999910 → 1,5,5 and 15599998 = 1000009999910

The pattern isn’t difficult to understand — what are 30+2 and 99998+2? — and it’s easy to prove that it applies to all standard bases. But I wondered how AI would go about the proof. Here’s the result:

For base b ≥ 2, let the largest digit be d = b − 1. Then

100000dddddb

has digit runs

1, 5, 5

so the run-length encoding is always

155.

The value of 155 is interpreted in base

b5 − 2,

because

155b5−2 = (b5−2)2 + 5(b5−2) + 5.

Thus

100000dddddb = 155b5−2.

Base b n = 100000(b−1)(b−1)(b−1)(b−1)(b−1)b Run Lengths Compressed Form Base-10 Value of n
2 100000111112 1,5,5 15530 1,055
3 100000222223 1,5,5 155241 59,291
4 100000333334 1,5,5 1551022 1,049,599
5 100000444445 1,5,5 1553123 9,765,624
6 100000555556 1,5,5 1557774 60,466,175
7 100000666667 1,5,5 15516805 282,475,248
8 100000777778 1,5,5 15532766 1,074,266,111
9 100000888889 1,5,5 15559047 3,486,270,320
10 1000009999910 1,5,5 15599998 10,000,099,999
11 100000AAAAA11 1,5,5 155161049 26,094,908,050
12 100000BBBBB12 1,5,5 155248830 62,191,972,031
13 100000CCCCC13 1,5,5 155371291 136,858,491,292
14 100000DDDDD14 1,5,5 155537822 281,793,968,543
15 100000EEEEE15 1,5,5 155759373 547,918,611,874
16 100000FFFFF16 1,5,5 1551048574 1,099,512,627,199
17 100000GGGGG17 1,5,5 1551419855 2,141,423,647,200
18 100000HHHHH18 1,5,5 1551889566 4,058,363,974,751
19 100000IIIII19 1,5,5 1552476097 7,502,570,010,432
20 100000JJJJJ20 1,5,5 1553199998 13,120,000,000,000

(Here A = 10, B = 11, …, J = 19.)

Proof for All b ≥ 2

The number

100000(b−1)(b−1)(b−1)(b−1)(b−1)b

has value

b10 + (b−1)(b4 + b3 + b2 + b + 1).

Since

b4 + b3 + b2 + b + 1 = (b5 − 1)/(b − 1),

this becomes

b10 + (b5 − 1) = b10 + b5 − 1.

Now let

B = b5 − 2.

Then

155B = B2 + 5B + 5.

Substituting B = b5 − 2:

(B2 + 5B + 5) = (b5−2)2 + 5(b5−2) + 5

= b10−4b5+4+5b5−10+5

= b10 + b5−1.

Hence

b10 + b5 − 1 = (b5 − 2)2+5(b5 − 2)+5

for every b ≥ 2.

Therefore,

100000(b−1)5b = 155b5−2.

This is exactly the pattern observed in bases 2 to 20, and it holds for all bases.

Partition Fission

Simple but seductive. That’s how I’d describe partitions. Except that they’re not so simple. There are hidden depths in the task of finding how many ways an integer can be expressed as the sum of smaller integers (and as the sum of itself). Here are the partitions of 4, for example:

4 = 1+3 = 2+2 = 1+1+2 = 1+1+1+1
4 (1) = 1+3 (2) = 2+2 (3) = 1+1+2 (4) = 1+1+1+1 (5), ∴ partcount(4) = 5

There are five partitions of 4, because an integer is counted as its own partition. Accordingly, partcount(4) = 5. But partcount(n) doesn’t return values in a predictable way:

partcount(1) = 1 ← 1
partcount(2) = 2 ← 2 = 1+1
partcount(3) = 3 ← 3 = 1+2 = 1+1+1
partcount(4) = 5 ← 4 = 1+3 = 2+2 = 1+1+2 = 1+1+1+1
partcount(5) = 7 ← 5 = 1+4 = 2+3 = 1+1+3 = 1+2+2 = 1+1+1+2 = 1+1+1+1+1
partcount(6) = 11 ← 6 = 1+5 = 2+4 = 3+3 = 1+1+4 = 1+2+3 = 2+2+2 = 1+1+1+3 = 1+1+2+2 = 1+1+1+1+2 = 1+1+1+1+1+1
partcount(7) = 15 ← 7 = 1+6 = 2+5 = 3+4 = 1+1+5 = 1+2+4 = 1+3+3 = 2+2+3 = 1+1+1+4 = 1+1+2+3 = 1+2+2+2 = 1+1+1+1+3 = 1+1+1+2+2 = 1+1+1+1+1+2 = 1+1+1+1+1+1+1
partcount(8) = 22 ← 8 = 1+7 = 2+6 = 3+5 = 4+4 = 1+1+6 = 1+2+5 = 1+3+4 = 2+2+4 = 2+3+3 = 1+1+1+5 = 1+1+2+4 = 1+1+3+3 = 1+2+2+3 = 2+2+2+2 = 1+1+1+1+4 = 1+1+1+2+3 = 1+1+2+2+2 = 1+1+1+1+1+3 = 1+1+1+1+2+2 = 1+1+1+1+1+1+2 = 1+1+1+1+1+1+1+1


1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56, 77, 101, 135, 176, 231, 297, 385, 490, 627, 792, 1002, 1255, 1575, 1958, 2436, 3010, 3718, 4565, 5604, 6842, 8349, 10143, 12310, 14883, 17977, 21637, 26015, 31185, 37338, 44583, 53174, 63261, 75175, 89134, 105558, 124754, 147273, 173525 — the number of partitions of n, A000041 at the Online Encyclopedia of Integer Sequences

And there are fractals — self-similarities at smaller and smaller scales — hidden in that simple arithmetic. Take the partitions of 8:

8 = 1+7 = 2+6 = 3+5 = 4+4 = 1+1+6 = 1+2+5 = 1+3+4 = 2+2+4 = 2+3+3 = 1+1+1+5 = 1+1+2+4 = 1+1+3+3 = 1+2+2+3 = 2+2+2+2 = 1+1+1+1+4 = 1+1+1+2+3 = 1+1+2+2+2 = 1+1+1+1+1+3 = 1+1+1+1+2+2 = 1+1+1+1+1+1+2 = 1+1+1+1+1+1+1+1 (c=22)

By definition, the sum of each partition of 8 is the same: 8. But the products — the result of multiplying the numbers of a partition — rise and fall wildly, hitting a maximum of 18 and a minimum of 1:

1.7 = 7
2.6 = 12
3.5 = 15
4.4 = 16
1.1.6 = 6
1.2.5 = 10
1.3.4 = 12
2.2.4 = 16
2.3.3 = 18
1.1.1.5 = 5
1.1.2.4 = 8
1.1.3.3 = 9
1.2.2.3 = 12
2.2.2.2 = 16
1.1.1.1.4 = 4
1.1.1.2.3 = 6
1.1.2.2.2 = 8
1.1.1.1.1.3 = 3
1.1.1.1.2.2 = 4
1.1.1.1.1.1.2 = 2
1.1.1.1.1.1.1.1 = 1

It’s interesting to ask when partitions(n) yield the biggest product (the answer is here). It’s also interesting to create graphs of prod(part(n)), the products of the partitions of n. You’ll see something I call partition fission. The graphs start to fissure into what look like fins or sails, and then each fin or sail starts to fissure too:

Graph for multiples of partitions(8) (partcount(8) = 22)


Graph for prod(part(9)) (partcount = 30)


prod(part(10)) (partcount = 42)


prod(part(11)) (partcount = 56)


prod(part(12)) (partcount = 77)


prod(part(13)) (partcount = 101)


prod(part(14)) (partcount = 135)


prod(part(15)) (partcount = 176)


prod(part(16)) (partcount = 231)


Those graphs are all on the same scale. The two graphs below have been adjusted to capture many more partitions and show the fractality coming into full flower:

prod(part(20)) (partcount = 627)


prod(part(28)) (partcount = 3718)


Finally, here’s an animated gif of the graphs for the partition-products of 8 to 16:

Animated gif for prod(part(8..16)) (animation at EZgif) (click for larger image)


The Power of Cow

1, 1, 1, 2, 3, 4, 6, 9, 13, 19, 28, 41, 60, 88, 129, 189, 277, 406, 595, 872, 1278, 1873, 2745, 4023, 5896, 8641, 12664, 18560, 27201, 39865, 58425, 85626, 125491, 183916, 269542, 395033, 578949, 848491, 1243524, 1822473, 2670964, 3914488, 5736961, 8407925, …

• Narayana’s cows sequence: a(0) = a(1) = a(2) = 1; thereafter a(n) = a(n-1) + a(n-3). […] Number of digits in A061582. — A000930 at the Online Encyclopedia of Integer Sequences

1, 3, 9, 27, 621, 1863, 324189, 961232427, 2718369612621, 6213249182718361863, 1863961227324621324918324189, 32418927183662196121863961227324961232427, 961232427621324918186327183632418927183662196122718369612621, …

• a(1) = 1, a(n) = number obtained by replacing each digit of a(n-1) with three times its value. — A061582 at the OEIS

Moniliform Maths

2 = 1/2 + 2/4 + 3/8 + 4/16 + 5/32…

sum(np / 2n)

2 = prime = sum(n / 2n)
6 = 2·3 = sum(n2 / 2n)
26 = 2·13 = sum(n3 / 2n)
150 = 2·3·52 = sum(n4 / 2n)
1082 = 2·541 = sum(n5 / 2n)
9366 = 2·3·7·223 = sum(n6 / 2n)
94586 = 2·47293 = sum(n7 / 2n)
1091670 = 2·3·5·36389 = sum(n8 / 2n)
14174522 = 2·7087261 = sum(n9 / 2n)
204495126 = 2·3·11·41·75571 = sum(n10 / 2n)

A000629 Number of necklaces of partitions of n+1 labeled beads.

1, 2, 6, 26, 150, 1082, 9366, 94586, 1091670, 14174522, 204495126, 3245265146, 56183135190, 1053716696762, 21282685940886, 460566381955706, 10631309363962710, 260741534058271802, 6771069326513690646, 185603174638656822266, 5355375592488768406230

• moniliform ← French moniliforme (1800 or earlier) ← classical Latin monīle necklace


sum(np / 3n)

3/4 = prime / (22) = sum(n / 3n)
3/2 = prime / prime = sum(n2 / 3n)
33/8 = (3·11) / (23) = sum(n3 / 3n)
15 = 3·5 = sum(n4 / 3n)
273/4 = (3·7·13) / (22) = sum(n5 / 3n)
1491/4 = (3·7·71) / (22) = sum(n6 / 3n)
38001/16 = (3·53·239) / (24) = sum(n7 / 3n)
17295 = 3·5·1153 = sum(n8 / 3n)
566733/4 = (3·188911) / (22) = sum(n9 / 3n)
2579313/2 = (3·11·47·1663) / prime = sum(n10 / 3n)


sum(np / 4n)

4/9 = (22) / (32) = sum(n / 4n)
20/27 = (22·5) / (33) = sum(n2 / 4n)
44/27 = (22·11) / (33) = sum(n3 / 4n)
380/81 = (22·5·19) / (34) = sum(n4 / 4n)
4108/243 = (22·13·79) / (35) = sum(n5 / 4n)
17780/243 = (22·5·7·127) / (35) = sum(n6 / 4n)
269348/729 = (22·172·233) / (36) = sum(n7 / 4n)
4663060/2187 = (22·5·107·2179) / (37) = sum(n8 / 4n)
10091044/729 = (22·2522761) / (36) = sum(n9 / 4n)
218374420/2187 = (22·5·11·23·103·419) / (37) = sum(n10 / 4n)


sum(np / 5n)

5/16 = prime / (24) = sum(n / 5n)
15/32 = (3·5) / (25) = sum(n2 / 5n)
115/128 = (5·23) / (27) = sum(n3 / 5n)
285/128 = (3·5·19) / (27) = sum(n4 / 5n)
3535/512 = (5·7·101) / (29) = sum(n5 / 5n)
26355/1024 = (3·5·7·251) / (210) = sum(n6 / 5n)
458555/4096 = (5·91711) / (212) = sum(n7 / 5n)
1139685/2048 = (3·5·75979) / (211) = sum(n8 / 5n)
25492435/8192 = (5·17·443·677) / (213) = sum(n9 / 5n)
316786305/16384 = (3·5·11·1919917) / (214) = sum(n10 / 5n)


sum(np / 6n)

6/25 = (2·3) / (52) = sum(n / 6n)
42/125 = (2·3·7) / (53) = sum(n2 / 6n)
366/625 = (2·3·61) / (54) = sum(n3 / 6n)
4074/3125 = (2·3·7·97) / (55) = sum(n4 / 6n)
11334/3125 = (2·3·1889) / (55) = sum(n5 / 6n)
189714/15625 = (2·3·7·4517) / (56) = sum(n6 / 6n)
3706518/78125 = (2·3·181·3413) / (57) = sum(n7 / 6n)
82749954/390625 = (2·3·7·1970237) / (58) = sum(n8 / 6n)
2078250726/1953125 = (2·3·31·1061·10531) / (59) = sum(n9 / 6n)
11598884682/1953125 = (2·3·7·11·232·47459) / (59) = sum(n10 / 6n)


sum(np / 7n)

7/36 = prime / (22·32) = sum(n / 7n)
7/27 = prime / (33) = sum(n2 / 7n)
91/216 = (7·13) / (23·33) = sum(n3 / 7n)
70/81 = (2·5·7) / (34) = sum(n4 / 7n)
2149/972 = (7·307) / (22·35) = sum(n5 / 7n)
3311/486 = (7·11·43) / (2·35) = sum(n6 / 7n)
285929/11664 = (7·40847) / (24·36) = sum(n7 / 7n)
220430/2187 = (2·5·7·47·67) / (37) = sum(n8 / 7n)
1359337/2916 = (7·17·11423) / (22·36) = sum(n9 / 7n)
5239157/2187 = (7·11·68041) / (37) = sum(n10 / 7n)


sum(np / 8n)

8/49 = (23) / (72) = sum(n / 8n)
72/343 = (23·32) / (73) = sum(n2 / 8n)
776/2401 = (23·97) / (74) = sum(n3 / 8n)
10440/16807 = (23·32·5·29) / (75) = sum(n4 / 8n)
174728/117649 = (23·21841) / (76) = sum(n5 / 8n)
3525192/823543 = (23·32·11·4451) / (77) = sum(n6 / 8n)
11870648/823543 = (23·41·36191) / (77) = sum(n7 / 8n)
319735800/5764801 = (23·32·52·19·9349) / (78) = sum(n8 / 8n)
9686934584/40353607 = (23·1210866823) / (79) = sum(n9 / 8n)
326084753016/282475249 = (23·32·11·16273·25301) / (710) = sum(n10 / 8n)


sum(np / 9n)

9/64 = (32) / (26) = sum(n / 9n)
45/256 = (32·5) / (28) = sum(n2 / 9n)
531/2048 = (32·59) / (211) = sum(n3 / 9n)
1935/4096 = (32·5·43) / (212) = sum(n4 / 9n)
34983/32768 = (32·132·23) / (215) = sum(n5 / 9n)
381465/131072 = (32·5·72·173) / (217) = sum(n6 / 9n)
9725787/1048576 = (32·67·1272) / (220) = sum(n7 / 9n)
35420535/1048576 = (32·5·787123) / (220) = sum(n8 / 9n)
1160703963/8388608 = (32·47·409·6709) / (223) = sum(n9 / 9n)
21129845715/33554432 = (32·5·11·2213·19289) / (225) = sum(n10 / 9n)


sum(np / 10n)

10/81 = (2·5) / (34) = sum(n / 10n)
110/729 = (2·5·11) / (36) = sum(n2 / 10n)
470/2187 = (2·5·47) / (37) = sum(n3 / 10n)
7370/19683 = (2·5·11·67) / (39) = sum(n4 / 10n)
142870/177147 = (2·5·7·13·157) / (311) = sum(n5 / 10n)
1114190/531441 = (2·5·7·11·1447) / (312) = sum(n6 / 10n)
30495890/4782969 = (2·5·3049589) / (314) = sum(n7 / 10n)
953934190/43046721 = (2·5·11·569·15241) / (316) = sum(n8 / 10n)
3728765410/43046721 = (2·5·372876541) / (316) = sum(n9 / 10n)
145739620510/387420489 = (2·5·11·1324905641) / (318) = sum(n10 / 10n)

Pi’s Guys

3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1, 84, 2, 1, 1, 15, 3, 13, 1, 4, 2, 6, 6, 99, 1, 2, 2, 6, 3, 5, 1, 1, 6, 8, 1, 7, 1, 2, 3, 7, 1, 2, 1, 1, 12, 1, 1, 1, 3, 1, 1, 8, 1, 1, 2, 1, 6, 1, 1, 5, 2, 2, 3, 1, 2, 4, 4, 16, 1, 161, 45, 1, 22, 1, 2, 2, 1, 4, 1, 2, 24, 1, 2, 1, 3, 1, 2, 1, …

The first 5821569425 terms were computed by Eric W. Weisstein on Sep 18 2011.
The first 10672905501 terms were computed by Eric W. Weisstein on Jul 17 2013.
The first 15000000000 terms were computed by Eric W. Weisstein on Jul 27 2013.
The first 30113021586 terms were computed by Syed Fahad on Apr 27 2021.
The first 653520000000 terms were computed by Max Frank, Nov 01 2025.

A001203 Simple continued fraction expansion of Pi.

Worms in Terms of Perms

If you go back far enough, we’re all worms. All us animals, that is. But in a subtler sense, all life is vermiform — animals, plants, fungi, bacteria. DNA is a kind of worm, a string of chemicals encoding the recipe for an animal, plant, fungus or bacterium. And the worms of DNA can be turned into numbers, just as some numbers can be turned into worms:

3/7 = 0·0.428571428571428571428571…
154/183 = 0.841530054644808743169398907…
√2 = 1.414213562373095048801688…
π = 3.1415926535897932384626433…

Those are decimals, but there’s another kind of worm for such numbers. It’s called a continued fraction:

contfrac(3/7) = [0,2,3]
contfrac(154/183) = [0,1,5,3,4,2]
contfrac(√2) = [1,2,2,2,2,2…]
contfrac(π) = [3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1, 84, 2, 1, 1, 15…]

Extracting and enacting continued fractions is very simple. Here’s the extracting:

3/7 → 1/(3/7) = 7/3 = 2+1/3 – 2 = 1/3 → 1(1/3) = 3, ∴ contfrac(3/7) = [0,2,3]
154/183 → 1/(154/183) = 183/154 = 1 + 29/154 – 1 = 29/154 → 1/(29/154) = 154/29 = 5 + 9/29 – 5 = 9/29 → 1/(9/29) = 29/9 = 3 + 2/9 – 3 = 2/9 → 1/(2/9) = 9/2 = 4 + 1/2 – 4 = 1/2 → 1/(1/2) = 2 – 2 = 0, ∴ contfrac(154/183) = [0,1,5,3,4,2]

And here’s the enacting:

[0,2,3] → 3 → 1/3 → 1/3 + 2 = 7/3 → 1/(7/3) = 3/7
[0,1,5,3,4,2] → 2 → 1/2 → 1/2 + 4 = 9/2 → 2/9 + 3 = 29/9 → 9/29 + 5 = 154/29 → 29/154 + 1 = 183/154 → 1/(183/154) = 154/183

Once you’ve got the worm of a continued fraction, you can perm the worm, as it were, generating different fractions like this (I’m dropping the initial [0,…] of the contfracs):

[2,3,4] = contfrac(13/30)
[2,4,3] → 13/29
[3,2,4] → 09/31
[3,4,2] → 09/29
[4,2,3] → 07/31
[4,3,2] → 07/30

Reversing a continued fraction is a kind of permutation, so the fractal below represents one kind of worms in terms of perms:

Variant of a limestone fractal or gryke fractal


I call that graph a fract-L, because it’s shaped like an L and the x axis represents the simplified fractions 1/2, 1/3, 2/3, 1/4, 3/4, 1/5, 2/5, 3/5…, while the y axis represents the fractions you get by reversing the continued fractions of 1/2, 1/3, 2/3…:

contfrac(1/2) = [2] → 1/2
contfrac(1/3) = [3] → 1/3
contfrac(2/3) = [1,2] → 1/3
contfrac(1/4) = [4] → 1/4
contfrac(3/4) = [1,3] → 1/4
contfrac(1/5) = [5] → 1/5
contfrac(2/5) = [2,2] → 2/5
contfrac(3/5) = [1,1,2] → 2/5
contfrac(4/5) = [1,4] → 1/5
contfrac(1/6) = [6] → 1/6
contfrac(5/6) = [1,5] → 1/6
contfrac(1/7) = [7] → 1/7
contfrac(2/7) = [3,2] → 3/7
contfrac(3/7) = [2,3] → 2/7
contfrac(4/7) = [1,1,3] → 2/7
contfrac(5/7) = [1,2,2] → 3/7
contfrac(6/7) = [1,6] → 1/7
contfrac(1/8) = [8] → 1/8
contfrac(3/8) = [2,1,2] → 3/8
contfrac(5/8) = [1,1,1,2] → 3/8
contfrac(7/8) = [1,7] → 1/8
contfrac(1/9) = [9] → 1/9
contfrac(2/9) = [4,2] → 4/9
contfrac(4/9) = [2,4] → 2/9
contfrac(5/9) = [1,1,4] → 2/9
contfrac(7/9) = [1,3,2] → 4/9
contfrac(8/9) = [1,8] → 1/9
[…]

If you perm the worm in other ways, you get other shapes on the fract-L. I looked at continued fractions of fixed length, 4, 5 and 6, and permed them using one of the permutations of [1,2,3,4], [1,2,3,4,5] and [1,2,3,4,5,6]. Here’s a graph for fractions, a/b, and permed fractions, perm(a/b), where length(contfrac(a/b)) = 4:

x = a/b when length(contfrac(a/b)) = 4, y = fraction from contfrac(a/b) permed with [1,3,2,4]


The x axis represents simplified fractions, a/b, when len(cf(a/b)) = 4. The y axis represents the fractions found by applying the perm [1,3,2,4] to contfrac(a/b). That is, the first number of the contfrac stays where it is, the third number moves to position 2, the second number moves to position 3 and the fourth number stays where it is. In short, you simply swap the middle two numbers of contfrac(a/b). Here’s an example:

contfrac(9/43) = [4,1,3,2] → [4,3,1,2] → 11/47, because contfrac(11/47) = [4,3,1,2]

Here are more fract-Ls representing worms in terms of perms:

fract-L for contfrac(a/b) permed by [2,1,3,4]


fract-L for contfrac(a/b) permed by [3,2,1,4]


fract-L for contfrac(a/b) permed by [1,4,2,3,5] (i.e. a/b where len(contfrac(a/b)) = 5)


fract-L for contfrac(a/b) permed by [1,5,3,4,2]


fract-L for contfrac(a/b) permed by [2,1,4,3,5]


fract-L for contfrac(a/b) permed by [3,4,1,2,5]


fract-L for contfrac(a/b) permed by [4,2,3,1,5]


fract-L for contfrac(a/b) permed by [4,2,5,3,1]


fract-L for contfrac(a/b) permed by [4,3,2,1,5]


fract-L for contfrac(a/b) permed by [5,3,4,2,1]


fract-L for contfrac(a/b) permed by [2,1,4,3,5,6] (i.e. a/b where len(contfrac(a/b)) = 6)


fract-L for contfrac(a/b) permed by [2,1,5,4,3,6]


fract-L for contfrac(a/b) permed by [3,2,1,4,5,6]


fract-L for contfrac(a/b) permed by [3,2,1,5,4,6]


fract-L for contfrac(a/b) permed by [3,5,1,4,2,6]


fract-L for contfrac(a/b) permed by [4,2,5,1,3,6]


fract-L for contfrac(a/b) permed by [4,3,2,1,5,6]


fract-L for contfrac(a/b) permed by [4,5,2,3,1,6]


fract-L for contfrac(a/b) permed by [1,3,2,6,5,4,7] (i.e. a/b where len(contfrac(a/b)) = 7)


fract-L for contfrac(a/b) permed by [1,5,2,6,3,4,7]


fract-L for contfrac(a/b) permed by [5,6,3,7,4,1,2]


fract-L for contfrac(a/b) permed by [6,2,3,5,4,1,7]


fract-L for contfrac(a/b) permed by [6,2,5,4,7,3,1]


Post-Performative Post-Scriptum

Much as I hate the phrase “in terms of”, I was happy to use it in the title of this post. After all, it isn’t ugly but assonant there. And it began life in mathematics, where it still has its proper meaning rather than being pretentious and prolix:

How did this complex preposition come into being? The OED [Oxford English Dictionary] reveals that it has been in use since the mid-18c. as a mathematical expression “said of a series…stated in terms involving some particular (my emphasis) quantity”, and illustrates this technical usage by citing examples from the work of Herbert Spencer (1862), J. F. W. Herschel (1866), and other writers. From this technical use came at first a trickle and, after the 1940s, a flood of imitative uses by non-mathematicians. — “Terminal Trinity


Elsewhere Other-Engageable

A Fracteasel on a Fract-L — an earlier look at continued fractions and fractal fract-Ls

Sequence Unfurls…

The Fibonacci sequence is beautiful like clockwork. There’s a perfectly clear, rigorously defined mechanism ticking out an entirely predictable result for ever:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, … — A000045 at the Online Encyclopedia of Integer Sequences (OEIS)

And there’s a formula to calculate any term in the sequence without calculating all the terms that precede it:

Binet’s formula for Fn, the n-th Fibonacci number


But I also like sequences that you might call definitely arbitrary. That is, there’s a perfectly clear, rigorously defined mechanism, but the results seem arbitrary — not predictable at all:

6, 15, 5, 22, 6, 3, 30, 9, 7, 2, 45, 15, 6, 5, 1, 36, 14, 6, 5, 3, 1, 62, 22, 16, 6, 5, 3, 2, 69, 21, 15, 4, 9, 5, 2, 1, 84, 30, 15, 9, 6, 7, 2, 2, 1, 56, 22, 13, 7, 3, 5, 2, 0, 0, 0, 142, 45, 22, 15, 12, 6, 9, 5, 3, 1, 2, 53, 17, 8, 4, 5, 1, 6, 3, 1, 1, 1, 0, 124, 36, 27, 14, 18, 6, 6, 5, 2, 3, 1, 1, 0, … A349083 at OEIS

What’s the formula there? That sequence is defined at the OEIS as “The number of three-term Egyptian fractions of rational numbers x/y, 0 < x/y < 1, ordered as below. The sequence is the number of (p,q,r) such that x/y = 1/p + 1/q + 1/r where p, q, and r are integers with p < q < r.” For example: “The sixth rational number is 3/4 [and] 3/4 = 1/2 + 1/5 + 1/20 = 1/2 + 1/6 + 1/12 = 1/3 + 1/4 + 1/5, so a(6)=3.”

The Number of the Decreased

I wondered what happened when you take a fraction, a/b, and calculate a/b – (a/b)^2 = c/d. And an interesting pattern appeared when I tried a prime denominator and all numerators less than that denominator. Here’s the pattern with the prime denominator of 7:


1/7 - 01/49 = 06/49
2/7 - 04/49 = 10/49
3/7 - 09/49 = 12/49
4/7 - 16/49 = 12/49
5/7 - 25/49 = 10/49
6/7 - 36/49 = 06/49

And here it is with the prime denominator of 13:


01/13 - 001/169 = 12/169
02/13 - 004/169 = 22/169
03/13 - 009/169 = 30/169
04/13 - 016/169 = 36/169
05/13 - 025/169 = 40/169
06/13 - 036/169 = 42/169
07/13 - 049/169 = 42/169
08/13 - 064/169 = 40/169
09/13 - 081/169 = 36/169
10/13 - 100/169 = 30/169
11/13 - 121/169 = 22/169
12/13 - 144/169 = 12/169

It’s easier to see what’s going on with the smaller denominator:


1/7 - 01/49 = 06/49 = 1/7 - (1/7)^2
2/7 - 04/49 = 10/49 = 2/7 - (2/7)^2
3/7 - 09/49 = 12/49 = 3/7 - (3/7)^2
4/7 - 16/49 = 12/49
5/7 - 25/49 = 10/49
6/7 - 36/49 = 06/49


1/7 - 01/49 = 07/49 - 01/49 = 06/49
2/7 - 04/49 = 14/49 - 04/49 = 10/49
3/7 - 09/49 = 21/49 - 09/49 = 12/49
4/7 - 16/49 = 28/49 - 16/49 = 12/49
5/7 - 25/49 = 35/49 - 25/49 = 10/49
6/7 - 36/49 = 42/49 - 36/49 = 06/49


1/7 - 01/49 = 1*7/7^2 - 1^2/7^2 = 07/49 - 01/49 = 06/49
2/7 - 04/49 = 2*7/7^2 - 2^2/7^2 = 14/49 - 04/49 = 10/49
3/7 - 09/49 = 3*7/7^2 - 3^2/7^2 = 21/49 - 09/49 = 12/49
4/7 - 16/49 = 4*7/7^2 - 4^2/7^2 = 28/49 - 16/49 = 12/49
5/7 - 25/49 = 5*7/7^2 - 5^2/7^2 = 35/49 - 25/49 = 10/49
6/7 - 36/49 = 6*7/7^2 - 6^2/7^2 = 42/49 - 36/49 = 06/49

Here’s a set of the patterns using prime denominators from 3 to 13:


1/3 - 1/9 = 2/9
2/3 - 4/9 = 2/9


1/5 - 01/25 = 4/25
2/5 - 04/25 = 6/25
3/5 - 09/25 = 6/25
4/5 - 16/25 = 4/25


1/7 - 01/49 = 06/49
2/7 - 04/49 = 10/49
3/7 - 09/49 = 12/49
4/7 - 16/49 = 12/49
5/7 - 25/49 = 10/49
6/7 - 36/49 = 06/49


01/11 - 001/121 = 10/121
02/11 - 004/121 = 18/121
03/11 - 009/121 = 24/121
04/11 - 016/121 = 28/121
05/11 - 025/121 = 30/121
06/11 - 036/121 = 30/121
07/11 - 049/121 = 28/121
08/11 - 064/121 = 24/121
09/11 - 081/121 = 18/121
10/11 - 100/121 = 10/121


01/13 - 001/169 = 12/169
02/13 - 004/169 = 22/169
03/13 - 009/169 = 30/169
04/13 - 016/169 = 36/169
05/13 - 025/169 = 40/169
06/13 - 036/169 = 42/169
07/13 - 049/169 = 42/169
08/13 - 064/169 = 40/169
09/13 - 081/169 = 36/169
10/13 - 100/169 = 30/169
11/13 - 121/169 = 22/169
12/13 - 144/169 = 12/169

Then I tried a/b – (a/b)^3. There were no obvious strong patterns, but something caught my eye in the last subtraction for b = 19:


01/19 - 0001/6859 = 0360/6859 = 1/19 - (1/19)^3
02/19 - 0008/6859 = 0714/6859 = 2/19 - (2/19)^3
03/19 - 0027/6859 = 1056/6859 = 3/19 - (3/19)^3
04/19 - 0064/6859 = 1380/6859
05/19 - 0125/6859 = 1680/6859
06/19 - 0216/6859 = 1950/6859
07/19 - 0343/6859 = 2184/6859
08/19 - 0512/6859 = 2376/6859
09/19 - 0729/6859 = 2520/6859
10/19 - 1000/6859 = 2610/6859
11/19 - 1331/6859 = 2640/6859
12/19 - 1728/6859 = 2604/6859
13/19 - 2197/6859 = 2496/6859
14/19 - 2744/6859 = 2310/6859
15/19 - 3375/6859 = 2040/6859
16/19 - 4096/6859 = 1680/6859
17/19 - 4913/6859 = 1224/6859
18/19 - 5832/6859 = 0666/6859

Look at the final subtraction: 18/19 – 5832/6859 = 666/6859. So the Number of the Beast is the numerator when 18/19 is decreased by (18/19)^3. Dropping the need for powers of a/b, I looked for more beastly fraction subtractions using pairs of simplified fractions. Here are a few:


26/35 - 04/31 = 666/1085 = 0.613824885...
29/35 - 05/29 = 666/1015 = 0.656157635...
32/35 - 02/23 = 666/0805 = 0.827329193...
40/41 - 14/31 = 666/1271 = 0.523996853...
35/43 - 13/35 = 666/1505 = 0.442524917...
23/47 - 01/31 = 666/1457 = 0.457103638...
30/47 - 12/41 = 666/1927 = 0.345614946...
31/47 - 01/23 = 666/1081 = 0.616096207...
31/47 - 02/46 = 666/1081 = 0.616096207...
40/47 - 02/19 = 666/0893 = 0.745800672...
[...]

This fraction subtraction is beastly in two ways: 95/103 – 83/97 = 666/9991 = 0.066659994…

I also noticed that 666 can be the numerator in two ways when the denominator is 19 and its powers:


18/19 - 5832/6859 = 666/6859 = 18/19 - (18/19)^3
18/19 + 0324/0361 = 666/0361 = 18/19 + (18/19)^2

So 666 is both the Number of the Decreased and the Number of the Increased. That double pattern is general when you either decrease (b-1)/b by ((b-1)/b)^3 or increase (b-1)/b by ((b-1)/b)^2:


2/3 - 8/27 = 10/27 = 2/3 - (2/3)^3
2/3 + 04/9 = 10/09 = 2/3 + (2/3)^2


4/5 - 64/125 = 36/125 = 4/5 - (4/5)^3
4/5 + 16/025 = 36/025 = 4/5 + (4/5)^2


6/7 - 216/343 = 78/343 = 6/7 - (6/7)^2
6/7 + 036/049 = 78/049 = 6/7 + (6/7)^2


10/11 - 1000/1331 = 210/1331
10/11 + 0100/0121 = 210/0121


12/13 - 1728/2197 = 300/2197
12/13 + 0144/0169 = 300/0169


16/17 - 4096/4913 = 528/4913
16/17 + 0256/0289 = 528/0289


18/19 - 5832/6859 = 666/6859
18/19 + 0324/0361 = 666/0361


22/23 - 10648/12167 = 990/12167
22/23 + 00484/00529 = 990/00529