Showing posts with label decimal. Show all posts
Showing posts with label decimal. Show all posts

Sunday, 20 July 2025

Hexadecimal Words

Certain hexadecimal numbers contain only letters between A (10) and F (16) and so can form English words. The commonly accepted words are:

a, aba, abaca, abed, accede, acceded, ace, aced, ad, add, added, baa, baad, babe, bad, bade, baff, baffed, be, bead, beaded, bed, bedded, bee, beef, beefed, cab, cad, cade, cafe, cede, ceded, cee, dab, dabbed, dace, dad, daff, dead, deaf, decade, dee, deed, deeded, deface, defaced, ebb, ebbed, efface, effaced, fa, facade, face, faced, fad, fade, faded, fed, fee, feed

These hexadecimal "words" with their decimal equivalents are shown below (arranged alphabetically):

10 --> a
2746 --> aba
703178 --> abaca
44013 --> abed
11325150 --> accede
181202413 --> acceded
2766 --> ace
44269 --> aced
173 --> ad
2781 --> add
712173 --> added
2986 --> baa
47789 --> baad
47806 --> babe
2989 --> bad
47838 --> bade
47871 --> baff
12255213 --> baffed
190 --> be
48813 --> bead
12496365 --> beaded
3053 --> bed
12508653 --> bedded
3054 --> bee
48879 --> beef
12513261 --> beefed
3243 --> cab
3245 --> cad
51934 --> cade
51966 --> cafe
52958 --> cede
847341 --> ceded
3310 --> cee
3499 --> dab
14334957 --> dabbed
56014 --> dace
3501 --> dad
56063 --> daff
57005 --> dead
57007 --> deaf
14600926 --> decade
3566 --> dee
57069 --> deed
14609901 --> deeded
14613198 --> deface
233811181 --> defaced
3771 --> ebb
965613 --> ebbed
15727310 --> efface
251636973 --> effaced
250 --> fa
16435934 --> facade
64206 --> face
1027309 --> faced
4013 --> fad
64222 --> fade
1027565 --> faded
4077 --> fed
4078 --> fee
65261 --> feed

The decimal numbers in ascending order are:

10, 173, 190, 250, 2746, 2766, 2781, 2986, 2989, 3053, 3054, 3243, 3245, 3310, 3499, 3501, 3566, 3771, 4013, 4077, 4078, 44013, 44269, 47789, 47806, 47838, 47871, 48813, 48879, 51934, 51966, 52958, 56014, 56063, 57005, 57007, 57069, 64206, 64222, 65261, 703178, 712173, 847341, 965613, 1027309, 1027565, 11325150, 12255213, 12496365, 12508653, 12513261, 14334957, 14600926, 14609901, 14613198, 15727310, 16435934, 181202413, 233811181, 251636973

OEIS A132676 shows these same numbers. 

If we are only interested in decimal numbers whose hexadecimal equivalents contain only letters and no digits from 0 to 9 then these are listed in OEIS A228774. Up to 40000, there are 258 of them and they can be generated via this permalink.

