Showing posts with label Harshad. Show all posts
Showing posts with label Harshad. Show all posts

Monday, 3 March 2025

Negabinary Niven Numbers

Wow, yesterday's post featured Gray Code Niven Numbers and in today's post we're featuring Negabinary Niven Numbers. Here's what Gemini had to say about negabinary:

Negabinary is a base-negative-2 number system that uses the digits 0 and 1 to represent numbers. It's similar to the binary system, but without the need for a negative sign. 

How to convert to negabinary 

  • To convert a decimal number to negabinary, divide the number by -2 repeatedly. 

  • Record the non-negative remainder of 0 or 1 each time you divide. 

  • Take the remainders in reverse order to get the negabinary expansion.

Why use negabinary?

  • Negabinary doesn't require a negative sign, or two's complement.  

  • All integers, negative or positive, can be written as an unsigned stream of 1s and 0s.  

  • This representation is "more unique" than with a positive base because, without signs, there is not the problem of +0 being equal to -0. 

Related negative-base numeral systems: negadecimal (base −10) and negaternary (base −3). 

There is a great site that converts decimal to negabinary and binary to negabinary and vice versa. See Figure 1. We'll be using it shortly.


Figure 1: link

So what led me to negabinary numbers? Well, the number associated with my diurnal age today (27728) has a property that allows it membership of OEIS A331824.


A331824   Starts of runs of FOUR consecutive positive negabinary-Niven numbers, these are numbers that are divisible by the sum of their digits in their negabinary representation (A027615).

We use the site above to convert the decimal numbers 22728, 22729, 22730 and 22731 to negabinary and then test to see that the total number of 1's for each number divides the number. This is indeed the case. See Table 1.


Table 1: permalink

The initial members of the sequence are 1, 1264, 2104, 2944, 4624, 11888, 23768, 27312, 27728, 31688, 35648. 

Table 2 shows the negabinary representations of the numbers from 0 to 16:


Table 2

Sunday, 2 March 2025

Gray Code Niven Numbers

Let's recall a few facts. A Harshad or Niven number is a number that is divisible by its sum of digits. For example, 21 has a sum of digits of 3 and 3 divides 21 to give 7. Thus 21 is a Niven number, at least in base 10. What about in other bases? Well, in base 7, 21 can be represented as 30 with a sum of digits of 3 again. So 21 is a Niven number in base 7 as well. What about in base 2 where it has a representation of 10101. Again the sum of digits is 3 and thus 21 is also a Niven number in base 2. Of course, 21 is not a Niven number in all bases. In base 8, the number is represented as 25 with a sum of 7 which does not divide into it.


Source

Now I've written about Gray Code in an eponymous post on 18th June 2023 so I won't go into the topic again here. Suffice to say that to generate the Gray Code of a number we convert it to binary and make certain changes to the binary digits. Let's illustrate this by way of the number associated with my diurnal age today, 27727. It's binary representation is 110110001001111 and the Gray Code equivalent is 101101001101000. Now how many 1's are there in the latter. There are seven which corresponds of course to its digit sum. Now 7 divides 27727 because its factorisation is 7 x 17 x 233. So 27727 with its digit sum of 25 is not a Niven number in base 10. Nor is it a Niven number in base 2 where there are nine 1's. However, it is a Gray Code Niven number!

These sorts of numbers caught my attention because of OEIS A344344:


