Showing posts with label lunar. Show all posts
Showing posts with label lunar. Show all posts

Thursday, 16 February 2023

The Julian Day Number

In a January 2023 post titled Turning Dates into Numbers, I described one way of turning a unique date into a unique number using the YYYYMMDD method. However, another way is to simply affix the day of the year to the year using a YYYYDDD template (where D stands for Digit rather than Day). In non-leap years, the DDD will range from 001 to 365 and in leap years it will range from 0 to 366. Today being the 16th February 2023, the number would be 2023047.

This system has the advantage of producing \( \textbf{seven}\) digit numbers rather the \( \textbf{eight} \) digit numbers that arise from the YYYYMMDD system. Another advantage is that there are no gaps in the progression of numbers. The transition from one month to the next in the YYYYMMDD system produces gaps. For example, the end of January this year corresponded to the number 20230131 and this was followed immediately by 20230201, corresponding to the 1st February. There is a gap of 70 between these two numbers.

What about the transition from one year to the next. On 31st December 2023, the number 2023365 transitions to 2024001. This a number gap of 636 and a serious discontinuity. This led me to consider methods for arriving at a continuous count and I was reminded of the Julian Day that appears in the horoscopes generated by Astrolog. See Figure 1 that shows the chart for the current time in Jakarta with a Julian Day of 2459991.62287.


Figure 1

So what is a Julian Day Number? Here is what Wikipedia has to say on the topic:

The Julian day is the continuous count of days since the beginning of the Julian period, and is used primarily by astronomers, and in software for easily calculating elapsed days between two events (e.g. food production date and sell by date).

The Julian period is a chronological interval of 7980 years; year 1 of the Julian Period was 4713 BC (−4712). The Julian calendar year 2023 is year 6736 of the current Julian Period. The next Julian Period begins in the year AD 3268. Historians used the period to identify Julian calendar years within which an event occurred when no such year was given in the historical record, or when the year given by previous historians was incorrect.

The Julian day number (JDN) is the integer assigned to a whole solar day in the Julian day count starting from noon Universal Time, with Julian day number 0 assigned to the day starting at noon on Monday, January 1, 4713 BC, proleptic Julian calendar (November 24, 4714 BC, in the proleptic Gregorian calendar), a date at which three multi-year cycles started (which are: Indiction, Solar, and Lunar cycles) and which preceded any dates in recorded history. For example, the Julian day number for the day starting at 12:00 UT (noon) on January 1, 2000, was 2451545.

The Julian date (JD) of any instant is the Julian day number plus the fraction of a day since the preceding noon in Universal Time. Julian dates are expressed as a Julian day number with a decimal fraction added. For example, the Julian Date for 00:30:00.0 UT January 1, 2013, is 2456293.520 833. This page was loaded at 2023-02-15 23:56:54 (UTC) – expressed as a Julian date this is 2459991.4978472. 

I was clueless as to what was meant by indiction but it is explained as follows, again quoting from Wikipedia:

An indiction (Latin: indictio, impost) was a periodic reassessment of taxation in the Roman Empire which took place every fifteen years. In Late Antiquity, this 15-year cycle began to be used to date documents and it continued to be used for this purpose in Medieval Europe, and can also refer to an individual year in the cycle; for example, "the fourth indiction" came to mean the fourth year of the current indiction. Since the cycles themselves were not numbered, other information is needed to identify the specific year.

The key numbers are 15, 19 and 28 that multiply together to give 7980. The article continues:

The Julian day number is based on the Julian Period proposed by Joseph Scaliger, a classical scholar, in 1583 (one year after the Gregorian calendar reform) as it is the product of three calendar cycles used with the Julian calendar:

28 (solar cycle) × 19 (lunar cycle) × 15 (indiction cycle) = 7980 years

Its epoch occurs when all three cycles (if they are continued backward far enough) were in their first year together. Years of the Julian Period are counted from this year, 4713 BC, as year 1, which was chosen to be before any historical record.