10, 11, 12, 13, 14, 15, 170, 171, 172, 173, 174, 175, 186, 187, 188, 189, 190, 191, 202, 203, 204, 205, 206, 207, 218, 219, 220, 221, 222, 223, 234, 235, 236, 237, 238, 239, 250, 251, 252, 253, 254, 255, 2730, 2731, 2732, 2733, 2734, 2735, 2746, 2747, 2748, 2749, 2750, 2751, 2762, 2763, 2764, 2765, 2766, 2767, 2778, 2779, 2780, 2781, 2782, 2783, 2794, 2795, 2796, 2797, 2798, 2799, 2810, 2811, 2812, 2813, 2814, 2815, 2986, 2987, 2988, 2989, 2990, 2991, 3002, 3003, 3004, 3005, 3006, 3007, 3018, 3019, 3020, 3021, 3022, 3023, 3034, 3035, 3036, 3037, 3038, 3039, 3050, 3051, 3052, 3053, 3054, 3055, 3066, 3067, 3068, 3069, 3070, 3071, 3242, 3243, 3244, 3245, 3246, 3247, 3258, 3259, 3260, 3261, 3262, 3263, 3274, 3275, 3276, 3277, 3278, 3279, 3290, 3291, 3292, 3293, 3294, 3295, 3306, 3307, 3308, 3309, 3310, 3311, 3322, 3323, 3324, 3325, 3326, 3327, 3498, 3499, 3500, 3501, 3502, 3503, 3514, 3515, 3516, 3517, 3518, 3519, 3530, 3531, 3532, 3533, 3534, 3535, 3546, 3547, 3548, 3549, 3550, 3551, 3562, 3563, 3564, 3565, 3566, 3567, 3578, 3579, 3580, 3581, 3582, 3583, 3754, 3755, 3756, 3757, 3758, 3759, 3770, 3771, 3772, 3773, 3774, 3775, 3786, 3787, 3788, 3789, 3790, 3791, 3802, 3803, 3804, 3805, 3806, 3807, 3818, 3819, 3820, 3821, 3822, 3823, 3834, 3835, 3836, 3837, 3838, 3839, 4010, 4011, 4012, 4013, 4014, 4015, 4026, 4027, 4028, 4029, 4030, 4031, 4042, 4043, 4044, 4045, 4046, 4047, 4058, 4059, 4060, 4061, 4062, 4063, 4074, 4075, 4076, 4077, 4078, 4079, 4090, 4091, 4092, 4093, 4094, 4095

The final number (4095) in the list above is equivalent to "f f f" in hexadecimal. All the English words listed at the start of this post will be included in this list of course. Up to one million, there are 8034 such decimal numbers with letter-only hexadecimal equivalents and there are significant gaps between groups of numbers. See Figure 1.


Figure 1: permalink
On vertical scale 1.0 = One Million

Saturday, 10 August 2024

Radix Economy

In a coffee shop this afternoon, I was reading an interesting article in Quanta Magazine titled How Base 3 Computing Beats Binary. I like the graphic also that began the article and which I've reproduced in Figure 1.


Figure 1: source

The article introduces the notion of "radix economy" that is explained as follows:

The hallmark feature of ternary notation is that it’s ruthlessly efficient. With two binary bits, you can represent four numbers. Two “trits” — each with three different states — allow you to represent nine different numbers. A number that requires 42 bits would need only 27 trits.

If a three-state system is so efficient, you might imagine that a four-state or five-state system would be even more so. But the more digits you require, the more space you’ll need. It turns out that ternary is the most economical of all possible integer bases for representing big numbers.

To see why, consider an important metric that tallies up how much room a system will need to store data. You start with the base of the number system, which is called the radix, and multiply it by the number of digits needed to represent some large number in that radix. For example, the number 100,000 in base 10 requires six digits. Its “radix economy” is therefore 10 × 6 = 60. In base 2, the same number requires 17 digits, so its radix economy is 2 × 17 = 34. And in base 3, it requires 11 digits, so its radix economy is 3 × 11 = 33. For large numbers, base 3 has a lower radix economy than any other integer base.

This Wikipedia article explains it in more formal terms for a number \(N\):$$ \text{radix economy of } N =b \lfloor \log_b(N)+1 \rfloor $$For large \(N\) we can thus write:$$ \begin{align} \text{radix economy of } N &\approx b \log_b(N) \\ &= \frac{b}{ln \,(b)} ln \,(N) \end{align}$$Using the number 123456789 as an example, the radix efficiency for integer bases from 3 to 16 is shown in Figure 2.

Figure 2: base 3 is best

The Quanta article goes on to say that:

In addition to its numerical efficiency, base 3 offers computational advantages. It suggests a way to reduce the number of queries needed to answer questions with more than two possible answers. A binary logic system can only answer “yes” or “no.” So if you’re comparing two numbers, x and y, to find out which is larger, you might first ask the computer “Is x less than y?” If the answer is no, you need a second query: “Is x equal to y?” If the answer is yes, then they’re equal; if the answer is no, then y is less than x. A system using ternary logic can give one of three answers. Because of this, it requires only one query: “Is x less than, equal to, or greater than y?”

