Monday, 5 August 2024

Forming Digit Equations: A Game

Source

It occurred to me how forming digit equations from five digits might make for an interesting game. After all, Wordle consists of guessing the five letters that make up a hidden word. In the game I'm conceiving of, a five digit number between 10000 and 99999 would be generated. Let's say the number generated is 25529. The challenge is to use only the following operators to form a digit equation without altering the order of the digits:

+    addition

-    subtraction

x    multiplication

/    divide by

|    divide into

^    exponentiation

(     left bracket

)    right bracket

Figure 1 shows one possible representation:

Figure 1

The same digit equation would look mathematically as follows:$$ \Big ( 2 + \frac{5}{5} \Big )^2=9$$This is somewhat on the difficult side. Obviously an effective game nowadays involves a catchy user interface so coloured balls that pop up to start the game would be effective. The operators shown above would need to be able to be dragged and dropped between the digits in order to generate the equation. The successful creation of an equation would need to be displayed in mathematically readable way such as was done with the example of 25529.

The game could have different levels starting at the fairly elementary level. For example, 10348 could be rendered as:$$1+0+3+4=8$$This equation involves only the a single operation, addition, and the correct placement of the equal sign. By contrast, 25529 is considerably more challenging and involves the use of brackets, addition, division and exponentiation. Of course, for some numbers it is impossible to form an equation within the imposed constraints. An example is 27497 which is unsolvable as far as I can see. This is a long term project but something that I will keep thinking about or perhaps I'll discover that someone has already created such a game. Who knows?

For earlier posts on this theme see my posts titled The Number Plate Game from the 29th June 2024 and Forming Equations from the Digits of a Number on 14th March 2024. To generate some random five digits numbers follow this permalink.

Saturday, 3 August 2024

Probability of Reaching a Home Prime

Looking at the 51 steps required for 20240802 to reach a home prime (the subject of my previous post titled A Long Way Home), I fell to wondering about the probability of a composite number forming a prime when its prime factors are concatenated in ascending order, or any order for that matter. The key point is that the prime factors must all end in 1, 3, 7 or 9 and so the numbers that are formed from the concatenation must also end in these same digits. This is the first fact that we must bear in mind.

Another fact is that the likelihood that a randomly chosen number less than \(n\) is prime is (approximately) inversely proportional to the number of digits in \(n\) (source). If we look at the growth in the length of the concatenated numbers that arise from 20240802, we see that starting with eight digits we end up with a prime of 103 digits after 51 steps. This is very close to an increase of two digits per concatenation. As the concatenated numbers get larger, the likelihood of a prime arising decreases in proportion to the length of the number. Armed with these facts, we can set about finding for any starting number the average length of resulting home primes and the average number of steps required to reach them.

Let's start with eight digit composite numbers formed from the dates of the year such as 20,240,802 that arises from the 2nd August 2024. The probality of finding a prime with numbers of this length is 0.05944 but once we reach the home prime of 20240802 with its 103 digits this density has reduced to 0.00422. However, the numbers that are forming from the concatenation all end in 1, 3, 7 or 9 and this considerably boosts the probability of a prime being formed. The 60% of numbers ending in 0, 2, 4, 5, 6 or 8 simply cannot be formed from this type of concatenation. So instead of 0.05944 out of 1, we have 0.05944 out of 0.4 and instead of 0.00422 out of 1, we have 0.00422 out of 0.4 as well. This translates to about 0.1486 and 0.01055.


Matt Parker giving a nod to the taxicab number
in a YouTube video on concatenation: link

So starting with eight digit numbers we have about a 15% chance of forming a prime but by the time we reach 103 digit numbers that chance has plummeted to 1%. So every two digit increase in the length of a number decreases the probability of a prime forming by about 0.28%. Conversely, the chance of a prime NOT forming starts at 85% for an eight digit numbers and increases to 99% for 103 digit numbers. This is an increase of about 0.28% for every one of the approximately 50 steps in the concatenation process. So even though the chances of a prime NOT forming at each step in quite high and increasingly slowly, the chances of a prime NOT forming from successive concatenations quickly becomes quite low. The progression is as follows (rounding to two decimal places):

  • 0.85 to start with
  • 0.72 for the first concatenation
  • 0.53 for two concatenations
  • 0.28 for three concatenations
  • 0.08 for four concatenations
  • 0.01 for five concatenations
  • 0.00 for six concatenations and beyond
The mean is 0.05 so a prime should form between four and five concatenations on average. Clearly though there's more going on than is at first apparent here given that there are 471 numbers less than 10000 for which there are no known home primes with 49 being the first. It would seem likely that there will be many composite numbers without home primes amongst the numbers generated from the daily dates. 