A344344  Starts of runs of 4 consecutive Gray-code Niven numbers (A344341: Gray-code Niven numbers: numbers divisible by the number of 1's in their binary reflected Gray code (A005811)).

Figure 1 shows the results for the four consecutive numbers (permalink):


Figure 1

The initial members of OEIS A344344 are:

1, 6, 30, 126, 510, 543, 783, 903, 2046, 2093, 3773, 3903, 7133, 7743, 8190, 8223, 8703, 10087, 12303, 12543, 14343, 14463, 15423, 15903, 16143, 16263, 20167, 22687, 27727, 30247, 30653, 30783, 32766, 35629, ...

Monday, 23 September 2024

More Numbers Within Numbers


In 
December of 2022, I made a post titled Numbers Within Numbers and so for this post I've made the title More Numbers Within Numbers but the types of numbers considered in the former post are quite different to the ones I'll be considering in this post. The idea for this post came from a peculiarity in the number associated with my diurnal age today: 27567.

What I mean by a number within a number in this present context is simply a substring of the number viewed as a string. Here the substring being considered is "27" that is contained within the larger string "27567". Thus we see that:$$ {\Large \textbf{27} 567}$$Now let's consider the sum of digits of the number:$${\Large \textbf{27} 567 \rightarrow  2 + 7 + 5 + 6+7= \textbf{27}}$$Let's move on to the factorisation where we have:$${\Large \textbf{27} 567= \textbf{27} \times 1021}$$Now what about the totient? We find that 27567 has a totient of 18360 and$$ {\Large 18360 = 5 \times 8 \times 17 \times \textbf{27}} $$Lastly, let's find the absolute value of the determinant of the circulant matrix of 27567. It turns out to be 6777 and$$  {\Large 6777  = \textbf{27} \times 251}  $$Thus in the case of 27567, the number within a number (27) turns up:

  • in the digits of the number
  • as the sum of the digits of the number
  • in the factors of the number
  • in the factors of the totient
  • in the factors of the determinant of the circulant matrix
It can be noted that 27567 is a Harshad number since it is a multiple of its sum of digits (27), and also a Moran number because the ratio is a prime number: 1021 = 27567 / (2 + 7 + 5 + 6 + 7).

The natural question to ask then is how many numbers in the range up to 40000 have this property? It turns out that there are only 18 such numbers with details as shown in Table 1.


Table 1: permalink

So what about other numbers? Let's start with a substring "1". There are five numbers satisfying the previous criteria in the range up to 40000. See Table 2.


Table 2: permalink

For substring "2", there are four numbers satisfying the criteria. See Table 3.


Table 3: permalink

For the substring "3", there are no numbers that meet the criteria. For the substring "4", there are appropriately four numbers that satisfy. See Table 4.


Table 4: permalink

For the substring "5", there are three numbers that meet the criteria. See Table 5.


Table 5: permalink

For substrings "6" and "7", no numbers qualify but for the substring "8" there are three numbers that do. See Table 6.


Table 6: permalink

There are no numbers that satisfy for "9" but there are 23 numbers that satisfy for "10". See Table 7.


Table 7: permalink

For "11", no numbers that satisfy but for "12" there are 39 numbers that satisfy. See Table 8.


Table 8: permalink

For "13", there are two numbers that satisfy. See Table 9.


Table 9: permalink

For "14", there are three numbers that satisfy. See Table 10.


Table 10: permalink

For "15", there are 26 numbers that satisfy. See Table 11.


Table 11: permalink

For "16", there are 14 numbers that satisfy. See Table 12.


Table 12: permalink

For "17", there is only one number. See Table 13.


Table 13: permalink

For "18", there is a grand total of 69 numbers that qualify. See Table 14.


Table 14: permalink

For "19", there are no numbers that qualify but for "20" there are four. See Table 15.


Table 15: permalink

For "21", there are three numbers that qualify. See Table 16.


Table 16: permalink

For "22", there are two numbers that satisfy. See Table 17.


Table 17: permalink

For "23", there is only one number that satisfies. See Table 18.


Table 18: permalink

For "24", there are nine numbers that satisfy. See Table 19.


Table 19: permalink

For "25", there are four numbers that satisfy. See Table 20.


Table 20: permalink

For "26", there are no numbers that qualify and we've already dealt with "27". For "28", there is only one number that satisfies. See Table 21.


Table 21: permalink

That's it for particles in the range up to 40,000 as the SOD criterion makes it difficult  for the digit sum to reach these higher particles. Just to illustrate with an example. Take the particle "29". If we extend the range to one million, then instead of the zero for the range up to 40,000, we have nine numbers that satisfy the criteria. See Table 21.


Table 21: permalink

So, an interesting exercise but purely confined to the realm of recreational Mathematics. There no real reason to conflate the digit sum of a number with its factors as well as its totient and the determinant of its circulant matrix. 

Monday, 15 May 2023

Base-2 Harshad Numbers

I've written explicitly about Harshad numbers in two previous posts: Harshad Numbers on Saturday, 11 February 2017 and Harshad Numbers Revisited on Saturday, 30 June 2018. However, I've only mentioned Base-\(n\) Harshad numbers in passing and so this post will be about them, although the focus will be on the value of \(n=2\).

I was reminded of them because the number associated with my diurnal age today, 27070, has a property that affords it membership in OEIS A330932. Let's remember that Niven numbers are another name for Harshad numbers.


  A330932

Starts of runs of 3 consecutive Niven numbers in base 2 (A049445).          


What characterises a Harshad or Niven number is that it's divisible by the sum of its digits. For example, 12 has a sum of digits of 3 and 3 divides evenly into 12. Hence 12 is a Harshad number in base 10 but what about in base 2? The binary representation of 12 is 1100 and its sum of digits is then 2 which also divides 12 and thus 12 is also a Harshad number in base 2. 

As it turns out, 12 is a Harshad number in all bases but octal where it is represented as 14. The sum of digits, 5, does not divide into 12. There are only four all-harshad numbers and they are 1, 2, 4, and 6. However, let's get back to  27070, 27071 and 27072 and check that they are indeed Harshad numbers:$$\begin{align} 27070 &= 110100110111110_2\\ \text{sum of digits }&=10\\ \frac{27070}{10} &= 2707 \\ \\27071 &= 110100110111111_2\\ \text{sum of digits }&=11\\ \frac{27071 }{11}&=2461 \\ \\ 27072 &= 110100111000000_2\\ \text{sum of digits } &= 6\\ \frac{27072}{6} &= 4512 \end{align}$$So sure enough, 27070 does begin a run of three Harshad numbers in base 2. The other members of the sequence, up to 40000, are (permalink): 623, 846, 2358, 4206, 4878, 6127, 6222, 6223, 12438, 16974, 21006, 27070, 31295, 33102, 33103, 35343, 37134, 37630, 37638.

To quote from Wikipedia:
Cooper and Kennedy proved in 1993 that no 21 consecutive integers are all harshad numbers in base 10. They also constructed infinitely many 20-tuples of consecutive integers that are all 10-harshad numbers, the smallest of which exceeds \(10^{44363342786} \).

H. G. Grundman (1994) extended the Cooper and Kennedy result to show that there are \(2b\) but not \(2b + 1\) consecutive \(b\)-harshad numbers for any base \(b\). This result was strengthened to show that there are infinitely many runs of \(2b\) consecutive b-harshad numbers for \(b = 2\) or \(3\) by T. Cai (1996) and for arbitrary b by Brad Wilson in 1997.

In binary, there are thus infinitely many runs of four consecutive Harshad numbers and in ternary infinitely many runs of six.

Runs of four consecutive base-2 Harshad numbers occur for very large numbers. I checked and there were none in the range up to one million and, I suspect, far beyond this.

Wednesday, 28 December 2022

Some Properties of the Number 2023


For my one hundredth post of the year 2022, I thought I'd create a post about the forthcoming year before it arrives. Firstly, looking at Numbers Aplenty, we find that a
 4×4 square can be tiled in 2023 ways using the L triomino and the monomino. Figure 1 shows four examples and click here to see all 2023 possible arrangements. See OEIS A220054 and A127870.


Figure 1

Another interesting property that Numbers Aplenty brings up is the following:

2023 = (2+0+2+3)(22+02+22+32)2

It also turns out that the prime factors, when concatenated, form a palindrome.

2023 = 7 x 17 x 17 --> 71717

This as it turns out is not a common property (see OEIS A046447). In the range of composite numbers up to 40,000, there are only 193 such numbers. In terms of years, it has been 320 years since this last happened and next occurrence will be rather sooner, in 2048. Here are the numbers (permalink):

4, 8, 9, 16, 25, 27, 32, 39, 49, 64, 69, 81, 119, 121, 125, 128, 129, 159, 219, 243, 249, 256, 259, 329, 339, 343, 403, 429, 469, 507, 512, 625, 669, 679, 729, 795, 1024, 1207, 1309, 1329, 1331, 1533, 1547, 1587, 1589, 1703, 2023, 2048, 2097, 2187, 2319, 2321, 2359, 2401, 2649, 2701, 3039, 3125, 3421, 3503, 3629, 3633, 3639, 3729, 3897, 3899, 3975, 4096, 4303, 4607, 4719, 4839, 5289, 5295, 5547, 5565, 5603, 5739, 6209, 6401, 6561, 6591, 6597, 6979, 7269, 7663, 7819, 7833, 8029, 8192, 8203, 8427, 8519, 8745, 8921, 9329, 9583, 9703, 9707, 9795, 10001, 10021, 10201, 10299, 10599, 10731, 11199, 11499, 12207, 12729, 12795, 13129, 13489, 13573, 13801, 13929, 14133, 14147, 14189, 14295, 14399, 14641, 14829, 15459, 15463, 15549, 15563, 15625, 15987, 16233, 16384, 16507, 16807, 16863, 16959, 17161, 17295, 17363, 17859, 18489, 18789, 18829, 19003, 19683, 19689, 19875, 19907, 20111, 20289, 20489, 20589, 20667, 21259, 21959, 22139, 22507, 22719, 22801, 23019, 23619, 24601, 24901, 25459, 26349, 27879, 28273, 28601, 28609, 28847, 28951, 29729, 29829, 31129, 31363, 31423, 31829, 32357, 32761, 32768, 33173, 33339, 34391, 35143, 36481, 36501, 36763, 36849, 38307, 38899, 38955, 39599, 39939, 39963

On the topic of palindromes, the sum of 2023 and its reverse 3202 is a palindrome. Of all the numbers from 1 to 40,000, there are 9456 (or almost 25%) with this property.

2023 + 3202 = 5225

2023 is also palindromic in base 16 since it equals 7e7. In the range of numbers up to 40,000, this occurs 409 times.
2023 = 7e7

The numbers are:

2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255, 257, 273, 289, 305, 321, 337, 353, 369, 385, 401, 417, 433, 449, 465, 481, 497, 514, 530, 546, 562, 578, 594, 610, 626, 642, 658, 674, 690, 706, 722, 738, 754, 771, 787, 803, 819, 835, 851, 867, 883, 899, 915, 931, 947, 963, 979, 995, 1011, 1028, 1044, 1060, 1076, 1092, 1108, 1124, 1140, 1156, 1172, 1188, 1204, 1220, 1236, 1252, 1268, 1285, 1301, 1317, 1333, 1349, 1365, 1381, 1397, 1413, 1429, 1445, 1461, 1477, 1493, 1509, 1525, 1542, 1558, 1574, 1590, 1606, 1622, 1638, 1654, 1670, 1686, 1702, 1718, 1734, 1750, 1766, 1782, 1799, 1815, 1831, 1847, 1863, 1879, 1895, 1911, 1927, 1943, 1959, 1975, 1991, 2007, 2023, 2039, 2056, 2072, 2088, 2104, 2120, 2136, 2152, 2168, 2184, 2200, 2216, 2232, 2248, 2264, 2280, 2296, 2313, 2329, 2345, 2361, 2377, 2393, 2409, 2425, 2441, 2457, 2473, 2489, 2505, 2521, 2537, 2553, 2570, 2586, 2602, 2618, 2634, 2650, 2666, 2682, 2698, 2714, 2730, 2746, 2762, 2778, 2794, 2810, 2827, 2843, 2859, 2875, 2891, 2907, 2923, 2939, 2955, 2971, 2987, 3003, 3019, 3035, 3051, 3067, 3084, 3100, 3116, 3132, 3148, 3164, 3180, 3196, 3212, 3228, 3244, 3260, 3276, 3292, 3308, 3324, 3341, 3357, 3373, 3389, 3405, 3421, 3437, 3453, 3469, 3485, 3501, 3517, 3533, 3549, 3565, 3581, 3598, 3614, 3630, 3646, 3662, 3678, 3694, 3710, 3726, 3742, 3758, 3774, 3790, 3806, 3822, 3838, 3855, 3871, 3887, 3903, 3919, 3935, 3951, 3967, 3983, 3999, 4015, 4031, 4047, 4063, 4079, 4095, 4097, 4369, 4641, 4913, 5185, 5457, 5729, 6001, 6273, 6545, 6817, 7089, 7361, 7633, 7905, 8177, 8194, 8466, 8738, 9010, 9282, 9554, 9826, 10098, 10370, 10642, 10914, 11186, 11458, 11730, 12002, 12274, 12291, 12563, 12835, 13107, 13379, 13651, 13923, 14195, 14467, 14739, 15011, 15283, 15555, 15827, 16099, 16371, 16388, 16660, 16932, 17204, 17476, 17748, 18020, 18292, 18564, 18836, 19108, 19380, 19652, 19924, 20196, 20468, 20485, 20757, 21029, 21301, 21573, 21845, 22117, 22389, 22661, 22933, 23205, 23477, 23749, 24021, 24293, 24565, 24582, 24854, 25126, 25398, 25670, 25942, 26214, 26486, 26758, 27030, 27302, 27574, 27846, 28118, 28390, 28662, 28679, 28951, 29223, 29495, 29767, 30039, 30311, 30583, 30855, 31127, 31399, 31671, 31943, 32215, 32487, 32759, 32776, 33048, 33320, 33592, 33864, 34136, 34408, 34680, 34952, 35224, 35496, 35768, 36040, 36312, 36584, 36856, 36873, 37145, 37417, 37689, 37961, 38233, 38505, 38777, 39049, 39321, 39593, 39865

2023 is also a:
  • Duffinian number: a composite number that has no factors in common with its sum of divisors \( \sigma(\tau)) \).

  • Harshad number: a number that is divisible by the sum of its digits. In fact, 2022 was a Harshad number and so are 2024 and 2025 we have a run of four consecutive Harshad numbers.

  • Lucky number: a number that survives a sieving process which is similar to the Eratosthenes sieve that can be used to compute the prime numbers.

  • Junction number: a number that can be formed in two ways by adding a number to its sum of digits. Here we have 1997 + sod(1997) = 2015 + sod(2015) = 2023 where sod means sum of digits.