And finally, also quoting from the article:

Surprisingly, if you allow a base to be any real number, and not just an integer, then the most efficient computational base is the irrational number e.

The table in Figure 2 looks as shown in Figure 3 when we add "e" to the list of bases.

Figure 3: e is best

Representing numbers using "e" as the number base is the stuff of a future post perhaps but here is a link to how to go about it. 

Friday, 8 March 2024

Quaternary Number System

The number associated with my diurnal age today, 27368, has the property that its prime factors contain only the digits 1, 2 and 3. Specifically:$$27368=2 \times 2 \times 2 \times 11 \times 311$$This got me thinking about what numbers in the range up to 333,321 contain only the digits 1, 2, 3 and have prime factors that also only contain the digits 1, 2, 3. It turns out that there are only seven such numbers and they are (permalink):$$ \begin{align} 132 &= 2^2 \times 3 \times 11\\312 &= 2^3 \times 3 \times 13\\11132 &= 2^2 \times 11^2 \times 23\\11232 &= 2^5 \times 3^3 \times 13\\13312 &= 2^{10} \times 13\\123132 &= 2^2 \times 3 \times 31 \times 331\\132122 &= 2 \times 31 \times 2131 \end{align}$$For brevity, I've written the factorisation in base-index format and so digits greater than 1, 2, 3 appear but these of course disappear when the factorisation is not written in base-index format.

The appearance of the digits 1, 2, 3 only is reminiscent of the quaternary number system even though what is written previously is in base 10. The quaternary equivalents of the previous decimal numbers are:$$ \begin{align} 132 &= 2010_{4}\\312 &= 10320_4\\11132 &= 2231330_4\\11232 &= 2233200_4\\13312 &= 3100000\\123132 &= 132003330_4\\132122 &= 200100122_4 \end{align} $$The factorisation of the quaternary numbers will contain the same number of factors and single digit factors will remain the same but multidigit factors will appear as their quaternary equivalents. Thus:$$ \begin{align} 13312 &= 2^{10} \times 13 \text{ and}\\3100000_4 &=2_4^{22_4} \times 31_4 \end{align} $$Of course, the quaternary number system also contains the digit 0 and so it's fair to ask what numbers up to 333,210 contain all the digits 0, 1, 2 and 3 (multiplicity allowed) and have prime factors that also contain only these digits (again with multiplicity allowed). It turns out that there is only one such number in the range up to one million. It is:$$133012 = 2^2 \times 11 \times 3023$$I thought I'd ask Google's Gemini about the quaternary number system.
Can you give me some interesting facts about and uses of the quaternary or base 4 number system?

The quaternary (base-4) system, while not as common as binary or decimal, holds some interesting properties and potential uses. Here are some fun facts and applications:

Interesting Facts:
  • Fewer Digits: Compared to binary, quaternary uses fewer digits to represent the same numerical value. For example, 10 in binary is 1010, while in quaternary it's simply 22.
  • DNA Connection: The four building blocks of DNA (Adenine, Guanine, Cytosine, and Thymine) can be seen as a quaternary system, with each combination representing a specific unit of genetic information.
  • Error Detection: Quaternary finds some niche applications in fault-tolerant computer systems. By using 4 possible states (0, 1, 2, 3) instead of 2 in binary, it allows for additional error detection and correction mechanisms.
Potential Uses:
  • Educational Tool: Quaternary can be a stepping stone for learning binary. Due to its simplicity (using only 4 digits), it can be easier to grasp the concept of positional number systems before moving to binary's base-2 system.
  • Space Exploration: Some proposals for future spacefaring computers suggest using quaternary systems due to their potential radiation hardness. Quaternary systems might be more resistant to the corrupting effects of cosmic radiation compared to traditional binary systems. (This is an area of ongoing research)
  • Signal Processing: Quaternary can be used in certain signal processing applications where reducing the number of states while maintaining some level of complexity compared to binary might be beneficial. However, extensive binary infrastructure makes widespread adoption less likely.