Let's look at the some examples:
  • 20240801 --> 2 steps
  • 20240802 --> 51 steps
  • 20240803 --> 3 steps
  • 20240804 --> unknown
  • 20240805 --> 6 steps
  • 20240806 --> 1 step
  • 20240807 --> prime
  • 20240808 --> 8 steps
  • 20240809 --> 13 steps
  • 20240810 --> 11 steps
  • 20240811 --> 2 steps
  • 20240812 --> 13 steps
  • 20240813 --> 8 steps
  • 20240814 --> 14 steps
  • 20240815 --> unknown
  • 20240816 --> 25 steps
  • 20240817 --> 2 steps
  • 20240818 --> 5 steps
  • 20240819 --> prime
  • 20240820 --> 6 steps
If we ignore the primes, let the two unknowns be nominally 100 and put these results in ascending order, we get 1, 2, 2, 2, 3, 5, 6, 6, 8, 8, 11, 13, 13, 14, 25, 51, 100, 100 which has a median of 8. If we ignore the 51, 100, 100 then we have 1, 2, 2, 2, 3, 5, 6, 6, 8, 8, 11, 13, 13, 14, 25 which has median of 6. This is just a small sample and I'll need to research this topic further.

ADDENDUM

Concatenation of numbers can be achieved in Python and SageMath in two ways, one not involving strings (Method 1) and the other using strings (Method 2). I use the second method it's just simpler to remember. The code for both is as follows (permalink):

# Method 1
base=10
number1=17
number2=29
number=number1*10^(floor(log(floor(number2),base)+1))+number2
print(number)
# Method 2
number=int(str(number1)+str(number2))
print(number)

1729
1729

Friday, 2 August 2024

A Long Way Home

With large composite numbers, the path to a home prime can be a long one. This is certainly true of today's composite number 20240802 corresponding to today's date of 2nd August 2024.$$20240802=2 \times 3^2 \times 863 \times 1303$$I wondered why the algorithm running in my Jupiter Notebook was taking so long to calculate the home prime for today's number. It turns out that 51 steps are required before a home prime is reached. Here's the progression (toward the bottom of the list the larger numbers may run onto the next line):

20240802, 
2338631303, 
2953791951,
311233891689,
33741160974887,
311088424547577,
3347298836142697,
46728012558965891,
64269417270645951,
3713131313117863595291,
73131473868929224040761,
7157142964517218506685541,
37461590937100697383704241,
676775575541914812748937421,
33370837121353850660547143863,
103512102850518963266335968989,
127815055927956842230443590307,
3333334978717647771371995485881457,
35545734763423801200354273504161619,
3115096476834788845097622093725646027,
3171315807287116497834303893733982641037,
1938593133169178678118176191414687586788699,
7806127981924834247371605710953994219337521,
1113109500810161155118640365150812276512107483,
79263561175470733867058721787851202039247470829,
199350779397608484767800851518411783020176720951,
313893271587387422969396469847860991092333976542173,
19916894174850252716742066231437827881452587132198347,
333185411566209479042084941629363924712738008623074892523,
3223494969430572079429042941294041931241139987441774025309,
32950793229023376852456919797337294607377341857102318172479,
301958427353613415282754723578180598828447843204448262081363, 43671933129241050741953825012470051854111324175024183278643133, 3713710348596620298325276499784604740144926044521019175560918133, 43432033318665629558961303257652524300665434496179740124768638737, 438318191912142630256950384088336721700875079874885901277773615661, 33952660372710397050719260552116633226209979280798089039448973313459, 235473639043239560844701954001988841885040187355225129838688185185493, 333671045063366301288318623135523361878429909102403826971796025548984839, 7415772280289158642876806700567063245584286858045263726536419020786144949, 31915460753992647178331840969114638386529105925505411017314020817595444429481, 388215755079417212095611247626509474236722043804223179439175841269325900221647, 43119489467805082469367345227763064513316151461945387396217629252808742563363617, 7178040010219740423774713801327263673054482930504828408891656467662033385134241117, 109316473995628413986454085350966468455812414207316882972860619920620319817943453409, 2323834579133836345413046351762997943556241757630498282284882868364567485130261890219, 317300267606964982136843437711517492491619282822669294694863577107023014585554599905739, 52328463255749224374714279838161134823233769307043696613665389077650729417404884413292271, 3714392062034766290224112375598877216263278646829696160089485291757181880256559477546163399, 3394732071391164431104598827162026435326822795676460127579388576883851144072368157718797931641083, 19294447233994807147867590543139812872007673327880662223899101540689566880289506377715917567105333859
7772349034187438087121221820512743165100759812317447221713249182984386976343967857556366241938724210083