TODAY IS JULIAN DAY NUMBER 2459991

A formula is provided to convert any Gregorian calendar date to its equivalent Julian day number. It is stated below and here is a permalink to its calculation for any given day.

JDN = (1461 × (Y + 4800 + (M − 14)/12))/4 +(367 × (M − 2 − 12 × ((M − 14)/12)))/12 − (3 × ((Y + 4900 + (M - 14)/12)/100))/4 + D − 32075 

This number has much to recommend it. Currently the Julian day number is seven digits long and will remain so for many years to come. So for 2023, the 1st January corresponds to a JDN of 2459946 and the 31st December 2023 corresponds to 2460310. The full range of numbers for 2023 is:

2459946, 2459947, 2459948, 2459949, 2459950, 2459951, 2459952, 2459953, 2459954, 2459955, 2459956, 2459957, 2459958, 2459959, 2459960, 2459961, 2459962, 2459963, 2459964, 2459965, 2459966, 2459967, 2459968, 2459969, 2459970, 2459971, 2459972, 2459973, 2459974, 2459975, 2459976, 2459977, 2459978, 2459979, 2459980, 2459981, 2459982, 2459983, 2459984, 2459985, 2459986, 2459987, 2459988, 2459989, 2459990, 2459991, 2459992, 2459993, 2459994, 2459995, 2459996, 2459997, 2459998, 2459999, 2460000, 2460001, 2460002, 2460003, 2460004, 2460005, 2460006, 2460007, 2460008, 2460009, 2460010, 2460011, 2460012, 2460013, 2460014, 2460015, 2460016, 2460017, 2460018, 2460019, 2460020, 2460021, 2460022, 2460023, 2460024, 2460025, 2460026, 2460027, 2460028, 2460029, 2460030, 2460031, 2460032, 2460033, 2460034, 2460035, 2460036, 2460037, 2460038, 2460039, 2460040, 2460041, 2460042, 2460043, 2460044, 2460045, 2460046, 2460047, 2460048, 2460049, 2460050, 2460051, 2460052, 2460053, 2460054, 2460055, 2460056, 2460057, 2460058, 2460059, 2460060, 2460061, 2460062, 2460063, 2460064, 2460065, 2460066, 2460067, 2460068, 2460069, 2460070, 2460071, 2460072, 2460073, 2460074, 2460075, 2460076, 2460077, 2460078, 2460079, 2460080, 2460081, 2460082, 2460083, 2460084, 2460085, 2460086, 2460087, 2460088, 2460089, 2460090, 2460091, 2460092, 2460093, 2460094, 2460095, 2460096, 2460097, 2460098, 2460099, 2460100, 2460101, 2460102, 2460103, 2460104, 2460105, 2460106, 2460107, 2460108, 2460109, 2460110, 2460111, 2460112, 2460113, 2460114, 2460115, 2460116, 2460117, 2460118, 2460119, 2460120, 2460121, 2460122, 2460123, 2460124, 2460125, 2460126, 2460127, 2460128, 2460129, 2460130, 2460131, 2460132, 2460133, 2460134, 2460135, 2460136, 2460137, 2460138, 2460139, 2460140, 2460141, 2460142, 2460143, 2460144, 2460145, 2460146, 2460147, 2460148, 2460149, 2460150, 2460151, 2460152, 2460153, 2460154, 2460155, 2460156, 2460157, 2460158, 2460159, 2460160, 2460161, 2460162, 2460163, 2460164, 2460165, 2460166, 2460167, 2460168, 2460169, 2460170, 2460171, 2460172, 2460173, 2460174, 2460175, 2460176, 2460177, 2460178, 2460179, 2460180, 2460181, 2460182, 2460183, 2460184, 2460185, 2460186, 2460187, 2460188, 2460189, 2460190, 2460191, 2460192, 2460193, 2460194, 2460195, 2460196, 2460197, 2460198, 2460199, 2460200, 2460201, 2460202, 2460203, 2460204, 2460205, 2460206, 2460207, 2460208, 2460209, 2460210, 2460211, 2460212, 2460213, 2460214, 2460215, 2460216, 2460217, 2460218, 2460219, 2460220, 2460221, 2460222, 2460223, 2460224, 2460225, 2460226, 2460227, 2460228, 2460229, 2460230, 2460231, 2460232, 2460233, 2460234, 2460235, 2460236, 2460237, 2460238, 2460239, 2460240, 2460241, 2460242, 2460243, 2460244, 2460245, 2460246, 2460247, 2460248, 2460249, 2460250, 2460251, 2460252, 2460253, 2460254, 2460255, 2460256, 2460257, 2460258, 2460259, 2460260, 2460261, 2460262, 2460263, 2460264, 2460265, 2460266, 2460267, 2460268, 2460269, 2460270, 2460271, 2460272, 2460273, 2460274, 2460275, 2460276, 2460277, 2460278, 2460279, 2460280, 2460281, 2460282, 2460283, 2460284, 2460285, 2460286, 2460287, 2460288, 2460289, 2460290, 2460291, 2460292, 2460293, 2460294, 2460295, 2460296, 2460297, 2460298, 2460299, 2460300, 2460301, 2460302, 2460303, 2460304, 2460305, 2460306, 2460307, 2460308, 2460309, 2460310

