Tuesday 6 June 2023

Two Mystery Sequences

What if you were presented with the following sequence of terms:

9, 18, 27, 36, 45, 54, 63, 72, 99, 198, 297, 396, 495, 594, 693, 792, 999, 1998, 2997, 3996, 4995, 5994, 6993, 7992, 8082, 8172, 8262, 8352, 8442, 8532, 8622, 8712, 8802, 9999, 19998, 29997, 39996, 49995, 59994, 69993, 79992, 80982, 81972, 82962, 83952, 84942, 85932, 86922, 87912, 88902, 99999, 199998, 299997, 399996, 499995, 599994, 699993, 799992, 809982, 819972, 829962, 839952, 849942, 859932, 869922, 879912, 889902, 890802, 891702, 892602, 893502, 894402, 895302, 896202, 897102, 898002 

What is the pattern that this sequence is following? At first it looks like we are just generating multiples of 9 because we begin with 9, 18, 27, 36, 45, 54, 63, 72 but after that 99 follows and not 81. However, 99 is followed by its multiples again up to 792 = 8 x 99 after which there is a jump to 999 and the pattern repeats. The jump from the 8th multiple is always to the largest number with the same number of digits as the previous multiples. Thus from 72 we jump to 99 and from 792 we jump to 999. However, 999 then progresses to its 17th multiple, not its 8th, and then jumps to 9999 which then repeats this pattern. 

We could keep making up ad hoc rules to account for the terms of this sequence but actually they arise from a fairly simple process: 

  • start with the number 1
  • take this number, reverse it and calculate the absolute difference between the two numbers
  • if this difference is greater than zero and greater than any previous difference, then add this difference as a term of the sequence
  • proceed to the next number
All single digit numbers and even 11, because it is a palindrome, will yield a difference of zero and so no terms are added. However, once we reach 12, its reversal is 21 and the difference is 9 and so this becomes the first term of the sequence. The next number is 13 and the difference with its reversal of 31 is 18, so this difference is added to the sequence and so on. Table 1 shows the situation with the fourth column showing the factorisation of all the record differences in the range up to 100,000:


Table 1: permalink

The only such number that I'm likely to experience, via my diurnal age, is 29997. Not surprisingly, the OEIS does not recognise this sequence and I've no intention of attempting to add it.

Another interesting sequence arises if we look at the prime factors of these differences. In the first one million numbers, the prime factors that arise are as follows (arranged in ascending order and ignoring multiplicity):

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 53, 67, 79, 101, 163, 227, 271, 307, 337, 409, 419, 439, 449, 479, 941, 1559, 2053, 2647, 2917, 3803, 5521, 7127, 22777, 23887, 49639, 49739, 49789

Again, the OEIS has nothing to say about this sequence and it would be difficult to reverse engineer this sequence. What pattern does it follow? At first it seems like the sequence of prime numbers, until we get to 41. After this, 43 and 47 are skipped and then 53 is added. Why? Anyway, nothing too profound here, just two seemingly mysterious sequences that arise from a simple process operating in the background.

No comments:

Post a Comment