That final number is indeed prime while all the previous numbers back to our starting point of 20240802 are composite. Contrast this with yesterday's date number, 20240801, where:$$ 20240801=7 \times 2891543 $$The progression involves only two steps and is:$$20240801 \rightarrow 72891543 \rightarrow 3191278799$$The day before yesterday only six steps were needed for 20240731 to reach a home prime. 

I've written about home primes in earlier blog posts including Home Primes on 2nd May 2021. There are 471 numbers less than 10000 for which there are no known home primes with 49 being the first. It would seem likely that there are many composite numbers without home primes amongst the numbers generated from the daily dates. 

Wednesday, 31 July 2024

Counting the Days

On this final day of July 2024, it seems appropriate to say something about the date which can be written in YYYYMMDD format as 20240731. In a post from the 26th of January 2023 titled Turning Dates into Numbers, I looked at 2023 in the light of this number format and so I should do the same for 2024 now that we are more than halfway through it. I have an algorithm that I created for generating the list of days in 2024 which, being a leap year, will contain 366 entries. Here is the list:

20240101, 20240102, 20240103, 20240104, 20240105, 20240106, 20240107, 20240108, 20240109, 20240110, 20240111, 20240112, 20240113, 20240114, 20240115, 20240116, 20240117, 20240118, 20240119, 20240120, 20240121, 20240122, 20240123, 20240124, 20240125, 20240126, 20240127, 20240128, 20240129, 20240130, 20240131, 20240201, 20240202, 20240203, 20240204, 20240205, 20240206, 20240207, 20240208, 20240209, 20240210, 20240211, 20240212, 20240213, 20240214, 20240215, 20240216, 20240217, 20240218, 20240219, 20240220, 20240221, 20240222, 20240223, 20240224, 20240225, 20240226, 20240227, 20240228, 20240229, 20240301, 20240302, 20240303, 20240304, 20240305, 20240306, 20240307, 20240308, 20240309, 20240310, 20240311, 20240312, 20240313, 20240314, 20240315, 20240316, 20240317, 20240318, 20240319, 20240320, 20240321, 20240322, 20240323, 20240324, 20240325, 20240326, 20240327, 20240328, 20240329, 20240330, 20240331, 20240401, 20240402, 20240403, 20240404, 20240405, 20240406, 20240407, 20240408, 20240409, 20240410, 20240411, 20240412, 20240413, 20240414, 20240415, 20240416, 20240417, 20240418, 20240419, 20240420, 20240421, 20240422, 20240423, 20240424, 20240425, 20240426, 20240427, 20240428, 20240429, 20240430, 20240501, 20240502, 20240503, 20240504, 20240505, 20240506, 20240507, 20240508, 20240509, 20240510, 20240511, 20240512, 20240513, 20240514, 20240515, 20240516, 20240517, 20240518, 20240519, 20240520, 20240521, 20240522, 20240523, 20240524, 20240525, 20240526, 20240527, 20240528, 20240529, 20240530, 20240531, 20240601, 20240602, 20240603, 20240604, 20240605, 20240606, 20240607, 20240608, 20240609, 20240610, 20240611, 20240612, 20240613, 20240614, 20240615, 20240616, 20240617, 20240618, 20240619, 20240620, 20240621, 20240622, 20240623, 20240624, 20240625, 20240626, 20240627, 20240628, 20240629, 20240630, 20240701, 20240702, 20240703, 20240704, 20240705, 20240706, 20240707, 20240708, 20240709, 20240710, 20240711, 20240712, 20240713, 20240714, 20240715, 20240716, 20240717, 20240718, 20240719, 20240720, 20240721, 20240722, 20240723, 20240724, 20240725, 20240726, 20240727, 20240728, 20240729, 20240730, 20240731, 20240801, 20240802, 20240803, 20240804, 20240805, 20240806, 20240807, 20240808, 20240809, 20240810, 20240811, 20240812, 20240813, 20240814, 20240815, 20240816, 20240817, 20240818, 20240819, 20240820, 20240821, 20240822, 20240823, 20240824, 20240825, 20240826, 20240827, 20240828, 20240829, 20240830, 20240831, 20240901, 20240902, 20240903, 20240904, 20240905, 20240906, 20240907, 20240908, 20240909, 20240910, 20240911, 20240912, 20240913, 20240914, 20240915, 20240916, 20240917, 20240918, 20240919, 20240920, 20240921, 20240922, 20240923, 20240924, 20240925, 20240926, 20240927, 20240928, 20240929, 20240930, 20241001, 20241002, 20241003, 20241004, 20241005, 20241006, 20241007, 20241008, 20241009, 20241010, 20241011, 20241012, 20241013, 20241014, 20241015, 20241016, 20241017, 20241018, 20241019, 20241020, 20241021, 20241022, 20241023, 20241024, 20241025, 20241026, 20241027, 20241028, 20241029, 20241030, 20241031, 20241101, 20241102, 20241103, 20241104, 20241105, 20241106, 20241107, 20241108, 20241109, 20241110, 20241111, 20241112, 20241113, 20241114, 20241115, 20241116, 20241117, 20241118, 20241119, 20241120, 20241121, 20241122, 20241123, 20241124, 20241125, 20241126, 20241127, 20241128, 20241129, 20241130, 20241201, 20241202, 20241203, 20241204, 20241205, 20241206, 20241207, 20241208, 20241209, 20241210, 20241211, 20241212, 20241213, 20241214, 20241215, 20241216, 20241217, 20241218, 20241219, 20241220, 20241221, 20241222, 20241223, 20241224, 20241225, 20241226, 20241227, 20241228, 20241229, 20241230, 20241231

