Friday 14 August 2020

Sexagesimal Number System

Today I turned 26066 days old and the OEIS had little of interest to say about the properties of this number. It was the same with Numbers Aplenty, my other source of information about number properties. The latter site did remind me that the number could be expressed as a sum of two squares, \(71^2+145^2 \), with my age in years (71) appearing coincidentally. I searched for some time on other sites to find something else of interest but could find nothing.

Finally, I thought about the sexagesimal or base 60 number system. What if I interpreted 26066 as a time in seconds and converted it to its equivalent in hours, minutes and seconds? Doing this, the result is 7:14:26. As I wrote in the graphic (Figure 1) and which I'll reproduce here in case of difficulty in reading it:

Using 1 second equals 1 day, it takes about two months for the minute hand to progress one tick and 120 months or about 10 years for the hour hand to progress five ticks and mark out the passage of an hour. The hours thus mark out the decades and the minutes mark the passage through the months and years of that decade. It’s an interesting way of viewing the passing of time. Very few people will make it to 10 o’clock by this reckoning. An interesting approach might be to look at when sunrise occurred on the day you were born and add the elapsed time to that. For example, the Sun rose at 5:58 on the day I was born and so it’s now about 1:12pm. The Sun set at 5:44pm so I’m not going to make it to sunset. 


Figure 1: clock interface courtesy of https://www.visnos.com/demos/clock

This visualisation may be a way of making a person's diurnal age more comprehensible. When I tell someone that I'm so and so many days old, they are uniformly unimpressed by the statistic. The big takeaway is that one hour approximates to one decade. This is because the number of days in the solar year is very close 360 (either 365 or 366 and averaging about 365.25). Thus when we convert 10 years to days, then treat those days as seconds and convert them to hours, we get 1.014583...

Using a site like timeanddate.com, it's easy to find when the Sun rose on the day you were born. See Figure 2 using my own birth as an example:


Figure 2