Turning to the Online Encyclopedia of Integer Sequences (OEIS), we find that it is a member of OEIS A063416:


 A063416

Multiples of 7 whose sum of digits is equal to 7.   
                                   


The sequence begins:

7, 70, 133, 322, 511, 700, 1015, 1141, 1204, 1330, 2023, 2212, 2401, 3031, 3220, 4102, 5110, 7000, 10024, 10150, 10213, 10402, 11032, 11221, 11410, 12040, 12103, 13111, 13300, 15001, 20041, 20104, 20230, 21112, 21301, 22120, 23002, 24010 


There is a strong connection between 2023 and the digit 7:
  • the sum of its digits is 7
  • it is divisible by 7
  • both of its factors (7 and 17) contain the digit 7
  • in octal, it has the representation 3747
  • in hexadecimal, it has the representation 7e7
  • in base 17, it has the representation 700
  • its Fibonacci seed numbers are 17 and 49 = 7 x 7
By "Fibonacci seed numbers" I mean that by starting with 17 and 49 and proceeding Fibonacci-style, we get to 2023 thus:

17, 49, 66, 115, 181, 296, 477, 773, 1250, 2023

It is a member of OEIS A070258:

 
A070258

Smallest of 3 consecutive numbers each divisible by a square.              


  • \(2023 = 7 \times 17^2\)
  • \(2024 = 2^3 \times 11 \times 23\)
  • \(2025 = 3^4 \times 5^2\)