How many of these dates are prime? 21 in fact as opposed to last year's 18. Here are the primes:

20240107, 20240219, 20240323, 20240327, 20240411, 20240419, 20240531, 20240603, 20240611, 20240723, 20240729, 20240807, 20240819, 20240821, 20240903, 20241017, 20241029, 20241119, 20241121, 20241211, 20241229

With the above list of 2024's 366 days we can investigate primeness and many other number properties. As with 2023 however, there can be no palindromes. This will be the case until 2030 when 20300302 or 2nd March 2030 will break the drought. As for today's number, there is no listing for it in the OEIS but Numbers Aplenty provides some information. It has the following factorisation:$$20240731=7 \times 1327 \times 2179$$Additionally it is a:

  • sphenic number since it has three distinct prime factors
  • cyclic number since it has no factors in common with its totient (17328168.)
  • Duffinian number since it has no factors in common with its sum of divisors (23160320)
  • junction number because it is equal to n + sod(n) for n = 20240699 and 20240708.

Using my multipurpose algorithm, running a Jupyter notebook on my laptop (it times out on SageMathCell), I found the following information.

The Collatz Trajectory for 20240731 is:

[20240731, 60722194, 30361097, 91083292, 45541646, 22770823, 68312470, 34156235, 102468706, 51234353, 153703060, 76851530, 38425765, 115277296, 57638648, 28819324, 14409662, 7204831, 21614494, 10807247, 32421742, 16210871, 48632614, 24316307, 72948922, 36474461, 109423384, 54711692, 27355846, 13677923, 41033770, 20516885, 61550656, 30775328, 15387664, 7693832, 3846916, 1923458, 961729, 2885188, 1442594, 721297, 2163892, 1081946, 540973, 1622920, 811460, 405730, 202865, 608596, 304298, 152149, 456448, 228224, 114112, 57056, 28528, 14264, 7132, 3566, 1783, 5350, 2675, 8026, 4013, 12040, 6020, 3010, 1505, 4516, 2258, 1129, 3388, 1694, 847, 2542, 1271, 3814, 1907, 5722, 2861, 8584, 4292, 2146, 1073, 3220, 1610, 805, 2416, 1208, 604, 302, 151, 454, 227, 682, 341, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1]

There are 107 steps required to reach 1 (see Figure 1).

Figure 1: a logarithmic scale has been used for the vertical axis

The Aliquot Sequence for 20240731 is:
[20240731, 2919589, 1, 0]

The Anti-Divisors of 20240731 are:
[2, 3, 11, 14, 33, 1613, 2654, 4358, 18578, 25097, 30506, 1226711, 3680133, 5783066, 13493821]

The Arithmetic Derivative of 20240731 is 2916075

The Maximum - Minimum Recursive Algorithm for 20240731 produces:
[20240731, 74199753, 86317632, 75326643, 53308665, 83299662, 77499423, 76326633, 53326665, 43299666, 76199733, 86408532, 86308632, 86326632, 64326654, 43208766, 85317642, 75308643, 84308652, 86308632]

The number of steps required is to reach home prime is 6 :
[20240731, 713272179, 31719736091, 180117612291, 3187931952743, 31310185086111, 349092126039593]

The multiplicative persistence of 20240731 is as follows:
[20240731, 0]

20240731 has Odds and Evens Trajectory of length 2 and is:
[20240731, 20240734, 20240732, 20240732]

The multipurpose algorithm that I developed has thus proven very useful for large numbers like 20240731 where the OEIS often provides no information. I should develop it further and set it up permanently on my laptop. I'd like to add results of adding and subtracting sums of digits and products of digits for starters but I need to systematically go through my SageMath notebook and include whatever I think might be interesting. For example, the determinant of the circulant matrix of a number comes to mind. This is an enterprise that I should seriously set about undertaking. It will refamiliarise me with many topics that I haven't had contact with for a while.