Of these 365 numbers, 23 are prime. They are:

2459953, 2459957, 2459993, 2460013, 2460043, 2460061, 2460083, 2460097, 2460113, 2460127, 2460137, 2460151, 2460179, 2460181, 2460187, 2460193, 2460197, 2460217, 2460229, 2460277, 2460281, 2460299, 2460301

To convert a JDN to date time format, the following code (shown in blue) can be used with output in red:

import pandas as pd

juliandate = 2459168.298

t = pd.to_datetime(juliandate, origin='julian', unit='D')

print(t)

2020-11-14 19:09:07.200000

Applying this to the JDN's that are prime, we get the result shown in Figure 2.


Figure 2: permalink

It should be borne in mind that times are in UTC or Coordinated Universal Time and for Jakarta, 7 hours must be added. Since the Julian day begins at midday UTC, this means that in Jakarta the new day starts at 7 pm. I'm writing this at 9:55am on 18th February 2023 but the Julian Day time is 2459993.622 ... and the JDN (2459993) corresponds to 17th February 2023.

Sunday, 19 December 2021

Mathematical Properties of 2022

It's always interesting to look at the mathematical properties of the number being used to mark the year ahead in the Anno Domini or AD system. At the time of creation of this post, that number is 2022. First and foremost, its factors should be considered and these are 2, 3 and 337 marking it as a so-called sphenic number because it is the product of three distinct primes. 

I've written about these sorts of numbers in two posts titled Sphenic Numbers on June 25th 2018 and Sphenic Numbers Revisited on January 1st 2018. All sphenic numbers have exactly eight divisors and in the case of 2022, these are 1, 2, 3, 6, 337, 674, 1011 and 2022.

2022 has the distinction of belonging to OEIS A105936:


 A105936

Numbers that are the product of exactly 3 primes and are of the form prime(\(n\)) + prime(\(n\)+1).


The initial members are:
8, 12, 18, 30, 42, 52, 68, 78, 138, 172, 186, 222, 258, 268, 410, 434, 508, 548, 618, 668, 762, 772, 786, 892, 906, 946, 978, 1002, 1030, 1132, 1334, 1374, 1446, 1542, 1606, 1758, 1866, 1878, 1948, 2006, 2022, 2252, 2334, 2414, 2452, 2468, 2486, 2572, 2588

It should be noted that not all members of this sequence are sphenic. For example, 12 is a member but it is not a product of three distinct primes because the factor 2 is repeated. In the case of 12, it can be seen that it is the sum of two consecutive primes viz. 5 and 7. For 2022, the two consecutive primes are 1009 and 1013. The fact that they are separated by 4 makes them cousin primes.