Adding 7:14:26 to 5:58:00 (we don't know the exact second for the sunrise), we get 1:12:26 (see Figure 3):


Figure 3: clock interface courtesy of https://www.visnos.com/demos/clock

As I said earlier, I've no chance of reaching sunset but it would certainly be possible for those born at higher latitudes in the winter months. For example, for someone born in London, England, on January 1st 1949, the Sun rose at 8:16 and set at 4:01. Thus the day is a little less than 8 hours long and if you live to 80 then you make it.

This mapping of the days of one's life onto a clock face can produce some previously hidden significances. For example, on what days do the hour and minute hands of the clock overlap? Here is a brief account of what the relevant clock times are (source):
Note that each time they meet, the number of minutes past the hour keeps increasing, so the hour hand would have moved closer to the next number. After 11 o'clock, the minute hand has to travel all the way and by the time they meet it is has to be 12 o'clock again, since we know what the clock looks like at that time. So the two hands overlap 11 times in a 12 hour period. So, in a 24 hour period, they would overlap 22 times.

 To answer the second part of the question, let's try to figure out the little bit of extra time the minute hand needs to catch up to the hour hand after every 1:05 hours. Well, after 12 o'clock there are eleven occasions when the two hands match up, and since the clock hands move at constant speeds, those 11 events are spread equally apart around the clock face, so they are 1/11th of an hour apart. That's 5.454545 minutes apart. In other words they meet after every 1 hour and 5.454545 minutes.

The precise times they overlap (in hours) would be 1 + 1/11, 2 + 2/11, 3+ 3/11, all the way up to 11 + 11/11, which is 12 o'clock again. 

Converting these clock times back to seconds again gives the following sequence:

3927, 7855, 11782, 15709, 19636, 23564, 27491, 31418, 35345, 39273, 43200

I've submitted this sequence for inclusion in the OEIS as doesn't appear there and I think it's an interesting one. Let's see if it gets approved.

UPDATE on August 19th 2020

Today my sequence was approved and with the legendary Neal Sloane giving it the final stamp of approval. It is OEIS A335789. The sequence is a good example of how playing around with different ways of interpreting a number can lead to interesting results. In this case, my viewing the number as representing seconds after 12:00 on a clock face was the crucial step that led me to the devising of the sequence.


A335789



a(n) = time to the nearest second at the n-th instant (n>=0) when the hour and minute hands on a clock face coincide, starting at time 0:00.

Below is a snapshot of the sequence as it appears in the OEIS:


Of course there's nothing new under the sun and following the link OEIS A120500, it can be seen that Lekraj Beedassy, back on August 06th 2006 had exactly the same idea except that the time was represented in HHMMSS format and thus the sequence is self-limiting:

0, 10527, 21055, 31622, 42149, 52716, 63244, 73811, 84338, 94905, 105433, 120000 


A120500

Times in hours, minutes and seconds (to the nearest second) at which the smoothly crossing minute and hour hands of an analog clock coincide, over a period of one complete 12-hour sweep of the hour hand.


Of course, I hadn't seen this sequence when I was developing my own.

Monday 10 August 2020

Palindromic Cyclops Numbers

The photo pretty well sums up how I'm feeling today and today is a palindromic cyclops number day. I'm currently 26062 days old. My last such day was obviously 25052 and my next will be 27072. Mathematically, there is nothing deeply significant about such numbers. They are a peculiarity of the base ten number system. In other number bases, the number is not palindromic, as can be seen in Figure 1:

Figure 1: source

By contrast, primeness is intrinsic to the number itself and is independent of the base being used to express the number. The base-dependent peculiarities however, still exert a powerful fascination over numberphiles. Figure 2 shows a fancy font representation of 26062. Sometimes it's nice to just enjoy the symmetry of a number and to admire its representation in an artistic font.



In a more mathematically appreciative world, people might celebrate their palindromic cyclic days in the same way that they celebrate their birthdays. They only occur about every three years, so they are rather special. Instead, these days pass by unnoticed for most of humanity. In 600 days time, I'll turn 26662 days old. As well as being palindromic, the central three digits form the number of the beast: 666.

Digit patterns such as 26062 displays are also useful in strengthening numeracy in young children. A simple exercise might be as follows: given the digits 0, 2, 2, 6, 6, arrange them in such a way that the resultant number reads the same from left to right. Two arrangements of course are possible: 26062 and 62026.

From the shallow waters of exercises like the previous one, it's easy to get into deep waters fairly quickly. For example, 26062 has the property that, when it is tripled and 1 is added, the result is also a palindrome: 78187. This tripling and adding one reminded me of the Collatz conjecture that I've written about in earlier posts. However, in the Collatz the rule is that for an even number like 26062, the number is halved and so, in the case of 26062, the result is 13031 (incidentally, also palindromic). I got to thinking: how would a sort of reversed Collatz sequence behave? What is I mean is explained by the following rule for a given number \(n\):
  • if \(n\) is even, \(n \rightarrow 3n+1\)
  • if \(n\) is odd, \( n \rightarrow \dfrac{n-1}{2} \)
Now the Collatz rule is the opposite of this and, as far as is known, always leads to 1. However, for this reversed version, I found that the sequence started to loop once it reacted 40 (going back to 121 - shown in blue). Here is the sequence:

26062, 78187, 39093, 19546, 58639, 29319, 14659, 7329, 3664, 10993, 5496, 16489, 8244, 24733, 12366, 37099, 18549, 9274, 27823, 13911, 6955, 3477, 1738, 5215, 2607, 1303, 651, 325, 162, 487, 243, 121, 60, 181, 90, 271, 135, 67, 33, 16, 49, 24, 73, 36, 109, 54, 163, 81, 40

A little experimenting showed that some numbers go to 1. For example, here is the sequence for 1000:

1000, 3001, 1500, 4501, 2250, 6751, 3375, 1687, 843, 421, 210, 631, 315, 157, 78, 235, 117, 58, 175, 87, 43, 21, 10, 31, 15, 7, 3, 1

999 on the other hand enters a different loop to that of 26062. It would be interesting to explore the different results in a future post but here I'm just illustrating how there can be complexity hiding in apparent simplicity when exploring the properties of a number.

While on the subject of 26062, it can be noted that it has the interesting property that the sum of its prime divisors is also a palindrome (242). It is in fact a member of OEIS A046354:


A046354

Composite palindromes whose sum of prime factors is palindromic (counted with multiplicity).


The sequence runs 4, 6, 8, 9, 121, 292, 444, 575, 717, 828, 989, 1331, 2002, 4884, 5445, 8668, 9559, 10201, 11211, 11811, 13231, 14241, 14541, 14641, 15251, 15751, 16261, 16761, 18281, 19291, 19591, 20002, 21112, 21312, 22022, 22922, 23832, 26062, ...

It can be generated using the following SageMath code (permalink):

P=[]
for number in [1..26062]:
    N=number.digits()
    s=""
    for n in N:
        s+=str(n)
    if number==int(s):
        P.append(number)
L=[]
for p in P:
    if is_prime(p)==0:
        sum=0
        M=list(factor(p))
        for m in M:
            sum+=m[0]*m[1]
        if sum in P:
            L.append(p)
print(L)

Sunday 2 August 2020

The Greedy Algorithm

I started browsing a book by David Wells called The Penguin Book of Curious and Interesting Puzzles. The first book that I encountered by this author was Prime Numbers:  The Most Mysterious Figures in Math and it is a most interesting book. A brief biography at the start of the this Penguin book informs us that:
David Wells was born in 1940. He had the rare distinction of being a Cambridge scholar in mathematics and failing his degree. He subsequently trained as a teacher and, after working on computers and teaching machines, taught mathematics and science in a primary school and mathematics in secondary schools. He is still involved with education through writing and working with teachers. While at university he became British under-21 chess champion, and in the mIddle seventies was a game inventor, devising 'Guerilla' and 'Checkpoint Danger', a puzzle composer, and the puzzle editor of Games & Puzzles magazine. From 1981 to 1983 he published The Problem Solver, a magazine of mathematical problems for secondary pupils. He has published several books of problems and popular mathematics, including Can You Solve These? and Hidden Connections, Double Meanings, and also Russia and England, and the Transformations of European Culture. He has written The Penguin Dictionary of Curious and Interesting Numbers and The Penguin Dictionary of Curious and Interesting Geometry, and is currently writing a book on the nature, learning and teaching of mathematics.
One of the first topics he deals with is Egyptian Fractions which consist only of unit fractions, meaning fractions with a numerator of 1. For example, the Egyptians would have expressed the fraction \( \frac{7}{10} \) as \( \frac{1}{2}+ \frac{1}{5} \).

The author then asks the question: 
Can all proper fractions be expressed as the sum of unit fractions, without repetition? 
The answer is: 
Yes, as Fibonacci showed, also in his Liber Abaci, where he described what is now called the greedy algorithm. Subtract the largest possible unit fraction, then do the same again, and so on. Sylvester proved in 1880 that applying this greedy algorithm to the fraction \( \frac{p}{q} \), where \(p\) is less than \(q,\) produces a sequence of no more than \(p\) unit fractions.
The site CODESDOPE provides the Python code to generate an Egyptian fraction from an improper fraction. Here is the code, applied to the fraction \( \frac{5}{7} \), together with its output:

import math

unit_den_array = [0]*10
iter = 0

def gcd(a, b):
  c = a%b
  while(c > 0):
    a = b
    b = c
    c = a % b
  return b

def greedy_egyptian_fraction(num, den):
  global iter
  if(num == 1):
    #appending list unit_den_array
    iter = iter+1 # storing in unit_den_array from index 1 not 0
    unit_den_array[iter] = den
  else:
    unit_den = math.ceil(den/num)
    iter = iter+1
    unit_den_array[iter] = unit_den
    gcd_of_numbers = gcd((num*unit_den) - den, den*unit_den)
    greedy_egyptian_fraction(((num*unit_den) - den)//gcd_of_numbers, (den*unit_den)//gcd_of_numbers)

if __name__ == '__main__':
  greedy_egyptian_fraction(5, 7)
  for i in range(1, iter+1):
    print(unit_den_array[i])

2
5
70

There is a lot of code and the contrast with the amount of code needed for SageMath could not be more stark. Here is code required for SageMath to accomplish exactly the same task:

L=[]
n=5/7
while n>0:
    bottom=ceil(denominator(n)/numerator(n))
    L.append(bottom)
    n=n-1/bottom
print(L)

[2, 5, 70]

While I am inclined to become more proficient in the use of Python, I am at the same time aware of how much more SageMath is suited to performing mathematical tasks, as the example of Egyptian fractions illustrate. Why go through a painful Python procedure to generate an outcome that SageMath can achieve almost effortlessly. It took me a few minutes to generate the SageMath code but I'm sure I would have struggled for much longer if I had only Python code to rely on. Here is the permalink to SageMathCell.

As the CODESDOPE observes in Figure 1:

Figure 1

My SageMath algorithm has provided the first representation but not the second. The latter is preferable in one way because the maximum denominator is much smaller (21 versus 70). Another way to generate an Egyptian fraction is by determining the Engel expansion for the proper fraction. I posted about the Engel expansion on the 26th September 2016. For an explanation of what this expansion is all about, see Figure 2.

Figure 2


The algorithm I developed to generate the Engel expansion for any positive real number is shown below, using \( \frac{5}{7} \) as an example (permalink):

x=5/7
u=x
E=[1]
F=[]
product=1
sum=0
for i in [1..10]:
    if u==0:
        break
    else:
        a=ceil(1/u)
    u=u*a-1
    E.append(a)
    product=product*a
    sum+=1/product
    F.append(1/product)
print("Engel expansion is",E)
print("Fraction expression is",F)

Engel expansion is [1, 2, 3, 4, 7]
Fraction expression is [1/2, 1/6, 1/24, 1/168]

So additionally \( \frac{5}{7}= \frac{1}{2}+ \frac{1}{6}+ \frac{1}{24}+ \frac{1}{168} \). Interestingly, I discovered on this website about proper fractions of the form \( \frac{4}{n} \) and \( \frac{3}{n} \). To quote from the site:
In the 1940s, the mathematicians Paul Erdos and Ernst G. Straus conjectured that every fraction with numerator = 4 can be written as an Egyptian fraction sum with three terms. If you have found an example that appears to need more than three, can you find an alternative sum? Can you find a reason why it must work, or a counter-example - the conjecture isn't yet proved. It is proved for \( \frac{3}{n} \).
Testing this out on \( \frac{3}{7} \), we find an Egyptian fraction of \( \frac{1}{3}+ \frac{1}{11}+\frac{1}{231}\). I'm sure there's a lot more that can be said about Egyptian fractions but I'll finish up here and maybe return to the topic at a later date. Figure 3 shows how the Egyptians connected the senses with fractions that had powers of 2 as denominators.

Figure 3

It can be noted that \( \frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\frac{1}{16}+\frac{1}{32}+\frac{1}{64}=\frac{63}{64}\)