The initial members of the sequence are:

48, 98, 124, 242, 243, 342, 350, 423, 475, 548, 603, 724, 774, 844, 845, 846, 1024, 1250, 1274, 1323, 1375, 1420, 1448, 1519, 1664, 1674, 1680, 1681, 1682, 1848, 1862, 1924, 2007, 2023, 2056, 2106, 2150, 2223, 2275, 2348, 2366, 2523, 2527, 2574, 2644

Well, that's largely what I decided to present from Numbers Aplenty and the OEIS. What else is there of interest about the number 2023? I thought I'd ask ChatGPT the following question: what are some interesting facts, mathematical or otherwise, about the number 2023? Figure 2 is a screenshot of what it spat out.


Figure 2

As usual with ChatGPT, when it comes to Mathematics, it can spew out some nonsense. In case, it claims 2023 is a prime number! Similarly, it's claim that "2023 is the sum of three consecutive prime numbers: 661 + 673 + 677 is false. These are indeed consecutive prime numbers but they add up to 2011. Can it get any worse? Well, yes. The claim is made that "2023 is the hypotenuse of a Pythagorean triple: (683, 992, 2023)" and testing this out we find that \(683^2+992^2=1,450,553\) while \(2023^2=4,092,529\).  We're not done yet! Another bold claim is made that "2023 can be written as the sum of two cubes in two different ways: \(2023 = 13^3 + 2^3 = 11^3 + 10^3\) ". Nope. \(13^3+2^3=2205\) and \(11^3+10^3=2331\). It turns out that 2023 cannot be expressed as a sum of two cubes. A final claim is made that 2023 has the representation 11111011111 in binary. No. The correct representation is 11111100111.

