Showing posts with label happy numbers. Show all posts
Showing posts with label happy numbers. Show all posts

Saturday, 8 January 2022

Mathematical Quiz: 1

This post is just a first attempt at creating a mathematical quiz. I'm still thinking about the best way to present such a quiz from the wide variety of online resources available. The target audience is an important consideration. The first seven questions of this particular quiz is accessible to those you have completed a course in high school mathematics. The last three questions however, would not be but would serve to stimulate interest and get them to follow the suggested links. This whole quiz concept is a work in progress so I'll keep experimenting with quiz content and design.

Here is a set of ten mathematical questions that will test your understanding of Mathematics and perhaps help you to learn things of interest in the process. You should not use a calculator (except for Question 6) or reference material to answer these questions. Just rely on your own resources.

Questions:
  1. Evaluate \(2^{3^2}\)

  2. \(\pi\) represents the ratio of a circle's diameter to its circumference while \(e\) is the base of the natural logarithms. What is the product of these two numbers?

  3. Evaluate \( \dfrac{1}{0!}\)

  4. Evaluate \(4 + 8 \div 4 \times 2\)

  5. Will \(2100\) be a leap year?

  6. In a random group of people, how many are needed so that the probability of two people sharing the same birthday is about 50%? You can use a calculator for this problem.

  7. Can you find the smallest integer that can be written as \(x^2+xy+y^2 \) in two different ways with \(x \geq 0\) and \(y \geq 0\)? Hint: it's smaller than 50.

  8. A happy number is one that reduces to 1 with repeated sums of squares of digits. For example, \(13 \rightarrow 1^2+3^2 = 10 \rightarrow 1^2+0^2 = 1\). What happens to numbers that aren't happy?

  9. \(5=2^2+1^2\) but \(7\) can't be written as a sum of two squares. Using this information, try to decide whether the prime number \(1009\) can or cannot be written as a sum of two squares. Hint: use modular arithmetic. 

  10. Who is this German mathematician depicted below? Hint: his first name is Georg. He was born in 1845 and died in 1918.

Answers:

  1.  The rule is that the calculation proceeds from the top downwards and so we calculate \(3^2=9 \) first, then \(2^9=512\). Proceeding from the bottom up, we would evaluate \(2^3=8\) and then \(8^2=64\) but this is incorrect. Thus the answer is 512.

    Comment: I've written about this in a blog post titled Power Towers and Tetration. This is a simple but important principle to understand and is a sort of extension of the BOMDAS rule (Brackets, Of, Multiplication, Division, Addition, Subtraction).

  2. This is definitely a trick question. The answer is \(pie\).

    Comment: there's always room for humour in mathematics, provided it's not overdone. 

  3. It needs to be remembered that \(0!=1\) and thus the answer is 1.

    Comment: many former high school students would remember that zero factorial is 1 so this is not as difficult as it looks.

  4. To prevent mistakes put a bracket around division and multiplication before proceeding from left to right. This gives:

    \(4 + ((8 \div 4 )\times 2)=4 + (2 \times 2)=4+4=8\)

    Comment: this will trick a lot of people but it's still an elementary problem that even an upper level primary student should be able to handle.

  5. End of century years must be divisible by \(4\) and \(100\). While \(2100\) is divisible by \(100\), it is not divisible by \(4\) and thus it is not a leap year.

    Comment: this is not widely known but it should be and so this problem will inform those who weren't familiar with the rule.

  6. This is the famous birthday problem and the answer is 23 people. I've written about this is a blog post titled 23.

    Comment: the number is somewhat counter-intuitive in that it's much smaller than one might expect. It's an interesting problem that doesn't require any high level mathematics but will require a calculator (hence the exemption).

    Here is a brief explanation taken from my previously mentioned blog post:
    • With 23 people we have 253 pairs: \(\dfrac{23 \times 22}{2}=253\)
    • The chance of two people having different birthdays is \(1−\dfrac{1}{365}=\dfrac{364}{365}=0.997260\)
    • Makes sense, right? When comparing one person's birthday to another, in 364 out of 365 scenarios they won't match. Fine. But making 253 comparisons and having them all be different is like getting heads 253 times in a row - you had to dodge "tails" each time. Let's get an approximate solution by pretending birthday comparisons are like coin flips.We use exponents to find the probability:
      • \( \left (\dfrac{364}{365} \right )^{253}=0.4995 \approx 50 \%\)
    • Our chance of getting a single miss is pretty high (99.7260%), but when you take that chance hundreds of times, the odds of keeping up that streak drop. Fast.

  7. The smallest integer is \(49=0^2+0 \times 7+7^2=3^2+3 \times 5+5^2\). Such numbers are called Loeschian numbers and I've written about them in this post.

    Comment: this is easy to work out with a little trial and error.

  8. It shouldn't take too long for someone to realise that numbers that aren't happy end up in the loop {4,16,37,58,89,145,42,20}. I've written about these in a post titled Happy Numbers.

    Comment: the discovery takes just a little trial and error.

  9. All primes of the form \(4k+1\) where \(k \geq 1\) can be written as a sum of two squares. Now \(1009 \div 4\) leaves a remainder of \(1\) so it is of the form \(4k+1\) and can be written as a sum of two squares (\(15^2+28^2\)). I've written about these in a post titled Sum of Two Squares

    Comment: this is a little difficult but the hint to use modular arithmetic should nudge people in the right direction.

  10. His name is Georg Cantor and he is the "father" of set theory. You can read more about him by following this link.

    Comment: the first name is "Georg" and other hints will eliminate the well-known mathematics so some people may guess this because "Cantor" is reasonably well-known.