Tuesday, 30 July 2024

Hidden Palindromes

One of the properties of the number associated with my diurnal age today (27512) has an interesting property that is listed in its Numbers Aplenty entry. 

27512 is a number such that
27512 - product of digits (140) = 27372
a palindromic number

This is by no means obvious at first glance and I wondered how many other numbers in the range up to 40,000 have this property that might formally be stated as follows:

\(n\) is a number such that
\(n\) - product of digits of \(n\) = a palindromic number

It didn't long to discover that there are 320 such numbers in the range up to 40,000. We must remember to exclude numbers containing the digit 0 because in that case the product of the digits will be zero. I'll only list the numbers here between 27512 and 40000 (permalink):

27512, 27582, 27666, 28128, 28184, 28336, 28352, 28398, 28466, 28852, 28924, 28974, 29246, 29562, 29592, 29664, 29778, 29784, 29997, 31231, 31429, 31781, 32199, 32513, 32563, 32627, 32631, 32717, 32753, 33341, 33427, 33477, 33619, 33981, 34237, 34453, 34629, 34691, 34831, 34939, 34953, 35273, 35323, 35483, 35543, 35663, 35813, 35963, 36139, 36563, 36777, 36796, 36888, 36968, 37241, 37419, 38261, 38353, 38593, 38747, 38817, 38867, 38931, 39287, 39489, 39617, 39779

Having subtraced the product of a number's digits, it's natural to consider adding this same product instead of subtracting it. Thus we are searching now for numbers with the property that:

\(n\) is a number such that
\(n\) + product of digits of \(n\) = a palindromic number

There are 305 such numbers in the range up to 40000 with this property and again I've only listed the numbers in a selected range, here between 27889 and 40000 (permalink)

27889, 28452, 28477, 28563, 28572, 28583, 28616, 28624, 28797, 28867, 28953, 29269, 29352, 29377, 29512, 29553, 29593, 31271, 31523, 31641, 31667, 31961, 31989, 32187, 32211, 32353, 32499, 32671, 32841, 32999, 34189, 34277, 34319, 34553, 34647, 34749, 34781, 35383, 35443, 35579, 35623, 35984, 36439, 36563, 36617, 36641, 36648, 36778, 36876, 36911, 36968, 37621, 37686, 37854, 37898, 37959, 37981, 38229, 38311, 38453, 38584, 38717, 38868, 38936, 39231, 39454, 39498, 39524, 39579, 39632, 39646, 39754

Let's take the first number in the previous list, 27889, we see that:

27889 is a number such that
27889 + product of digits (8064) = 35953
a palindromic number

What about numbers that become palindromic when the product of digits is both subtracted and added? We are looking for numbers with these criteria:

\(n\) is a number such that
\(n\) - product of digits of \(n\) = a palindromic number
\(n\) + product of digits of \(n\) = a palindromic number

It turns out that there are 15 of these in the range up 40000, most but not all being palindromic themselves. They are:

1, 2, 3, 4, 247, 252, 348, 843, 15451, 25152, 25252, 25352, 25452, 36563, 36968

Let's take 25452, palindromic itself, as an example:

25452 is a number such that
25452 - product of digits (400) = 25052
25452 + product of digits (400) = 25852
both are palindromic numbers

We can do the same thing with the sum of the digits of a number by subtracting or adding the sum to the number itself. There are 499 and 507 palindromes respectively that result from these two processes. The earlier algorithm is easily modified to generate a list of these numbers. Thus we can search for:

\(n\) is a number such that
\(n\) - sum of digits of \(n\) = a palindromic number

Here is a list of numbers satisfying this criterion from 28800 to 40000 (permalink):

28800, 28801, 28802, 28803, 28804, 28805, 28806, 28807, 28808, 28809, 29610, 29611, 29612, 29613, 29614, 29615, 29616, 29617, 29618, 29619, 30310, 30311, 30312, 30313, 30314, 30315, 30316, 30317, 30318, 30319, 31120, 31121, 31122, 31123, 31124, 31125, 31126, 31127, 31128, 31129, 32840, 32841, 32842, 32843, 32844, 32845, 32846, 32847, 32848, 32849, 33650, 33651, 33652, 33653, 33654, 33655, 33656, 33657, 33658, 33659, 34460, 34461, 34462, 34463, 34464, 34465, 34466, 34467, 34468, 34469, 35270, 35271, 35272, 35273, 35274, 35275, 35276, 35277, 35278, 35279, 36080, 36081, 36082, 36083, 36084, 36085, 36086, 36087, 36088, 36089, 36990, 36991, 36992, 36993, 36994, 36995, 36996, 36997, 36998, 36999, 38600, 38601, 38602, 38603, 38604, 38605, 38606, 38607, 38608, 38609, 39410, 39411, 39412, 39413, 39414, 39415, 39416, 39417, 39418, 39419