Consulting the Online Encyclopaedia of Integer Sequences or OEIS, the second sequence of interest is OEIS A141769:


 A141769

Beginning of a run of 4 consecutive Niven (or Harshad) numbers.  


The initial members of the sequence are:
1, 2, 3, 4, 5, 6, 7, 510, 1014, 2022, 3030, 10307, 12102, 12255, 13110, 60398, 61215, 93040, 100302, 101310, 110175, 122415, 127533, 131052, 131053, 196447, 201102, 202110, 220335, 223167, 245725, 255045, 280824, 306015, 311232, 318800, 325600, 372112, 455422

Harshad or Niven numbers as they are also called are simply numbers that are divisible by their sum of digits. In the case of 2022, it can be seen that it and the three consecutive numbers following it are Harshad. Let's confirm that:$$ \begin{align} \frac{2022}{6}&=337\\ \frac{2023}{7}&=289\\ \frac{2024}{8}&=278\\ \frac{2025}{5}&=405 \end{align}$$ As can be seen such runs are not common. However, it is possible to have runs of up to twenty consecutive Harshad numbers. See Figure 1.

I've written about Harshad numbers in posts titled Harshad Numbers on February 11th 2017 and Harshad Numbers Revisited on June 30th 2018. Figure 1 shows the start of consecutive runs up to 13. Note that the numbers from 1 to 10 are trivially Harshad.


Figure 1: permalink for calculating runs

The next interesting property of 2022 is that not only is it a Harshad number but so are all its powers up to the 7th power. Figure 2 confirms this (SOD stands for Sum Of Digits):


Figure 2: permalink

This property constitutes OEIS A135192:


 A135192

Numbers \(n\) that raised to the powers from 1 to \(k\) (with \(k \geq 1 \)) are multiple of the sum of their digits (\(n\) raised to \(k\)+1 must not be a multiple). Case \(k\)=7.


The initial members of the sequence are:
126, 480, 660, 810, 882, 1020, 1134, 1170, 1260, 1320, 1560, 1590, 2022, 3042, 3222, 4662, 4800, 5670, 5940, 6240, 6600, 7110, 7452, 8100, 8442, 8550, 8820, 8880, 9510, 10110, 10200, 10350, 10620, 10890, 11010, 11106, 11130, 11340, 11460, 11700, 11970
Not only is 2022 a Harshad number but it is also an admirable number, the latter being defined as a number whose sum of proper divisors is equal to the number itself with the proviso that one of the divisors is negative. In the case of 2022, its proper divisors are 1, 2, 3, 6, 337, 674 and 1011 which sum to 2034. However, if the +6 is made -6, then the sum becomes 2022. Moreover, 6 happens to be the digit sum of 2022 since 2 + 2 + 0 + 2 =6. This qualifies 2022 for membership is OEIS A111948


 A111948

Admirable Harshad numbers \(n\) such that the subtracted divisor is equal to the digital sum of \(n\).


The initial members of the sequence are:
24, 42, 114, 222, 402, 2022, 2202, 7588, 8596, 10014, 11202, 12102, 17668, 21102, 27748, 29764, 31002, 32788, 39844, 42868, 43876, 45388, 46396, 48916, 49924, 55972, 56476, 57484, 58492, 65548, 66556, 69076, 70588, 71596, 78148, 81676
2022 is also a self number because there is no number that, when added to its sum of digits, produces 2022. Thus it both a Harshad and a self number which qualifies it for membership in OEIS  A003219:


 A003219

Self numbers divisible by sum of their digits (or, self numbers which are also Harshad numbers).


