Showing posts with label ceiling function. Show all posts
Showing posts with label ceiling function. Show all posts

Saturday, 21 May 2022

Iterations of a Ceiling Function

It was back when I turned 26671 days old on April 11th 2022 that I first came across an unusual function that when applied repeatedly, so that the output becomes the new input, leads to zero or a loop. Here is the function \( n \) is any integer \( \ge 1\):$$\lceil \sqrt{n} \, \rceil \times (\lceil \sqrt{n}\, \rceil^2 – n) $$It can be seen that, with when \( n \) is a square number, the value of the expression is zero. When applied to most numbers, the iteration leads to zero but, far less frequently, the sequence of numbers generated by the iteration leads to a loop. 26671 is one such number. It has the following trajectory:

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

Thus we end up where we began, but this is not always the case as we shall see. The reason that I was reminded of this function is that today I turned 26710 days old and this number also has the property that it does not end in zero under repeated iterations but instead enters a loop. In the case of 26710, the loop is:

26710, 30504, 21175, 20586, 21600, 1323, 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, 1702

Here it can be seen that the number does not return to its starting point but instead enters a loop beginning and ending with 1702. Interestingly, 26709 also enters a loop as well. The loop is:

26709, 30668, 54208, 18873, 23598, 18172, 7155, 5950, 10452, 16171, 27264, 48472, 81549, 70642, 30324, 52675, 51750, 53352, 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

Such pairs are not all that common. The pairs up to this point are as follows:

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

Overall, the numbers that do not become zero constitute about 1.94% of the numbers in the range between 1 and 26710. These numbers constitute OEIS A219960 and the members up to 26710 are:

366, 680, 691, 1026, 1136, 1298, 1323, 1417, 1464, 1583, 1604, 1702, 2079, 2125, 2222, 2223, 2374, 2507, 2604, 2627, 2821, 2844, 2897, 3152, 3157, 3159, 3183, 3210, 3231, 3459, 3697, 3715, 3762, 3802, 3866, 3888, 3936, 3948, 4004, 4111, 4133, 4145, 4231, 4299, 4388, 4414, 4614, 4653, 4683, 4685, 4780, 4794, 4815, 5004, 5025, 5084, 5103, 5130, 5193, 5200, 5244, 5342, 5382, 5453, 5509, 5513, 5515, 5524, 5529, 5558, 5707, 5793, 5832, 5877, 5888, 5902, 5950, 5980, 5989, 6015, 6103, 6129, 6205, 6295, 6310, 6335, 6447, 6469, 6489, 6498, 6513, 6522, 6662, 6676, 6767, 6788, 6956, 7009, 7025, 7063, 7095, 7152, 7155, 7200, 7217, 7258, 7261, 7397, 7408, 7410, 7420, 7422, 7452, 7460, 7463, 7469, 7575, 7625, 7751, 7937, 7942, 7947, 7971, 8020, 8043, 8112, 8150, 8163, 8237, 8250, 8335, 8383, 8399, 8400, 8407, 8503, 8621, 8700, 8762, 8785, 8794, 8848, 8947, 8971, 9141, 9175, 9222, 9234, 9332, 9352, 9417, 9452, 9483, 9499, 9663, 9754, 9763, 9780, 9841, 9913, 9916, 9928, 9948, 10031, 10118, 10126, 10134, 10179, 10211, 10221, 10232, 10245, 10269, 10290, 10357, 10431, 10452, 10472, 10546, 10673, 10738, 10766, 10835, 10844, 10851, 10866, 10902, 10927, 10945, 11050, 11077, 11083, 11086, 11149, 11166, 11238, 11246, 11404, 11419, 11457, 11458, 11460, 11464, 11551, 11595, 11610, 11628, 11729, 11794, 11858, 11868, 11921, 12025, 12204, 12411, 12465, 12469, 12574, 12606, 12661, 12716, 12775, 12784, 12789, 12821, 12894, 12915, 12931, 12939, 12950, 12951, 12963, 12987, 12997, 13019, 13173, 13327, 13381, 13465, 13475, 13512, 13578, 13602, 13643, 13662, 13670, 13722, 13770, 13833, 13913, 13966, 13980, 14007, 14073, 14111, 14189, 14220, 14330, 14340, 14459, 14466, 14543, 14662, 14670, 14673, 14731, 14801, 14872, 14881, 14896, 14964, 15024, 15097, 15130, 15195, 15217, 15335, 15355, 15379, 15406, 15559, 15564, 15608, 15668, 15731, 15891, 15900, 16171, 16191, 16218, 16338, 16388, 16417, 16438, 16505, 16525, 16549, 16551, 16568, 16586, 16681, 16695, 16707, 16715, 16815, 16843, 16854, 16860, 16975, 17070, 17164, 17170, 17461, 17474, 17539, 17544, 17577, 17648, 17718, 17728, 17763, 17878, 17882, 17972, 18008, 18026, 18065, 18123, 18139, 18172, 18187, 18270, 18326, 18334, 18367, 18402, 18419, 18423, 18491, 18534, 18546, 18666, 18716, 18854, 18873, 18882, 18945, 18958, 18965, 18990, 19005, 19006, 19127, 19253, 19285, 19330, 19356, 19540, 19547, 19674, 19677, 19686, 19690, 19716, 19735, 19847, 19848, 19853, 19894, 19950, 19972, 20156, 20187, 20195, 20206, 20209, 20295, 20345, 20421, 20524, 20554, 20583, 20586, 20686, 20709, 20749, 20803, 20892, 20899, 20965, 21121, 21175, 21223, 21248, 21324, 21332, 21426, 21451, 21522, 21539, 21600, 21618, 21622, 21627, 21721, 21837, 21857, 21929, 22009, 22020, 22022, 22032, 22035, 22114, 22153, 22164, 22248, 22254, 22295, 22356, 22367, 22394, 22442, 22444, 22445, 22452, 22577, 22813, 22903, 22945, 22995, 23006, 23118, 23120, 23138, 23205, 23221, 23226, 23265, 23287, 23303, 23319, 23333, 23470, 23573, 23597, 23598, 23639, 23648, 23690, 23789, 23836, 24050, 24116, 24168, 24269, 24284, 24352, 24366, 24392, 24441, 24546, 24704, 24711, 24734, 24793, 24817, 24874, 24895, 24908, 24946, 25038, 25072, 25076, 25089, 25090, 25129, 25157, 25175, 25176, 25179, 25181, 25194, 25223, 25236, 25320, 25336, 25465, 25555, 25640, 25675, 25698, 25708, 25727, 25742, 25743, 25834, 25862, 25930, 25945, 26106, 26108, 26159, 26187, 26198, 26208, 26220, 26306, 26456, 26479, 26506, 26509, 26519, 26526, 26650, 26665, 26671, 26709, 26710