Let's take the first of these as an example:

27889 is a number such that
27889 - sum of digits (18) = 28782
a palindromic number

Next we can for look numbers meeting the following criterion:

\(n\) is a number such that
\(n\) + sum of digits of \(n\) = a palindromic number

Here is a list of such numbers in the range from 27547 to 40000 (permalink): 

27547, 27651, 27746, 27850, 27945, 28063, 28158, 28262, 28357, 28461, 28556, 28660, 28755, 28954, 29072, 29167, 29271, 29366, 29470, 29565, 29764, 29859, 29963, 29973, 30000, 30086, 30190, 30285, 30484, 30579, 30683, 30778, 30882, 30991, 31095, 31104, 31294, 31303, 31389, 31493, 31502, 31588, 31692, 31701, 31787, 31891, 31900, 32009, 32113, 32199, 32208, 32312, 32398, 32407, 32511, 32597, 32606, 32710, 32796, 32805, 33018, 33122, 33217, 33321, 33416, 33520, 33615, 33814, 33909, 34027, 34131, 34226, 34330, 34425, 34624, 34719, 34823, 34918, 35036, 35140, 35235, 35434, 35529, 35633, 35728, 35832, 35927, 36045, 36244, 36339, 36443, 36538, 36642, 36737, 36841, 36936, 37054, 37149, 37253, 37348, 37452, 37547, 37651, 37746, 37850, 37945, 38063, 38158, 38262, 38357, 38461, 38556, 38660, 38755, 38954, 39072, 39167, 39271, 39366, 39470, 39565, 39764, 39859, 39963, 39973, 40000

Let's take 27547 as an example:

27547 is a number such that
27547 + sum of digits (25) = 
27572
a palindromic number

What about numbers that result in palindromes when the sum of digits is subtracted and added? We are looking for numbers with these criteria:

\(n\) is a number such that
\(n\) - sum of digits of \(n\) = a palindromic number
\(n\) + sum of digits of \(n\) = a palindromic number

There are 23 such numbers in the range up to 40000 with some but not all being palindromic themselves (permalink):

1, 2, 3, 4, 10, 100, 105, 181, 262, 267, 343, 348, 424, 429, 681, 762, 767, 843, 848, 924, 929, 1000, 10000

Let's take 1000 as an example:

1000 is a number such that
1000 - sum of digits (1) = 999
1000 + sum of digits (1) = 1001
both are palindromic numbers

I've written about sequences arising from numbers in combination with their sum of digits (SoD) or product of digits (PoD) in earlier posts such as:
I've also written extensively about palindromes in posts such as:

Monday, 29 July 2024

Some Special Sphenic Numbers

What struck me about the number associated with my diurnal age today was that it is sphenic and all three factors as well as the number itself share one digit in common, namely the digit 1. The number is:$$27511=11 \times 41 \times 61$$This got me wondering how many sphenic numbers in the range up to 40,000 have this property. Well it turns out that 78 numbers do. These numbers are (permalink):

1

2431, 2717, 4199, 6851, 9061, 10013, 10127, 10153, 11407, 12749, 13243, 13277, 13481, 13981, 14443, 14729, 14839, 15067, 15301, 15587, 15691, 16159, 16523, 17537, 18161, 18733, 18887, 19261, 19591, 19703, 19877, 20801, 21109, 21131, 21307, 21527, 21593, 21607, 22321, 22451, 22781, 23617, 23881, 24149, 24211, 25441, 25619, 27313, 27511, 27911, 28171, 28613, 28951, 29051, 30173, 30481, 30719, 31141, 31229, 31369, 31559, 32021, 32147, 32351, 32513, 32813, 33371, 34441, 34561, 35123, 35717, 36091, 36157, 37169, 37213, 37411, 37417, 39919

Naturally, I decided to investigate the remaining digits from 2 to 9. Here is what I found. 

2

For the digit 2, there are 22 numbers that are sphenic and in which all three factors as well as the number itself share the digit 2 in common. The first such number is 5842:$$5842=2 \times 23 \times 127$$These numbers are (permalink):

5842, 10258, 10442, 11822, 12098, 12238, 12374, 12466, 12742, 12926, 12934, 13282, 13862, 15254, 15602, 16298, 23966, 24058, 24418, 30218, 33442, 38042