Since creating this quiz I've modified and improved the questions in various ways, so it's been a useful exercise. I still have to decide on the best way to present them. I may experiment with various formats and report back on this post as I'll use this quiz as the content.

ADDENDUM:

I've made use of QUIZIZZ to create a multiple choice quiz using 9 out of the 10 questions. Question 2 wasn't suitable for multiple choice so I've replaced it with another one involving identification of primes. A negative is that the site requires the setting up of a class and the addition of the quiz to that class as homework. Anyone wanting to take the test needs to set up an account by visiting https://quizizz.com/join/class and then use the class code which is M214707.


There are other negatives. As far as I can tell there is no support for LaTeX and so any mathematical expressions have to be included as images. However, the images are easily imported and display well so it's not a major issue. Any revisions mean that the image must be deleted and a new one imported.

Sunday, 13 December 2020

Iterations that lead to a Constant or a Loop

One of my first encounters with an iterative process that leads to either a constant or a loop was with so-called happy numbers. See my post of 28th June 2018 titled Happy Numbers. The iterative process involved with these numbers is to repeatedly add the sums of squares of digits to either reach a constant (1) or enter a loop (4, 16, 37, 58, 89, 145, 42, 20, 4, ... ). Approximately, 15% of numbers are happy.

25286 is a happy number because the process leads to 1: 

25286 --> 133 --> 19 --> 82 --> 68 --> 100 --> 1

89 is a nominally unhappy number because the process leads to a loop:

89 --> 145 -->  42 --> 20 --> 4

Today I turned 26187 days old and this number forms part of OEIS A219960:


 A219960

Numbers which do not reach zero under the repeated iteration
x -> ceiling(sqrt(x)) * (ceiling(sqrt(x))^2 - x).


In the case of 26187 the iteration proceeds as follows:

[26187, 9234, 16975, 24366, 44431, 18990, 7452, 10179, 2222, 3936]

whereupon it enters the loop:

[2079, 1702, 2604, 5200, 9417, 18326, 23120, 44217, 64144, 94488, 115808, 161293, 125022, 104076, 81719, 22022, 26671, 36900, 67357, 63180, 81648, 42328, 22248, 37800, 43875, 47250, 59732, 71785, 10452, 16171, 27264, 48472, 81549, 70642, 30324, 52675, 51750, 53352, 2079]

Graphically the situation is as in Figure 1 with 161293 being the highest value reached:


Figure 1

Of the numbers up to 26187, 504 do not reach zero which represents a little under 2% of the total.

There is a similar iterative process involving the floor function (OEIS A219303):


 A219303



Numbers which do not reach zero under the repeated iteration
x -> floor(sqrt(x)) * (x - floor(sqrt(x))^2).


In the comments for OEIS A219960 (with the ceiling function), the following is stated:
Conjecture 1: All numbers under the iteration reach 0 or, like the elements of this sequence, reach a finite loop, and none expand indefinitely to infinity.

Conjecture 2: There are an infinite number of such finite loops, though there is often significant distance between them.