Overall, the quaternary number system offers a unique perspective on representing numbers. While not as widely used as binary or decimal, it has interesting properties and potential applications in specific areas like education, fault-tolerant systems, and possibly even future space exploration.

Here is some further information about the connection with DNA taken from this source:

Parallels can be drawn between quaternary numerals and the way genetic code is represented by DNA. The four DNA nucleotides in alphabetical order, abbreviated A, C, G and T, can be taken to represent the quaternary digits in numerical order 0, 1, 2, and 3. With this encoding, the complementary digit pairs 0↔3, and 1↔2 (binary 00↔11 and 01↔10) match the complementation of the base pairs: A↔T and C↔G and can be stored as data in DNA sequence. For example, the nucleotide sequence GATTACA can be represented by the quaternary number 2033010 (= decimal 9156 or binary 10 00 11 11 00 01 00).

Sunday, 18 June 2023

Gray Code

I'd never heard of this before. I came across it when looking at the properties associated with my diurnal age of 27104. One of its properties is that it's a member of OEIS A265385:


 A265385

Sequence defined by a(1) = a(2) = 1 and a(\(n\)) = gray(a(\(n\)-1) + a(\(n\)-2)), with gray(\(m\)) = A003188(\(m\)).


Here's what Wikipedia has to say on the topic:
The reflected binary code (RBC), also known as reflected binary (RB) or Gray code after Frank Gray, is an ordering of the binary numeral system such that two successive values differ in only one bit (binary digit).

For example, the representation of the decimal value "1" in binary would normally be "001" and "2" would be "010". In Gray code, these values are represented as "001" and "011". That way, incrementing a value from 1 to 2 requires only one bit to change, instead of two.

Gray codes are widely used to prevent spurious output from electromechanical switches and to facilitate error correction in digital communications such as digital terrestrial television and some cable TV systems.

Table 1 shows the relationships between binary, gray code and decimal.


Table 1: source


To understand how this OEIS arises, I needed a way to convert binary to gray code and this site provided some Python code to achieve this. I modified it slightly to accept decimal input (permalink). Armed with this, I began to investigate the sequence. 

The initial values are 1 and 1 and these sum to 2. The binary code for 2, as can be seen from Table 1, is 0010 which the Gray code converts to 0011 and this has a decimal equivalent of 3. Proceeding like this we have:
  • 1 first seed value
  • 1 second seed value
  • 1 + 1 = 2 --> 3
  • 1 + 3 = 4 --> 6
  • 3 + 6 = 9 --> 13
  • 6 + 13 =19 --> 26
  • 13 + 26 = 39 --> 52
  • 26 + 52 = 78 --> 105
  • 52 + 105 = 157 --> 211
  • 105 + 211 = 316 --> 418
  • 211 + 418 = 629 --> 847
  • 418 + 847 = 1265 --> 1673
  • 847 + 1673 = 2520 --> 3380
  • 1673 + 3380 = 5053 --> 6755
  • 3380 + 6755 = 10135 --> 13404
  • 6755 + 13404 = 20159 --> 27104

The OEIS comments note that:
This recurrence is reminiscent of Fibonacci's, except that the result of each step is passed through the binary-reflected Gray code mapping, which introduces a degree of pseudo-randomness. 

However, the ratio of successive terms doesn't approach the Golden Ratio but instead fluctuates around 2 with a variation of about 1% above and below. Here are the successive ratios of \( \frac{(n+1)^{th} \text{ term}}{n^{th} \text{ term}}\):

3.0000000, 2.0000000, 2.1666667, 2.0000000, 2.0000000, 2.0192308, 2.0095238, 1.9810427, 2.0263158, 1.9752066, 2.0203228, 1.9985207, 1.9843079, 2.0220830, 1.9752804, 2.0203033, 1.9986779, 1.9841292, 2.0220523, 1.9752920, 2.0202956, 1.9986750, 1.9841298, 2.0220479, 1.9752930, 2.0202950, 1.9986749, 1.9841299, 2.0220478, 1.9752930, 2.0202950, 1.9986725

