Some interesting patterns in excellent numbers

I’ve noticed some curious patterns in excellent numbers. This relates to the Perl stuff I wrote about earlier, but this post isn’t about the Perl.

Ignoring the spaces which I use to show the pattern, each of these numbers are excellent. The pattern pivots on a 4 which can have zero or more 3s on the left side and the same number of 6s on the right side. End it all with an 8. The right half is twice the left half. I conjecture that every series of excellent numbers of a particular length has such a number. I’ll figure out the proof later:

           4  8
         3 4 6 8
        33 4 66 8
       333 4 666 8
      3333 4 6666 8
     33333 4 66666 8
    333333 4 666666 8
   3333333 4 6666666 8
  33333333 4 66666666 8
 333333333 4 666666666 8
3333333333 4 6666666666 8

Mark Jason Dominus proved that 48, 484848, and all other odd number of repetitions of 48 are also excellent. I think 48 is just a special case with zero 3s and 6s.

But, it turns out so far that any excellent number repeated an odd number of times is excellent. So, 346834683468 (n=12) is also excellent. So is 140400140400140400 (n=18).

This means that I can look at the number of digits and make a guess about how many excellent numbers I find. I take the factorization of number and check how many combinations of an even and odd number I can make:

 2 → 2 * 1
 4 → 4 * 1
 6 → 6 * 1, 2 * 3
 8 → 8 * 1
10 → 10 * 1, 2 * 5
12 → 12 * 1, 4 * 3
14 → 14 * 1, 2 * 7
16 → 16 * 1
18 → 18 * 1, 2 * 9, 6 * 3
20 → 20 * 1, 4 * 5
22 → 22 * 1, 2 * 11
24 → 24 * 1, 8 * 3
26 → 26 * 1, 2 * 13
28 → 28 * 1, 4 * 7
30 → 30 * 1, 2 * 15, 6 * 5, 10 * 3 

There are many 28 numbers with 18 digits that are excellent. That’s the highest count for a particular number of digits so far (up to n=22). But look at it’s factorization. The number 18 can two factorizations with an even and odd number. The sequence for 18-digit numbers includes all the 6-digit numbers repeated three times. Look at 30 digits. It will repeat the 2-digit, 6-digit, and 10-digit numbers.

There’s probably a proof for that too, but I haven’t worked it out just yet.

Doing less work to compute excellent numbers

When I last looked at excellent numbers, I knew there was more work I could do to optimize what I was doing. In particular, I knew there was some upper limit to the range of numbers I had to check. I didn’t take the time to think about until today. I had a brief foray into other languages, such as my attempt with Julia, as I ran out of time to think about it. » Read more…

The revolution hasn’t happened

Alan Kay says the computer revolution hasn’t happened. Here’s a talk he gave at OOPLSA in 1997. He has gems such as “I made up the term object-oriented, and I can tell you I did not have C++ in mind.” » Read more…

Computing excellent numbers

In the “Benchmarking” chapter of Mastering Perl, I emphasize better algorithms over different syntax. Many of the problems we think we have better solutions if we change how we do things instead of worrying about the efficiency of a particular keyword. In this item, I’ll go through my actual path through a problem rather than hiding all my failed experiments. The negative results are just as valuable. » Read more…

Ten numbers on a blackboard

In Ten numbers on a blackboard, someone asks about the largest number you can compute by reducing a set of numbers. I was surprised to see that someone spent quite a bit of time to brute force it and that their Python solution was so slow. So many of the things I write about in the “Benchmarking” and “Profiling” chapters come into play in this conversation. » Read more…

Makefile.PL as a modulino

A Perl distribution’s build file is often a neglected program. The community has standards for code in the modules, but we ignore quality (or kwalitee) in Makefile.PL, the test programs, and other ancillary code.

Much of my work in CPAN Archeology has dealt with figuring out what data goes into WriteMakefile. In Test::Prereq, I took the heavy-handed and ham-fisted approach of monkey patching ExtUtils::MakeMaker just to intercept its arguments. In MyCPAN::Indexer, I run the build file and look at the generated META files. That comes with many other problems. » Read more…

Redis provides lightweight, scalable persistent data structures

I’ve been having quite a bit of fun with Redis, a lightweight and simple data structure server. It’s easy to install locally, but you can also get a free server from redislabs. Services such as Heroku can spin up Redis instances and use them with your Heroku-deployed Mojo applications. » Read more…

More fun with the diamond operator

In The double diamond, a more secure <>, I showed how the diamond operator treated some characters as special when it tried to open the filenames in @ARGV. I used a file name that ended with a | to read the output for an external command.

Thinking about it more, I realized the problem is even worse. Opening an external command to read the output might even be useful. What if I start the filename with > to open a file for writing, but not only writing, to truncate it to? » Read more…

The double diamond, a more secure <>

We’ve had the three argument open since Perl 5.6. This allows us to separate the way we want to interact with the file from the filename. There’s a place where we don’t get to choose, but Perl 5.22 might introduce a new operator to handle that. » Read more…

The Data::Dumper stack smash (fixed)

Problems with data serializers was a major change to Mastering Perl. The Storable issue with malformed inputs was known for a long time but nobody much cared about it. Now it’s Data::Dumper‘s turn. » Read more…