Clearly time to give up on ChatGPT as a source of information about Mathematics. I've written about this AI bot's deficiencies in a post titled ChatGPT and a Tragi-Comedy of Integration. Let's not leave off without a final laugh. After the bot's spectacular failures, I asked it: 
I'm impressed in a negative way. Except for points 2 and 6, every mathematical statement that you made was  wrong. 2023 is not a prime number and so on. How can you get things so wrong? 
Its response was: 
I apologize for any errors in my previous response. As a language model, I can provide information and answer questions to the best of my ability based on the knowledge and information that I have been trained on. However, I am not infallible and it is possible for me to make mistakes or provide incorrect information.

In fact, 2023 is not a prime number. It can be divided evenly by 3, 11, and 61, so it is a composite number. I apologize for any confusion this may have caused.

I hope this clears up any misunderstandings and I apologize for any errors in my previous response. Please feel free to ask me any other questions you may have.
Actually, looking at the atomic number of Calcium, I checked and found that it was 20 not 2023. This perhaps gives an insight into what's going wrong with the bot. It's looking at the first two digits (20) and ignoring the last two digits (23). As for the Mathematics, I simply don't know how its coming up with its answers.

All triprimes can be envisaged as "bricks", 3-D solid objects. If all three primes are distinct, we have a sphenic number and an associated sphenic brick. The volume of the brick is the number itself but there is always an associated number: the surface area of the brick. In the case of 2023, the associated number is 1054 (square units). This number is sphenic and the associated sphenic brick has a surface area of 1246 square units. This number in turn is sphenic and the associated area is 1630 square units. Once again, 1630 is sphenic with associated surface area of 2302 square units. At this point, the chain is broken because 2302 is biprime. This is summarised below:$$ \begin{align} 2023 &= 7 \times 17 \times 17 &\rightarrow 1054\\1054 &= 2 \times 17 \times 31 &\rightarrow 1246\\1246 &= 2 \times 7 \times 89 &\rightarrow 1630\\1630&= 2 \times 5 \times 163 &\rightarrow 2302\\2302 &= 2 \times 1151 \end{align}$$Figure 3 shows a list of the triprime numbers between 2000 and 2100. Thus there is another twelve years before another triprime number, 2035, is encountered. 2035 is also a sphenic number because it has three distinct factors


Figure 3

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.