The initial terms of the sequence are:
1, 3, 5, 7, 9, 20, 42, 108, 110, 132, 198, 209, 222, 266, 288, 312, 378, 400, 468, 512, 558, 648, 738, 782, 804, 828, 918, 1032, 1098, 1122, 1188, 1212, 1278, 1300, 1368, 1458, 1526, 1548, 1638, 1704, 1728, 1818, 1974, 2007, 2022, 2088, 2112, 2156, 2178 
I've written about self numbers in a post titled Self Numbers and Junction Numbers on October 25th 2018.

The next two interesting properties of 2022 involve primes (as did OEIS A105936 mentioned earlier). The first property qualifies it for admission in OEIS A023523 (permalink):


 A023523

a(\(n\)) = prime(\(n\))*prime(\(n\)-1) + 1.                                              


The initial members of the sequence are with prime(0) being considered as 1:
3, 7, 16, 36, 78, 144, 222, 324, 438, 668, 900, 1148, 1518, 1764, 2022, 2492, 3128, 3600, 4088, 4758, 5184, 5768, 6558, 7388, 8634, 9798, 10404, 11022, 11664, 12318, 14352, 16638, 17948, 19044, 20712, 22500, 23708, 25592, 27222, 28892
In the case of 2022, it is the product of the 14th prime (43) and the 15th prime (47) plus 1.

The second interesting property of 2022 involving primes qualifies it for membership in OEIS A064403:


 A064403



Numbers \(k\) such that prime(\(k\)) + \(k\) and prime(\(k\)) - \(k\) are both primes.  


The initial members of this sequence are:
4, 6, 18, 42, 66, 144, 282, 384, 408, 450, 522, 564, 618, 672, 720, 732, 744, 828, 858, 1122, 1308, 1374, 1560, 1644, 1698, 1776, 1848, 1920, 2022, 2304, 2412, 2616, 2766, 2778, 2874, 2958, 2970, 3036, 3042, 3240, 3258, 3354, 3360, 3432, 3540, 3594, 3732

In the case of 2022, the two primes are 19603 and 15559 respectively. 

This next property of 2022 is quite unusual and took me some time to fully grasp. This property qualifies the number for membership in OEIS A335600:


 A335600

The poor sandwiches sequence.                                                 


The sequence runs:
2, 1, 110, 10, 1101, 11010, 3, 330, 30, 3303, 33030, 4, 440, 40, 4404, 44040, 5, 550, 50, 5505, 55050, 6, 660, 60, 6606, 66060, 7, 770, 70, 7707, 77070, 8, 880, 80, 8808, 88080, 9, 990, 90, 9909, 99090, 11, 101, 1010, 22, 20, 202, 220, 2022, 2020, 33, 303, 3030, 44, 404, 4040, 55, 505, 5050, 66, 606, 6060, 77

 The OEIS comments help explain what it's all about:

Imagine we would have a pair of adjacent integers in the sequence like [1951, 2020]. The sandwich would then be made of the rightmost digit of a(n), the leftmost digit of a(n+1) and, in between, the absolute difference of those two digits. The pair [1951, 2020] would then produce the (poor) sandwich 112. 

Why poor? Because a rich sandwich would insert the sum of the digits instead of their absolute difference - that is 132 in this example. Please note that the pair [2020, 1951] would produce the poor and genuine sandwich 011 (we keep the leading zero: these are sandwiches after all, not integers).

Now we want the sequence to be the lexicographically earliest sequence of distinct positive terms such that the successive sandwiches emerging from the sequence rebuild it, digit after digit.

EXAMPLE

The first successive sandwiches are: 211, 101, 011, 011, 101, 033,...

The first one (211) is visible between a(1) = 2 and a(2) = 1; we get the sandwich by inserting the difference 1 between 2 and 1.

The second sandwich (101) is visible between a(2) = 1 and a(3) = 110; we get this sandwich by inserting the difference 0 between 1 and 1.

The third sandwich (011) is visible between a(3) = 110 and a(4) = 10; we get this sandwich by inserting the difference 1 between 0 and 1; etc.

The successive sandwiches rebuild, digit by digit, the starting sequence.

