Friday, 14 August 2026

ODD + and EVEN - Trajectory Lengths

Let's revisit the ODD + and EVEN - algorithm that I first discussed in a post titled Odds and Evens from June of 2021. In that post, I looked at the trajectory lengths of numbers up to 100,000 and Figure 1 shows a graph summarising what I found.


Figure 1: permalink

I also found that in the range up to 100,000 there were 3725 numbers that are attractors, in other words the sums of their odd and even digits are equal. Of these, 301 are prime. These number belong to OEIS 
A036301:


 A036301

Numbers whose sum of even digits and sum of odd digits are equal.    

I then extended the range to 200,000 and found a number (158893) that required 91 steps before it entered a loop or, to put it another way, it was captured by a vortex. In this case, the vortex consisted of the vorticals 160028, 160013, 160012, 160006, 159995, 160033, 160034. Figure 2 shows a graph of the trajectories:


Figure 2: permalink

I noted that the
 average trajectory length has increased from 8.58 to 10.6. Back in 2021 I don't think I was using a Jupyter notebook and couldn't investigate further beyond 200,000 without SageMathCell timing out. With the Jupyter notebook, I was able to extend the search to one million and Figure 3 shows a graph of the trajectories:


Figure 3: permalink 
(will need a Jupyter notebook)

Over this range, the average trajectory length has increased to 14 and the record step length has increases to 287 compared to 91 in the range up to 200,000 and 81 in the range up to 100,000.

In that original blog post, I also looked at the proportion of numbers that were attractors compared to those numbers that were captives of attractors or that entered loops (this included vorticals and captives of vortices). I considered a range up to 100,000. These were the results (permalink)
  • total of numbers that are captives of attractors 58977 up to 100000 or 59.0 percent
  • total of numbers that end in a loop is 37298 up to 100000 or 37.3 percent
  • total number of attractors up to 100000 is 3725 or 3.73 percent
Using my Jupyter notebook to extend the range to one million, the results were:

  • total of numbers that are captives of attractors is 511859 up to 1000000 or 51.2 percent

  • total of numbers that end in a loop is 463061 up to 1000000 or 46.3 percent
  • total number of attractors up to 1000000 is 25080 or 2.51 percent

No comments:

Post a Comment