Conjecture 3: There are an infinite number of pairs of consecutive integers in this sequence despite being less abundant than in A219303.

In regard to Conjecture 3, we find that in the range from 1 to 26187, the following pairs occur:

(2222, 2223), (8399, 8400), (11457, 11458), (12950, 12951), (19005, 19006), (19847, 19848), (22444, 22445), (23597, 23598), (25089, 25090), (25175, 25176), (25742, 25743)

In the comments for OEIS A219303 (with the floor function), the following is stated:

Collatz-like hailstone behavior is evident, but the iteration more closely resembles the iteration used to determine happy numbers (A007770), albeit in a non-base-specific manner. Unlike happy numbers, and despite being approximately as dense in the integers, these numbers do not reach their iterative goal.

Conjecture 1: All numbers under the iteration reach 0 or, like the elements of this sequence, reach a finite loop, and none expand indefinitely to infinity.

Conjecture 2: There are an infinite number of such finite loops, though there is often significant distance between them.

Conjecture 3: There are an infinite number of pairs of consecutive integers in this sequence, e.g. 14 and 15, 197 and 198. This argument is strengthened by the fact there are other groupings such as triples - The first of these is 11527, 11528 and 11529 - and also that for randomly chosen numbers of hundreds of digits, N, the nearest pair or grouping appears to be within N +/- 1000.

We find that the 10,000th member of OEIS A219303 is 211,264 so the numbers have a density of around 4.73% which is well over twice the density of numbers in OEIS A219960. Figure 2 shows a plot of the trajectory of 211,264 using a log scale for the y axis. Notice that once it reaches 8 it flatlines and stay on 8 forever because floor(sqrt(8)) * (8 - floor(sqrt(8))^2) = 8:


Figure 2: permalink

Monday, 10 June 2019

An Unhappy Family

Today I turned 25634 days old and at first glance I found little of interest about the number after consulting my usual sources: the OEIS (Online Encyclopaedia of Integer Sequences) and Numbers Aplenty. However, after a little thought, I realised that the number is composed of the consecutive digits 2, 3, 4, 5 and 6. It thus belongs to a family of 120 numbers that are all composed of these five digits.

The members are:

23456, 23465, 23546, 23564, 23645, 23654, 24356, 24365, 24536, 24563, 24635, 24653, 25346, 25364, 25436, 25463, 25634, 25643, 26345, 26354, 26435, 26453, 26534, 26543, 32456, 32465, 32546, 32564, 32645, 32654, 34256, 34265, 34526, 34562, 34625, 34652, 35246, 35264, 35426, 35462, 35624, 35642, 36245, 36254, 36425, 36452, 36524, 36542, 42356, 42365, 42536, 42563, 42635, 42653, 43256, 43265, 43526, 43562, 43625, 43652, 45236, 45263, 45326, 45362, 45623, 45632, 46235, 46253, 46325, 46352, 46523, 46532, 52346, 52364, 52436, 52463, 52634, 52643, 53246, 53264, 53426, 53462, 53624, 53642, 54236, 54263, 54326, 54362, 54623, 54632, 56234, 56243, 56324, 56342, 56423, 56432, 62345, 62354, 62435, 62453, 62534, 62543, 63245, 63254, 63425, 63452, 63524, 63542, 64235, 64253, 64325, 64352, 64523, 64532, 65234, 65243, 65324, 65342, 65423, 65432


Looking at the graph above, it can be seen that there must be 120 possible paths joining all five vertices.

This provided an opportunity to investigate some of the properties of this family. Specifically, I explored how many members of the family were:
  • prime
  • semiprime
  • sphenic
I also looked at how many members contained the factors 2 and 7, given that the prime factors of 25634 are 2, 7 and 1831.

To begin with only six members of the family are prime. This low number isn't surprising because the only digit out of the five that can form a prime number is 3 in the unit position. These primes are 25463, 25643, 45263, 46523, 54623 and 65423. 

The semiprimes are, not surprisingly, more numerous and they number 31. The semiprimes are 23645, 23654, 24653, 26354, 26453, 26534, 32546, 32645, 35246, 35426, 36254, 42563, 42635, 45623, 46253, 52463, 52634, 52643, 53426, 53462, 53642, 54263, 56243, 56423, 62354, 62435, 62534, 63254, 63542, 64523, 65243.