2022 is what is called an untouchable number because it is not equal to the sum of the proper divisors of any number. The untouchable numbers, up to and including 2022, are:

2, 5, 52, 88, 96, 120, 124, 146, 162, 188, 206, 210, 216, 238, 246, 248, 262, 268, 276, 288, 290, 292, 304, 306, 322, 324, 326, 336, 342, 372, 406, 408, 426, 430, 448, 472, 474, 498, 516, 518, 520, 530, 540, 552, 556, 562, 576, 584, 612, 624, 626, 628, 658, 668, 670, 708, 714, 718, 726, 732, 738, 748, 750, 756, 766, 768, 782, 784, 792, 802, 804, 818, 836, 848, 852, 872, 892, 894, 896, 898, 902, 926, 934, 936, 964, 966, 976, 982, 996, 1002, 1028, 1044, 1046, 1060, 1068, 1074, 1078, 1080, 1102, 1116, 1128, 1134, 1146, 1148, 1150, 1160, 1162, 1168, 1180, 1186, 1192, 1200, 1212, 1222, 1236, 1246, 1248, 1254, 1256, 1258, 1266, 1272, 1288, 1296, 1312, 1314, 1316, 1318, 1326, 1332, 1342, 1346, 1348, 1360, 1380, 1388, 1398, 1404, 1406, 1418, 1420, 1422, 1438, 1476, 1506, 1508, 1510, 1522, 1528, 1538, 1542, 1566, 1578, 1588, 1596, 1632, 1642, 1650, 1680, 1682, 1692, 1716, 1718, 1728, 1732, 1746, 1758, 1766, 1774, 1776, 1806, 1816, 1820, 1822, 1830, 1838, 1840, 1842, 1844, 1852, 1860, 1866, 1884, 1888, 1894, 1896, 1920, 1922, 1944, 1956, 1958, 1960, 1962, 1972, 1986, 1992, 2008, 2010, 2022

These numbers constitute OEIS A005114

2022 is a primitive abundant number, since it is smaller than the sum of its proper divisors, none of which is abundant.

2022 is a pseudoperfect number, because it is the sum of a subset of its proper divisors which are 1, 2, 3, 6, 337, 674 and 1011. If the subset {337, 674, 1011} is taken then we have 337 + 674 + 1011 = 2020.

2022 is a Zumkeller number, because its divisors can be partitioned in two sets with the same sum (2028). The divisors of 2022 are 1, 2, 3, 6, 337, 674, 1011 and 2022 and these sum to 4056 or 2 x 2028. There are four groupings of two sets satisfying the condition that each sum to 2028. These are:

  • 6, 2022 and 1, 2, 3, 337, 674, 1011
  • 1, 2, 3, 2022 and 6, 337, 674, 1011
  • 6, 337, 674, 1011 and 1, 2, 3, 2022
  • 1, 2, 3, 337, 674, 1011 and 6, 2022

There's a lot more that could be said about 2022 but I'll leave off with a reference to "dismal" arithmetic or "lunar" arithmetic as it's apparently been renamed. Here is a link to a PDF file of July 5th 2011 that explains what is meant by dismal arithmetic. It's free to download. The famous N.J.A. Sloane who created the OEIS is a co-author. Here is the abstract:

Dismal arithmetic is just like the arithmetic you learned in school, only simpler: there are no carries, when you add digits you just take the largest, and when you multiply digits you take the smallest. This paper studies basic number theory in this world, including analogues of the primes, number of divisors, sum of divisors, and the partition function.

2022 makes an appearance in lunar arithmetic via OEIS A170806:


 A170806

Primes in lunar arithmetic in base 3 written in base 3.   

 In Sloane's paper, there is the following definition:

Theorem 9. In base \(b\) dismal arithmetic, \(n\) is prime if and only if the dismal sum of its distinct dismal prime divisors is equal to \(n\).

I won't go further into this arithmetic in this post but perhaps I will later on.