There are a number of conjectures associated with this ceiling function. These are listed in the OEIS comments and are:

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.

Tuesday, 20 February 2018

Fundamental Theorem on Sums of Two Squares

Today I achieved some further insights regarding what conditions allow a number to be expressed as a sum of two squares and then, if these conditions are met, to determine the number of ways in which this can be done. This useful site provided clear answers to these two matters. Firstly, the French mathematician Albert Girard had determined in 1632 (according to Leonard Dickson) that the numbers expressible as a sum of two integral squares were:
  • every square
  • every prime \( 4n+1 \)
  • a product formed of such numbers 
  • the double of one of the foregoing
The fundamental theorem on sums of two squares is:

Let \(n=2^kp_1^{a_1} \dots p_r^{a_r}q_1^{b_1} \dots q_s^{b_s}\) , where the \( p_i  \) are distinct primes with \( p_i \equiv 1 \pmod{4} \) and the \( q_i \) are distinct primes with \( q_j \equiv 3 \pmod{4} \). Then \(n \) is the sum of two squares if and only if all the \( b_j \) are even. In that case, the number of distinct solutions is \( \lceil \frac{\scriptstyle{1}}{\scriptstyle{2}} (a_1+1)(a_2+1) \dots (a_r+1) \rceil \), where \( \lceil x \rceil \) is the ceiling function, the smallest integer greater than or equal to \( x \).

What's of particular interest here is that the number of distinct solutions can be calculated. For example, consider the number \( 5^2 \times 13 \times 17 \times 29 = 160225 \) which can be represented as a sum of two squares because all the prime factors are of the form \( 4k+1 \). The number of distinct solutions can be found by adding 1 to all the indices of the factors, multiplying them together and dividing by 2. This gives \( 3 \times 2 \times 2 \times 2 \) divided by 2 which is 12. So there are twelve distinct ways in which this number can be expressed as a sum of two squares. 

The two square calculator provided at the site mentioned earlier displays eleven of these but oddly enough misses out on a twelfth arrangement, namely \( 300^2+265^2 \):

In determining what is the smallest number expressible as the sum of two different squares in two, three, four ways and so on, the \( 4k+1 \) primes are the key. These primes are 5, 13, 17, 29, 37, 41, ... and so the smallest number to be expressible on the sum of two squares in two different ways is 65 = 5 x 13, viz. \( 8^2+1^2 \text{ and } 7^2 + 4^2 \). Of course, I'm ignoring 25 which can be written as \( 3^2+4^2 \text{ and }0^2+5^2 \) because I'm only considering positive integers here. Similarly, the smallest number expressible as the sum of two squares in three different ways is 325 = 5 x 5 x 13:


Throwing 2's or 4k+3 primes into the factorisation doesn't increase the number of ways in which the number can be written as a sum of two squares. For example, 650 = 2 x 5 x 5 x 13 = 2 x 325 is still only expressible in three different ways:


It follows of course that every 4k+1 prime is expressible as a sum of two squares in one way only. For example, my birth year is \( 1949=10^2+43^2 \). My most recent prime day was \( 25153=57^2+148^2 \) and so it goes.