There's lots of YouTube videos explaining about Gray code and I'm happy to have finally stumbled upon this clever manipulation of binary code. The OEIS A003188 referred to above lists the decimal equivalents of the Gray code for integers \(n\). The result is a permutation of the order of the cardinal numbers as shown for \(n\) up to 70:

  • 0 --> 0
  • 1 --> 1
  • 2 --> 3
  • 3 --> 2
  • 4 --> 6
  • 5 --> 7
  • 6 --> 5
  • 7 --> 4
  • 8 --> 12
  • 9 --> 13
  • 10 --> 15
  • 11 --> 14
  • 12 --> 10
  • 13 --> 11
  • 14 --> 9
  • 15 --> 8
  • 16 --> 24
  • 17 --> 25
  • 18 --> 27
  • 19 --> 26
  • 20 --> 30
  • 21 --> 31
  • 22 --> 29
  • 23 --> 28
  • 24 --> 20
  • 25 --> 21
  • 26 --> 23
  • 27 --> 22
  • 28 --> 18
  • 29 --> 19
  • 30 --> 17
  • 31 --> 16
  • 32 --> 48
  • 33 --> 49
  • 34 --> 51
  • 35 --> 50
  • 36 --> 54
  • 37 --> 55
  • 38 --> 53
  • 39 --> 52
  • 40 --> 60
  • 41 --> 61
  • 42 --> 63
  • 43 --> 62
  • 44 --> 58
  • 45 --> 59
  • 46 --> 57
  • 47 --> 56
  • 48 --> 40
  • 49 --> 41
  • 50 --> 43
  • 51 --> 42
  • 52 --> 46
  • 53 --> 47
  • 54 --> 45
  • 55 --> 44
  • 56 --> 36
  • 57 --> 37
  • 58 --> 39
  • 59 --> 38
  • 60 --> 34
  • 61 --> 35
  • 62 --> 33
  • 63 --> 32
  • 64 --> 96
  • 65 --> 97
  • 66 --> 99
  • 67 --> 98
  • 68 --> 102
  • 69 --> 103
  • 70 --> 101

Saturday, 13 May 2023

The March of Time

I've written about what I term AD and BC numbers in a post titled, quite sensibly, AD and BC Numbers. I was reminded of them because my diurnal age today, 27068, converts to 69BC in hexadecimal. For some time now, these BC numbers have been occurring every 256 days.

24764 --> 60bc

25020 --> 61bc

25276 --> 62bc

25532 --> 63bc

25788 --> 64bc

26044 --> 65bc

26300 --> 66bc

26556 --> 67bc

26812 --> 68bc

27068 --> 69bc

However, this regular march of time is now at an end because if 256 is added to 27068, the resultant number (27324) is 6ABC. The decimal equivalent of 70AD is 28845, representing a jump of 1792 or 7 x 256 days.


Similarly, I recently turned 27053 days old which is 69AD in hexadecimal. Notice the difference of 14 days between 69AD and 69BC. This number was also the end of a run of numbers differing by 256 days.
 

24749 --> 60ad


25005 --> 61ad


25261 --> 62ad


25517 --> 63ad


25773 --> 64ad


26029 --> 65ad


26285 --> 66ad


26541 --> 67ad


26797 --> 68ad


27053 --> 69ad


The decimal equivalent of 70AD is 28845, again a jump of 1792 or 7 x 256 days. Taken over a long enough time period, this represents an average advance of a little over 395.6 days, about a month longer than the solar year. Both AD and BC dates are advancing at this average rate.


However, it will almost five years before I encounter another hexadecimal AD and BC number so I thought it important to mark the fact in this post. While exercises like this may seem frivolous, they nonetheless provide an opportunity to work with hexadecimal numbers and convert from decimal to hexadecimal and vice versa. I'm always thinking in terms of the former mathematics teacher who I once was.