3

For the digit 3, there are 138 numbers that are sphenic and in which all three factors as well as the number itself share the digit 3 in common. The first such number is:$$1443=3 \times 13 \times 37$$These numbers are (permalink):

1443, 2139, 2553, 3237, 3441, 3657, 3999, 4773, 5037, 5343, 5883, 6357, 6837, 8103, 9039, 9213, 9321, 9453, 11037, 11063, 11433, 11937, 11973, 12183, 12363, 12543, 13143, 13197, 13287, 13317, 13533, 13611, 13767, 14313, 14937, 15387, 15483, 16377, 17329, 17673, 17931, 18093, 19203, 20397, 20683, 20739, 21183, 21359, 21423, 21783, 21873, 22317, 22839, 23127, 23253, 23907, 23943, 24357, 24753, 25323, 25493, 25737, 25863, 26319, 26381, 26637, 27393, 28137, 28923, 29193, 29739, 30003, 30057, 30147, 30291, 30441, 30567, 30659, 30687, 30783, 30797, 30831, 31341, 31413, 31947, 32097, 32271, 32457, 32523, 32619, 32721, 32829, 33267, 33387, 33449, 33657, 33787, 33927, 34077, 34113, 34131, 34437, 34521, 34611, 34689, 34707, 34743, 34917, 35113, 35187, 35247, 35457, 35619, 35697, 36087, 36177, 36507, 36543, 36593, 36741, 36921, 37047, 37167, 37407, 37789, 37797, 37887, 38001, 38337, 38517, 38739, 38847, 39169, 39183, 39507, 39603, 39849, 39923

4 to 9

There are no numbers in the range up to 40,000 that are sphenic and in which all three factors as well as the number itself share the digit 4 in common. If we consider the range up to one million, we find 20 numbers. The first of these is:$$424883 = 41 \times 43 \times 241$$In the range up to 40,000, there is only one number that is sphenic and in which all three factors as well as the number itself share the digit 5 in common. This is the number:$$15635 = 5 \times 53 \times 59$$There are no numbers in the range up to 40,000 that are sphenic and in which all three factors as well as the number itself share the digit 6 in common. If we consider the range up to one million, we find two numbers. The first of these is:$$666181 = 61 \times 67 \times 163$$There are 14 numbers that are sphenic and in which all three factors as well as the number itself share the digit 7 in common. The first such number is:$$7973 = 7 \times 17 \times 67$$These numbers are (permalink):

7973, 8687, 12173, 12733, 17353, 18907, 19873, 20587, 24017, 27013, 27713, 34237, 37051, 37723

For the digit 8, there are no sphenic numbers that satisfy even in the range up to one million. For the digit 9, there is only one number in the range up to 40,000 that satisfies and that is:$$32509 = 19 \times 29 \times 59$$Before leaving, I'll return to the number that started all this: 27511. It has some other interesting properties involving prime numbers. These are:

  • number + sum of digits is prime: 27511 + 16 = 27527
  • number + product of digits is prime: 27511 + 70 = 27581
  • concatenation of prime factors in ascending order is prime: 114161
  • concatenation 116141 is also prime
