Showing posts with label floor. Show all posts
Showing posts with label floor. Show all posts

Tuesday, 9 January 2024

The Sesquinary Number Base

"Sesqui" in Latin means "one and a half" and so the sesquinary number base uses 3/2 as its base. It can also be called fractional base 3/2. The numbers formed using this base comprise OEIS A024629:


 A024629

\(n\) written in fractional base 3/2.     
                          


The initial members of the sequence are:

0, 1, 2, 20, 21, 22, 210, 211, 212, 2100, 2101, 2102, 2120, 2121, 2122, 21010, 21011, 21012, 21200, 21201, 21202, 21220, 21221, 21222, 210110, 210111, 210112, 212000, 212001, 212002, 212020, 212021, 212022, 212210, 212211, 212212, 2101100, 2101101

Figure 1 shows the results more clearly for the numbers 1 to 15:


Figure 1: source

In general, for bases of the form \(a/b\) where \(a\) and \(b\) are integers and \(a \gt b \), the digits that can used range from \( 0\) to \(a-1\) and so for the sesquinary number base the digits 0, 1 and 2 are used. If \(a \lt b \) then the digits \(0\) to \(b-1\) are used.

Let's use \(22_{3/2}\) as our first example. This should be the same as \(5_{10} \) and indeed we see that it is:$$  22_{3/2} = 2 \times \frac{3}{2} + 2 =3+2 = 5$$Let's used \(2101_{3/2}\) as a second example. This should be equal to \(10_{10} \):$$ \begin{align}  2101_{3/2} &=  2 \times \bigg ( \frac{3}{2} \bigg )^3+ \bigg ( \frac{3}{2} \bigg )^2+0+1 \\ &= \frac{27}{4}+ \frac{9}{4} +1\\ &=10 \end{align} $$The following SageMath code will generate the first 40 numbers (permalink):
def basepqExpansion(p, q, n):
    L, i = [n], 1
    while L[i-1] >= p:
        x=L[i-1]
        L[i-1]=x.mod(p)
        L.append(q*(x//p))
        i+=1
    L.reverse()
    return Integer(''.join(str(x) for x in L))
L=[basepqExpansion(3, 2, n) for n in [0..40]]
print(L)

 I came across this number base in the context of OEIS A081848:


 A081848

Number of numbers whose base-3/2 expansion (see A024629) has \(n\) digits. 

The initial members of the sequence are (permalink accurate to 5394):

 3, 3, 3, 6, 9, 12, 18, 27, 42, 63, 93, 141, 210, 315, 474, 711, 1065, 1599, 2397, 3597, 5394, 8091, 12138, 18207, 27309

My diurnal age on the date of this post is 27309 and this is how many numbers in base 3/2 has \(n\) = 25 digits. This YouTube video gives a good overview of the different sorts of bases that are possible including negative, algebraic, imaginary and complex number bases. Figure 2 shows a screenshot of the opening frame.


Figure 2: source

Here is another very interesting link titled How Do You Write One Hundred in Base 3/2? Here is an excerpt:

Here’s a problem that I think is hard but might be doable: how many counting numbers are there that have a sesquinary representation that (if we ignore the 0‘s at the front) reads the same forward and backward? (It’s easy to write down palindromic sequences of 0‘s, 1‘s and 2‘s, but the overwhelming majority of them, like 11, don’t correspond to counting numbers.) The biggest sesquinary palindrome I know is four hundred ninety-four, with sesquinary representation 2120010100212. Are there others? Are there perhaps infinitely many others? 

ADDENDUM

Well, 3/2 turned up the very next day, associated with one of the properties of 27310 that turns out to be a member of OEIS A061418:


 A061418

a(\(n\)) = floor(a(\(n\)-1)*3/2) with a(1) = 2.                               



The OEIS comments are particularly interesting:
Can be stated as the number of animals starting from a single pair if any pair of animals can produce a single offspring (as in the game Minecraft, if the player allows offspring to fully grow before breeding again). 

The sequence members are almost identical to those of OEIS A024629 (differences are shown in bold and all differ by being 1 more except for the first member which is 1 less):

2, 3, 4, 6, 9, 13, 19, 28, 42, 63, 94, 141, 211, 316, 474, 711, 1066, 1599, 2398, 3597, 5395, 8092, 12138, 18207, 27310

Here are the members of OEIS A024629 again for easy reference.

3, 3, 3, 6, 9, 12, 18, 27, 42, 63, 93, 141, 210, 315, 474, 711, 1065, 1599, 2397, 3597, 5394, 8091, 12138, 18207, 27309

Friday, 29 September 2023

Graham-Pollak Sequences

I  was reminded of my previous post titled Pisot Sequences when I came across the topic of this current post relating to Graham-Pollak sequences. An example of this type of sequence is the following:$$a(n) = \text{ floor} \sqrt{2 \times a(n-1) \times (a(n-1)+1)}\\ \text{ where } a(0)=1$$The initial members of this sequence (OEIS A001521) are (permalink):

1, 2, 3, 4, 6, 9, 13, 19, 27, 38, 54, 77, 109, 154, 218, 309, 437, 618, 874, 1236, 1748, 2472, 3496, 4944, 6992, 9888, 13984, 19777, 27969, 39554, 55938, 79108, 111876, 158217, 223753, 316435, 447507, 632871, 895015, 1265743, 1790031, 2531486, 3580062, 5062972

This sequence has apparently some amazing properties that can be read about here in Wolfram Mathworld but I have to confess to not understanding their significance. Note that from 1 to 9, the numbers 5 and 8 are missing and so two others sequences, listed in the OEIS, can be generated using these numbers as starting points instead of 1. Starting with 5 produces OEIS A091522 (permalink):


 A091522

Graham-Pollak sequence with initial term 5.   
                       


The initial members are:

5, 7, 10, 14, 20, 28, 40, 57, 81, 115, 163, 231, 327, 463, 655, 927, 1311, 1854, 2622, 3708, 5244, 7416, 10488, 14832, 20976, 29665, 41953, 59331, 83907, 118663, 167815, 237326, 335630, 474653, 671261, 949307, 1342523, 1898614, 2685046 

Starting with 8 produces OEIS A091523 (permalink):


 A091523

Graham-Pollak sequence with initial term 8.   
                         


The initial members are:

8, 12, 17, 24, 34, 48, 68, 96, 136, 193, 273, 386, 546, 772, 1092, 1545, 2185, 3090, 4370, 6180, 8740, 12360, 17480, 24721, 34961, 49443, 69923, 98886, 139846, 197772, 279692, 395544, 559384, 791089, 1118769, 1582179, 2237539, 3164358

I came across the Graham-Pollak sequences through a reference in the OEIS to the number associated my diurnal age of 27207. The number arises from the following formula:$$a(n) = \text{ floor} \sqrt{3 \times a(n-1) \times (a(n-1)+1)}\\ \text{ where } a(0)=1$$Notice that the multiplier is not 2 but 3. The numbers generated by this formula produce OEIS A100671 (permalink):


 A100671

 A Graham-Pollak-like sequence with multiplier 3 instead of 2. 
          


1, 2, 4, 7, 12, 21, 37, 64, 111, 193, 335, 581, 1007, 1745, 3023, 5236, 9069, 15708, 27207, 47124, 81622, 141374, 244867, 424122, 734601, 1272367, 2203805, 3817103, 6611417, 11451311, 19834253, 34353934, 59502759, 103061802, 178508278, 309185407, 535524834 

Apparently it's not known whether this sequence has properties similar to the original.

Saturday, 29 October 2022

Double Iterations Involving Ceiling and Floor Functions

On May 21st 2022, I created a post titled Iterations of a Ceiling Function and the function being dealt with had this form:$$\lceil \sqrt{n} \, \rceil \times (\lceil \sqrt{n}\, \rceil^2 \, – \,n) $$The iteration, with output becoming the new input, leads to zero or a loop although this hasn't been rigorously proved. The number associated with my diurnal age today, 26872, has this property. The trajectory ends in a loop and is as follows:

26872, 3936, 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

Figure 1 shows the trajectory of 26872 under this iteration.


Figure 1: trajectory of 26872 under the floor iteration

There is an associated function that involves the floor function and it has this form:$$\lfloor \sqrt{n} \, \rfloor \times (n-\lfloor \sqrt{n}\, \rfloor^2) $$When this function is iterated, with output serving as the new input, a loop is also reached:

26872, 49389, 23310, 31312, 59136, 21141, 16820, 23091, 43790, 22781, 42150, 25625, 4000, 1953, 748, 513, 638, 325, 18, 8, 8

Figure 2 shows the trajectory of 26872 under the floor iteration.


Figure 2: trajectory of 26872 under ceiling iteration

Here is a permalink to an algorithm that will confirm these two trajectories. Numbers like 26872 that do not end in zero under both iterations but instead end in loops are members of OEIS A219963:


 A219963

Numbers n which do not reach zero under either of the iterations: \( n \rightarrow \lfloor \sqrt{n} \rfloor \times  (n - \lfloor \sqrt{n}) \rfloor\ ^2) \) or  \( n \rightarrow \lceil \sqrt{n} \rceil \times ( \lceil \sqrt{n} \rceil ^2- n ) \).



Not surprisingly, these numbers are rather rare. Here are the initial members of the sequence:

2897, 3159, 3183, 4004, 6335, 7025, 8163, 8237, 8621, 9234, 12204, 12963, 13381, 14340, 15217, 16191, 16438, 17474, 17763, 17972, 18065, 18990, 19677, 19848, 20345, 20803, 21426, 21539, 22022, 25834, 26872, 27175, 28052, 28929, 28996, 29295, 30511, 30991

The first pair of consecutive integers belonging to this sequence is (89971, 89972). As with all these sorts of trajectories, the issue of records arise. For example, what number produces the longest sequence? What number produces the maximum peak? The calculation at each step of the algorithm seems somewhat processor intensive so that calculations over large ranges cause it to time out (on SageMathCell at least). Still, these are interesting statistics to explore. It will be 303 days before my diurnal age again matches a member of this sequence.

Thursday, 28 October 2021

An Interesting Iteration

Having turned 26506 days old today, my attention was drawn to this OEIS sequence:


 A219960

Numbers which do not reach zero under the repeated iteration \(x \rightarrow \lceil \sqrt{x} \, \rceil \times  (\lceil \sqrt{x}\, \rceil ^2 - x) \).


Figure 1 shows that 26506 is the 511th such number and thus the frequency of such numbers is about 1.93%.

Figure 1

The first members of this sequence are as follows:
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, ...
Here is a permalink to the algorithm on SageMathCell that will return all members of OEIS A219960 up to and including 26506. 

The OEIS comments include the following conjectures:
  • 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.
OEIS A219303 refers to the iterative process where the ceiling function is replaced by the floor function. So what happens to 26506 under this iteration? Here is the trajectory:
26506, 10269, 13770, 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
As can be seen, after five steps a loop of length 38 is entered with a length of 43 steps overall. Figure 2 shows this trajectory using a log scale for the vertical axis.


Figure 2

Up to 26506, the trajectory of maximum length is associated with the number 25923 that has a trajectory of length 86 and ends in 0:
25923, 52002, 100531, 188574, 283185, 481832, 829135, 716046, 1154461, 1251300, 963459, 849430, 602988, 575757, 245916, 49600, 28767, 22610, 28841, 10030, 17271, 20196, 36179, 57682, 96159, 174782, 326401, 447876, 686080, 962469, 1821610, 1201500, 2094173, 3664888, 4475355, 4445716, 4565985, 1675408, 2094015, 3893672, 5929896, 10231200, 7680799, 8828820, 11781008, 15383273, 26111488, 3127320, 3610529, 6220072, 12357735, 15895836, 1327671, 2003914, 1617072, 1160064, 2177560, 1499616, 1236025, 577128, 358720, 48519, 71162, 33909, 58460, 25168, 17967, 34830, 25993, 40662, 28684, 36720, 27648, 40247, 30954, 3872, 6111, 10270, 13668, 2457, 2150, 2773, 1908, 1232, 2304, 0
Figure 3 shows the trajectory of 25923 using a log scale for the vertical axis.


Figure 3

Figure 4 shows the distribution of trajectory lengths between 1 and 26506. All square numbers immediately become zero under the iteration. Using 25 as an example, we get:

\( \lceil \sqrt{25} \rceil \times ( \lceil \sqrt{25} \, \rceil ^2 - 25) = 5 \times (25 - 25) = 5 \times 0 = 0 \)


Figure 4

So far only the numbers up to and including 26506 have been examined because the algorithm is processor intensive. However, if we search from 26507 to 50000, we find that the record length increases slightly to 91, again ending in 0. Here is the record length attained by 35727:
35727, 70870, 111873, 117920, 143104, 203523, 353012, 602735, 772338, 266337, 492184, 435240, 237600, 265472, 404544, 780325, 999804, 196000, 110307, 193806, 297675, 240786, 144845, 120396, 4511, 7684, 5280, 3577, 1380, 2432, 3400, 4779, 8470, 16647, 32890, 42588, 54027, 61046, 113584, 223080, 306977, 581640, 403627, 552684, 633888, 1052837, 1943084, 211888, 291813, 469588, 691488, 612352, 577071, 402040, 752475, 823732, 664656, 979200, 891000, 128384, 178423, 214038, 153253, 161112, 197784, 107245, 111192, 121576, 78525, 122516, 240435, 317186, 513240, 608733, 959068, 1305360, 1244727, 813564, 36080, 3800, 2728, 4293, 4158, 4355, 66, 135, 108, 143, 12, 16, 0

Here is the permalink for this calculation. Note that the penultimate number in the trajectory is 16 which is a square number (\(4^2\)), just as the penultimate number for the previous record trajectory was 2304, also a square number (\(48^2\)). Clearly, it is only when a square number is reached in the trajectory that a result of zero will arise in the next iteration. However, in the case of over 98% of numbers (at least in the range up to 26506), the trajectory does not terminate at zero but instead enters a loop.

Conjecture 3, included earlier, states that "there are an infinite number of pairs of consecutive integers" so let's investigate this further. In the range up to 26506, 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 
So eleven pairs in that range shows that pairs of such numbers are not that common and of course there's no way to confirm that there are an infinite number of them.

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