How can hexadecimal numbers be made interesting for students? These AD and BC numbers are a way of doing this. The question could be asked of students:

Find out your diurnal age and determine when you will next have a connection to AD or BC year (via decimal to hexadecimal conversion). What was significant about that year.

See my post titled 69BC for details on what was significant about this year in history. Students could be shown how to determine their diurnal age using Wolfram Alpha and they could also use it to convert between decimal and hexadecimal. Overall, a useful and interesting exercise.

Monday, 26 December 2022

Numbers Within Numbers

As sometimes happens, the number associated with my diurnal age seems to contain nothing much of interest. Today the number was 26930 and I was temporarily stuck. However, I noticed something in Numbers Aplenty. See Figure 1.


Figure 1

The hexadecimal representation of 26930 is 6932. All the digits in the hexadecimal representation are contained within the decimal representation, each in the same proportion. I thought that this would be an interesting criterion to apply to the numbers from 10 to 40000. The numbers from 0 to 9 trivially satisfy the criterion. 

It turns out that there are only 90 decimal numbers that satisfy. This is the list (Permalink):

Hex     Decimal

35 --- 53
173 --- 371
391 --- 913
411 --- 1041
412 --- 1042
413 --- 1043
414 --- 1044
415 --- 1045
416 --- 1046
417 --- 1047
418 --- 1048
419 --- 1049
541 --- 1345
791 --- 1937
821 --- 2081
822 --- 2082
823 --- 2083
824 --- 2084
825 --- 2085
826 --- 2086
827 --- 2087
828 --- 2088
829 --- 2089
1004 --- 4100
1415 --- 5141
1524 --- 5412
1826 --- 6182
2008 --- 8200
2419 --- 9241
3012 --- 12306
4010 --- 16400
4011 --- 16401
4012 --- 16402
4013 --- 16403
4014 --- 16404
4015 --- 16405
4017 --- 16407
4018 --- 16408
4019 --- 16409
4167 --- 16743
4815 --- 18453
5021 --- 20513
5042 --- 20546
5221 --- 21025
6251 --- 25169
6528 --- 25896
6582 --- 25986
6702 --- 26370
6872 --- 26738
6921 --- 26913
6932 --- 26930
7221 --- 29217
7412 --- 29714
7830 --- 30768
7840 --- 30784
8020 --- 32800
8021 --- 32801
8022 --- 32802
8024 --- 32804
8025 --- 32805
8026 --- 32806
8027 --- 32807
8028 --- 32808
8029 --- 32809
8052 --- 32850
8335 --- 33589
8834 --- 34868
8840 --- 34880
8841 --- 34881
8842 --- 34882
8844 --- 34884
8845 --- 34885
8846 --- 34886
8847 --- 34887
8848 --- 34888
8849 --- 34889
9026 --- 36902
9056 --- 36950
9274 --- 37492
9830 --- 38960
9831 --- 38961
9832 --- 38962
9833 --- 38963
9834 --- 38964
9835 --- 38965
9837 --- 38967
9838 --- 38968
9839 --- 38969
9848 --- 38984
9982 --- 39298

The hexadecimal numbers will have the same or fewer digits than the decimal ones. Here is the list of decimal numbers on their own:

53, 371, 913, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1345, 1937, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 4100, 5141, 5412, 6182, 8200, 9241, 12306, 16400, 16401, 16402, 16403, 16404, 16405, 16407, 16408, 16409, 16743, 18453, 20513, 20546, 21025, 25169, 25896, 25986, 26370, 26738, 26913, 26930, 29217, 29714, 30768, 30784, 32800, 32801, 32802, 32804, 32805, 32806, 32807, 32808, 32809, 32850, 33589, 34868, 34880, 34881, 34882, 34884, 34885, 34886, 34887, 34888, 34889, 36902, 36950, 37492, 38960, 38961, 38962, 38963, 38964, 38965, 38967, 38968, 38969, 38984, 39298