The algorithm used earlier can be easily modified (permalinkto accommodate a number of distinct prime factors other than 3. In the case of four distinct prime factors, it is only the digit 3 that yields any numbers in the range up to 40,000. These numbers are:$$ \begin{align} 33189 &= 3 \times 13 \times 23 \times 37 \\38571 &= 3 \times 13 \times 23 \times 43 \end{align} $$Once the range is extended to one million, the digits 1, 2, 3, 4, 5, 6, 7, 8 and 9 have 132, 11, 277, 0, 0, 0, 22, 0 and 0 corresponding numbers respectively.

Saturday, 27 July 2024

Special Sums of Squares

There are many positive integers \(n\) with the property that:$$n=x^2+y^2$$where \(x\) and \(y\) are integers but how frequent are integers with the additional property that \(x\) and \(y\) are both different but share the same digits. The first example of such a number is:$$585 = 12^2+ 21^2$$In fact, up to 40000, there are 51 such numbers. They are:

585, 1130, 1553, 1877, 2340, 2826, 3005, 3329, 3977, 4034, 4520, 4941, 5265, 5330, 5913, 6212, 6698, 6885, 7361, 7508, 7685, 8333, 8642, 8874, 9305, 9360, 10170, 10265, 10589, 11237, 12020, 12506, 13653, 13977, 15650, 17525, 22301, 24804, 27185, 27509, 29930, 30416, 32553, 32877, 33525, 35540, 36026, 36836, 38405, 38729, 39377

Here is a permalink that will generate these numbers and their factorisations. The sequence is not listed in the OEIS. I was drawn to investigate the frequency of these sorts of numbers because the number associated with my diurnal age today, 27509, has this property:$$27509=103^2+130^2$$The number also has the property that the difference of 130 and 103 is 27, a cube, and this qualifies the number for membership of OEIS  A282405:


 A282405



Primes \(p = x^2 + y^2\) such that \(x - y \) is a cube greater than one.



The initial members of the sequence are (permalink):

977, 1049, 1289, 1877, 2477, 2609, 3329, 4877, 5669, 6089, 6977, 8429, 9209, 9749, 10589, 12377, 12689, 13649, 15329, 15877, 16657, 17477, 18617, 18913, 19213, 20773, 21377, 21757, 22093, 22433, 22777, 23833, 23909, 25229, 25673, 26053, 26437, 27509, 30497

The first member of this sequence, 977, has the property that:$$ 977=31^2+4^2\\ \text{where } 31-4=27=3^3$$Of course, the difference need not be a cubic number. It could be a square number. In such case, the numbers belong to OEIS A282406:


 A282406

Primes \(p = x^2 + y^2\) such that \(x - y\) is a square greater than one.



The first member of the sequence is 101 with the property that:$$101=10^2-1^2\\ \text{where }10 -1 = 9 =3^2$$This sequence of numbers in not in the OEIS. The 152 initial numbers, up to 40000, are (permalink):

101, 353, 461, 521, 653, 677, 733, 857, 881, 997, 1153, 1237, 1553, 1613, 1901, 2053, 2153, 2297, 2557, 2693, 2713, 2833, 3061, 3313, 3433, 3581, 3593, 4001, 4013, 4273, 4481, 4637, 4813, 5413, 5981, 6037, 6101, 6301, 6473, 6653, 7121, 7393, 7793, 7853, 7877, 8377, 8521, 8893, 9013, 9157, 9221, 9521, 9697, 9781, 9973, 10253, 10313, 10601, 10861, 11093, 11117, 12301, 12601, 12637, 12941, 12953, 13001, 13597, 13841, 14321, 14593, 14813, 15277, 15641, 15901, 16061, 16333, 16421, 16433, 16693, 16981, 17581, 18313, 18553, 18593, 19301, 19333, 19441, 19661, 19717, 19841, 19961, 20113, 20393, 21001, 21401, 21521, 21601, 21737, 21881, 22153, 22573, 23041, 23081, 23857, 24733, 25121, 25541, 25561, 25621, 26261, 26393, 26513, 26993, 27457, 27653, 27701, 28813, 28901, 29501, 29581, 29761, 29837, 30241, 30661, 30817, 30893, 31393, 31541, 31741, 32141, 32321, 32633, 33581, 33713, 34781, 34897, 35153, 36313, 36493, 36541, 36761, 36821, 37853, 38261, 38321, 38393, 38677, 38821, 39233, 39461, 39521

The algorithm is easily modified to accommodate other roots. We need not restrict ourselves to differences. What about sums? Let's consider:

Primes \(p = x^2 + y^2\) such that \(x + y\) is a square greater than one.

The first example of such a number is:$$53=2^2+7^2\\ \text{where }2+7=9=3^2$$There are 83 such numbers in the range up to 40000. They are (permalink):

53, 317, 337, 353, 373, 397, 457, 577, 1213, 1381, 1621, 2213, 3461, 3593, 3701, 3761, 4481, 4793, 5021, 5393, 5801, 7333, 7433, 7541, 7741, 7933, 8081, 8161, 8521, 9181, 9433, 10133, 10601, 11833, 12421, 13933, 14293, 14321, 14341, 14401, 14461, 14593, 15121, 15581, 16141, 16661, 17093, 17401, 18793, 19181, 19381, 19793, 20441, 21601, 22093, 22861, 24793, 25373, 25457, 25577, 25733, 25793, 25997, 26153, 26237, 26293, 26417, 26513, 26717, 26921, 27241, 27893, 28277, 28433, 29453, 31253, 32633, 33377, 33893, 34157, 35537, 36713, 38273

Similarly we could consider numbers such as:

Primes \(p = x^2 + y^2\) such that \(x + y \) is a cube greater than one.

The first example of such a prime is:$$389=10^2+17^2\\ \text{where }10+17=27=3^3$$The sequence of such numbers is not in the OEIS. There are 27 such numbers in the range up to 40000. They are (permalink):

389, 449, 509, 677, 7817, 7853, 7873, 7993, 8233, 8293, 8573, 8737, 9013, 9437, 10193, 10333, 10477, 11093, 11257, 11597, 11953, 12517, 12713, 13537, 14197, 14657, 15377