"Reverse Goldbach" and Highly Summable Numbers
- George Fane
- Nov 8, 2019
- 3 min read
Updated: Nov 28, 2019
Once I created a Goldbach Conjecture program to find even numbers as sums of primes, I wanted to go the other way around: find sums of primes for even numbers. I like to call these programs "Reverse Goldbach".
Reverse Goldbach
The function finder() finds and stores primes in the array prime[]. Compared to my previous Prime Number Finder, which checks all lesser natural numbers as potential factors, finder() only checks lesser primes. Compare:


The former contains a % b, while the latter contains a % prime[b]. This reduces the quantity of numbers checked as potential factors, making the latter far more efficient.
After finding primes, the Reverse Goldbach program prompts the user to enter a number. From there, the function checker() checks whether the number minus a prime is also prime. If both are prime, then the number can be expressed as a sum of those two primes, which is outputted:

We can see that larger inputs don't necessarily indicate more sums (80 is greater than 78 but has three fewer sums). I became curious about the numbers that have more sums of primes than all positive numbers lower than it. I call such numbers Highly Summable. The name is in the style of Ramanujan's Highly Composite Numbers, which have more factors than all lesser positive numbers (the first few are 1, 2, 4, 6, 12, 24, and 36).
Highly Summable Numbers (HSN)
To find Highly Summable Numbers, consecutive evens must be tested. Essentially, the user input from the Reverse Goldbach program must be replaced with a for loop that can plug in even numbers faster than I can type.
There are other differences, though. My prime finding method improves even further:

I only check odd numbers as possible primes, as my for loop starts at an odd and increments by 2. Instead of checking all primes below a natural number for divisibility, I only check primes below the square root of that natural number. This is due to the fact that when a number is written as a product of two factors, one factor is at most the number's square root, while the other is at least the root. Only one factor needs to be checked, so I check the primes below my number's root.
Additionally, I wrote this HSN program in Python, not in C++ like all my other programs on this website. Ever since my AP CompSci Principles class has introduced me to Python, though, I have loved this new language. Programming in C++ helped me pick up the basics, but Python has differentiated itself with its multitude of functions, even in just the standard library, that I never expected to exist in any language. I always assumed that I would have to make such functions myself.
One example is Python's list.count(element) function, which I use to check whether n2 in a sum of n1+n2 is prime. In my Reverse Goldbach program, I checked n2 for divisibility with all primes below it. In HSN in Python, I can use the aforementioned count function to see if n2 occurs in my list of previously found primes.
*Note: Thinking it over now, I could have done the same thing in Reverse Goldbach. In fact, I should have tried to find n2 in array prime[] instead of using the current methodology in function checker().

An example output is to the left, showing an HSN along with its number of sums. For example, the first HSN is 4 and has one sum of 2+2. The second is 10 and has 2 sums: 3+7 and 5+5.
A pattern is hard to discern, other than the HSN's tendency to jump by a multiple of six from one to the next. The gaps between the shown HSN's are 6, 12, 12, 14, 12, 18, 6, 6, 24, 6, 48, 12, 30, 90, and 30. All but one follow my hypothesis. The number six sure seems to appear often in relation to primes.
Typing this article, I was about to propose that these Highly Summable Numbers be added to the On-Line Encyclopedia of Integer Sequences (OEIS). As it turns out, two OEIS entries, authored in 1998 and 2005, already describe my sequence. This came as a bit of a disappointment to me; I thought I had discovered something new. Still, generating Highly Summable Numbers felt like a unique, less-heard-of challenge while I wrote the program.
Primes truly are the building blocks of all numbers. They can be multiplied together to form other integers or, as demonstrated in this article, added together as well. Even if primes have not always been the most applicable topic to study, they certainly are a fun one.
Thank you for reading!
George Fane
Comments