The algorithm can  be easily modified to accommodate bases up to 36 and the range can be extended, let's say to 100,000. Here are the results for base 36 in the range up to 100,000 (Permalink):

Base 36 Decimal

41 --- 145
75 --- 257
185 --- 1589
213 --- 2631
247 --- 2743
268 --- 2816
291 --- 2917
340 --- 4032
573 --- 6735
659 --- 7965
680 --- 8064
814 --- 10408
850 --- 10548
896 --- 10698
1357 --- 50731
1504 --- 53140
1875 --- 57281

There are only 17 decimal numbers that satisfy in this range. These are listed below in decimal form only:

145, 257, 1589, 2631, 2743, 2816, 2917, 4032, 6735, 7965, 8064, 10408, 10548, 10698, 50731, 53140, 57281

If we wish to look at bases below 10 then the numbers will have the same or more digits and so the algorithm will need to be modified. We will require all the digits in base 10 format to be contained within the number in the lower base format and these digits need to be in the same proportion. Here are the results for base 8 in range from 8 to 40,000 (Permalink):

Base 8 Decimal

107 --- 71
1347 --- 743
1357 --- 751
2371 --- 1273
3165 --- 1653
4152 --- 2154
6130 --- 3160
6131 --- 3161
6132 --- 3162
6133 --- 3163
6134 --- 3164
6135 --- 3165
6136 --- 3166
6137 --- 3167
6232 --- 3226
12765 --- 5621
13620 --- 6032
14562 --- 6514
15713 --- 7115
15720 --- 7120
15721 --- 7121
15722 --- 7122
15723 --- 7123
15724 --- 7124
15726 --- 7126
15727 --- 7127
15764 --- 7156
17074 --- 7740
37621 --- 16273
52371 --- 21753
73560 --- 30576
75341 --- 31457
102345 --- 34021
102473 --- 34107
103462 --- 34610
104365 --- 35061
105436 --- 35614
106273 --- 36027
106347 --- 36071

There are only 39 numbers that satisfy. Here is the list in decimal format only:

71, 743, 751, 1273, 1653, 2154, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3226, 5621, 6032, 6514, 7115, 7120, 7121, 7122, 7123, 7124, 7126, 7127, 7156, 7740, 16273, 21753, 30576, 31457, 34021, 34107, 34610, 35061, 35614, 36027, 36071

Thus it can be seen that whenever a number seems boring, there is always something of interest that remains to be discovered and that property can often be generalised, as was done here, to find interesting properties of other numbers.

Getting back to comparing decimal numbers to their hexadecimal equivalents we can make conditions more stringent by requiring that the lengths of both numbers be the same so that the digits of both are simply permutations of the other. In the range up to 100,000, there are 24 numbers that qualify. These are (Permalink):

Hex Decimal

35 --- 53
173 --- 371
391 --- 913
1004 --- 4100
1415 --- 5141
1524 --- 5412
1826 --- 6182
2008 --- 8200
2419 --- 9241
12570 --- 75120
12571 --- 75121
12572 --- 75122
12573 --- 75123
12574 --- 75124
12575 --- 75125
12576 --- 75126
12577 --- 75127
12578 --- 75128
12579 --- 75129
12765 --- 75621
15086 --- 86150
16549 --- 91465
18197 --- 98711
18499 --- 99481

The numbers in decimal format only are:

53, 371, 913, 4100, 5141, 5412, 6182, 8200, 9241, 75120, 75121, 75122, 75123, 75124, 75125, 75126, 75127, 75128, 75129, 75621, 86150, 91465, 98711, 99481

Similarly in the range up to 100,000, there are only 16 numbers in base 8 format that have the same digits as their decimal equivalants (Permalink):

Base 8 Decimal

2371 --- 1273
3165 --- 1653
4152 --- 2154
6130 --- 3160
6131 --- 3161
6132 --- 3162
6133 --- 3163
6134 --- 3164
6135 --- 3165
6136 --- 3166
6137 --- 3167
6232 --- 3226
37621 --- 16273
52371 --- 21753
73560 --- 30576
75341 --- 31457