25634 is a sphenic number, meaning that it has three distinct prime factors, and so it's of particular interest to see how many of the family of 120 are sphenic. It turns out that there are 30. These are listed below but not in ascending order:

25634 = 2 * 7 * 1831
26543 = 11 * 19 * 127
26345 = 5 * 11 * 479
26435 = 5 * 17 * 311
23546 = 2 * 61 * 193
24635 = 5 * 13 * 379
24365 = 5 * 11 * 443
52346 = 2 * 7 * 3739
56234 = 2 * 31 * 907
53246 = 2 * 79 * 337
54326 = 2 * 23 * 1181
62543 = 13 * 17 * 283
62345 = 5 * 37 * 337
65342 = 2 * 37 * 883
64253 = 7 * 67 * 137
64235 = 5 * 29 * 443
32654 = 2 * 29 * 563
32465 = 5 * 43 * 151
35642 = 2 * 71 * 251
36245 = 5 * 11 * 659
34526 = 2 * 61 * 283
34562 = 2 * 11 * 1571
42653 = 13 * 17 * 193
42365 = 5 * 37 * 229
45326 = 2 * 131 * 173
45362 = 2 * 37 * 613
46235 = 5 * 7 * 1321
43265 = 5 * 17 * 509
43526 = 2 * 7 * 3109
43562 = 2 * 23 * 947

It can be seen from the above that only 43526 and 52346 share with 25634 in having 2 and 7 as distinct prime factors. However, overall there are nine permutations that have 2 and 7 as prime, but not necessarily distinct, factors. These are:

25634 = 2 * 7 * 1831
52346 = 2 * 7 * 3739
54236 = 2^2 * 7 * 13 * 149
54362 = 2 * 7 * 11 * 353
65324 = 2^2 * 7 * 2333
32564 = 2^2 * 7 * 1163
35462 = 2 * 7 * 17 * 149
43526 = 2 * 7 * 3109
43652 = 2^2 * 7 * 1559

Every sphenic number can be associated with a rectangular prism the dimensions of which correspond to the number's prime factors. In this case, the "sphenic brick" as it's sometimes called would have dimensions of 2, 7 and 1831 and an associated area of 32986 square units. This gives a volume to area ratio of about 1.28680658500429.

Unfortunately we must conclude that this family is not a happy one. A happy number has the property that repeatedly squaring the digits of the number and adding them leads to 1. However, when this process is applied to some numbers, they fall into an endless loop comprised of 4, 16, 37, 58, 89, 145, 42, 20 and they are thus not happy. All the members of this family share the same digits and, as it turns out, the process results in 90, 81, 65, 61 and 37. Thus not a single member of the family can be counted a happy number.

Drawing on another property of numbers involving their digits, D-powerful numbers can be expressed as the sum of positive powers of their digits. For example, 24536 can be expressed as \( 2^3 + 4^7 +5^3 +3^5 +6^5 \) or as \( 2^7+4^7+5+3^5+6^5 \). Not all of the other members of the family to which 24536 belongs are D-powerful. It turns out, as far as I can determine, that there are 20 D-powerful numbers amongst the family (with some having multiple representations). They are listed below with the exponents of the respective digits on the right:

24536 --> 3 7 3 5 5
24536--> 7 7 1 5 5
25346 --> 13 1 6 7 2
25436 --> 13 3 7 6 1
26354 --> 1 5 7 1 7
34256 --> 1 3 15 3 4
34256--> 5 5 15 1 3
34526 --> 4 4 3 15 4
34562 --> 6 5 1 2 15
34652 --> 6 5 1 3 15
36254 --> 4 3 15 5 3
42536 --> 7 11 5 9 4
52364 --> 5 15 4 1 7
53246 --> 1 8 3 2 6
54326 --> 5 6 8 15 5
54632 --> 5 6 6 5 9
62354 --> 2 7 10 5 2
62534 --> 3 7 5 10 2
62534--> 4 11 3 10 2
63254 --> 6 4 3 3 7
63254--> 6 4 7 1 7
63542 --> 3 10 5 5 7
63542--> 4 10 3 5 11
63542--> 4 10 5 3 3
65234 --> 2 1 11 10 6
65234--> 6 1 1 7 7
65324 --> 1 3 10 11 6