Here are the numbers in decimal format only:

1273, 1653, 2154, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3226, 16273, 21753, 30576, 31457

Lightweight mathematics of course but sometimes it's good just to have fun with numbers. The table below shows the number of decimal numbers whose value in another base is an anagram of its digits. The bases range from 4 to 28. For bases 2 and 3 and for 29 and beyond, there are no such numbers.


Base 26 is interesting because the ten decimal numbers that satisfy are consecutive and the hexadecimal numbers formed from them are similarly consecutive and formed simply by moving the leading 9 of the decimal number one place to the right. Thus 910 in decimal becomes 190 in hexadecimal, 911 becomes 191 and so on until 919 that becomes 199.

Base 26 Decimal

190 --- 910
191 --- 911
192 --- 912
193 --- 913
194 --- 914
195 --- 915
196 --- 916
197 --- 917
198 --- 918
199 --- 919

All this can be explored via this permalink.

Saturday, 9 May 2020

On the Randomness of Pi's Digits


Much has been written about the randomness of the \(\pi\)'s digits but usually in the context of the decimal number system. Looking at \(\pi\) in terms of the binary number system however, introduces a simplification that can be exploited to investigate its randomness.

The first ten decimal digits of \(\pi\) are 3.141592654 which is represented in binary as:


11.00100100001111110110101010001000100

SageMathCell enables us to examine the first one million decimal digits of \(\pi\), convert these to binary and then graph the cumulative balance between the number of 0's and 1's. The first two 1's are ignored and only the 0's and 1's following the decimal point are considered. Figure 1 shows the result:

Figure 1

Figure 2 shows the code that I used to generate this graph:

Figure 2: permalink

How does this graph compare to that of a sequence of randomly generated 0's and 1's? It's easy enough to undertake this comparison. To this end, I looked at a string of three million randomly generated 0's and 1's because this is approximately the number of binary digits resulting from the conversion of one million decimal digits. The result is shown in Figure 3. Of course, successive repetitions of this algorithm will produce different graphs whereas the graph for \(\pi\) will be always the same. However, it's the general form of the two graphs that I want to compare.

Figure 3: permalink

Figure 4 shows the code that was used to produce this result.

Figure 4: permalink

Not surprisingly, the form of the two graphs is very similar. The point of the exercise is that the conversion of \(\pi\) to binary digits provides an easy visual comparison of its digits with randomly generated 0's and 1's.

ADDENDUM: March 17th 2021

There are of course many interesting facts concerning \(\pi\). Here are some of them:
  • The number pi is literally infinitely long. But the number 123456 doesn’t appear anywhere in the first million digits of \( \pi \). It is a bit shocking because if a million digits of \( \pi \) don’t have the sequence 124356, it definitely is the most unique number. Source.

  • Did you know there is actually an entire language based entirely on \( \pi\)? Called Pilish, the numbers of letters in successive words match the digits in \(\pi\). Mike Keith, a devoted Pilish-lover, even wrote an entire book in Pilish called "Not a Wake." The rules of the language and its variants are described here.

  • Rivers bend to \( \pi\): The way a river meanders is described by its sinuosity; the length of its winding path divided by the distance from the source to the ocean as measured in a straight line. Strange as it may be, the average river has a sinuosity of around 3.14, according to the journal Science. Source.
If you hold a mirror to a circle, it looks like a circle. If you hold a mirror up to 3.14, it spells PIE! See Figure 2.
Figure 2: source

Someone has developed a search engine that can be used to find digit sequences in \( \pi \) in the first \(2 \times 10^0 \) digits of \pi. Figure 3 shows the output if 123456789 is input.


Figure 3

Pressing the next link bring brings up what is shown in Figure 4:


Figure 4
      
The site can also be used to find positions of e, \(\sqrt{2} \) and \(\phi\) where SageMath for example struggles with one million decimal places.

Here is a GeoGebra link that will allows the user to use a slider to display decimal places of \(\pi\).