One digit-related property in which all family members share is the digital root defined as follows:
The digital root (also repeated digital sum) of a non-negative integer is the (single digit) value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit sum. The process continues until a single-digit number is reached.
Because all family members share the same digits, the digital sum of all them is the same, namely 2 since the sum of the digits is 20.

Harshad numbers involve another digit-related property. These numbers, sometimes called Niven numbers, are characterised by the property that they are divisible by the sum of their digits. For every member of this family, the sum is 20 and it's thus clear that none of them can be Harshad numbers because none of them can end in the required 0. If the result of the division is a prime number then the number can be described as a Moran number and so the Moran numbers form a subset of the Harshad numbers.

Junction numbers are another class of numbers that involve the sum of a number's digits. A junction number is defined as a number that can be written as x + sod(x) for at least two x, where sod() denotes the sum of digits. It turns out that 24 members of the family are junction numbers. These are listed below with the relevant numbers in square brackets on the right:

34526 is a junction number [34498, 34507]
34625 is a junction number [34597, 34606]
35426 is a junction number [35398, 35407]
35624 is a junction number [35596, 35605]
36425 is a junction number [36397, 36406]
36524 is a junction number [36496, 36505]
43526 is a junction number [43498, 43507]
43625 is a junction number [43597, 43606]
45326 is a junction number [45298, 45307]
45623 is a junction number [45595, 45604]
46325 is a junction number [46297, 46306]
46523 is a junction number [46495, 46504]
53426 is a junction number [53398, 53407]
53624 is a junction number [53596, 53605]
54326 is a junction number [54298, 54307]
54623 is a junction number [54595, 54604]
56324 is a junction number [56296, 56305]
56423 is a junction number [56395, 56404]
63425 is a junction number [63397, 63406]
63524 is a junction number [63496, 63505]
64325 is a junction number [64297, 64306]
64523 is a junction number [64495, 64504]
65324 is a junction number [65296, 65305]
65423 is a junction number [65395, 65404]

Related to junction numbers, a self number (sometimes called a Columbian number) is a number such that there is no other number x such that x + sod(x) equals that number. However, none of the members of this family are self numbers because there is always a number x such x + sod(x) equals that number. In fact there are 96 members for which one such number exists and, as we have seen, there are 24 for which two such numbers exist. These are the junction numbers listed earlier.

A Smith number is also defined by a property involving the sum of the number's digits. It is a composite numbers with the property that the sum of its digits equals the sum of digits of its prime factors. Like the Harshad numbers mentioned earlier, none of the members of this family as Smith numbers.

Hoax numbers are similar but they only consider distinct prime factors. There are 7 members of the family that are hoax numbers, namely 23564, 24563, 32564, 36425, 45236, 64325 and 65324. We know the sum of digits of all family members is 20 and checking the distinct factors (shown in the list below), it can be seen that they two add to 20:

23564 = 2^2 * 43 * 137 (remember only count the factor 2 once)
24563 = 7 * 11^2 * 29 (remember only count the factor 11 once)
32564 = 2^2 * 7 * 1163 (remember only count the factor 2 once)
36425 = 5^2 * 31 * 47 (remember only count the factor 5 once)
45236 = 2^2 * 43 * 263 (remember only count the factor 2 once)
64325 = 5^2 * 31 * 83 (remember only count the factor 5 once)
65324 = 2^2 * 7 * 2333 (remember only count the factor 2 once)

The takeaway from this investigation is that, when exploring a family of numbers defined on the basis of the digits that comprise them, the best approach is to explore number properties that specifically involve digits. Some of these types of numbers are:
  • Smith numbers
  • Hoax numbers
  • Harshad numbers
  • Moran numbers
  • Self numbers
  • Junction numbers
  • D-powerful numbers
  • Happy numbers
ADDENDUM: today (June 18th 2019) I turned 25643 days old and this brought to mind the other family member, 25634, for which I created this post. Here is what I wrote about 25643 in my Airtable record for this number:
25643 is a Sophie Germain prime since 2 * 25643 = 51287 is also prime. 
25643 is an Ulam number, being the unique sum of two previous Ulam numbers, 69 and 25574. 
25643 is a member of OEIS A156119: primes formed by rearranging five consecutive decimal digits (avoiding leading 0). The members of this sequence, up to and including 25643, are: 10243, 12043, 20143, 20341, 20431, 23041, 24103, 25463, 25643.