I found $9$ cases up to $3\times10^{14}$ with a sequence of $7$ consecutive gnu values:
$$5973822114120,6305771634120,28058687347320,48414128744520,74556478687320,84300170172120,142366076070120,153432090884520,207916418382120.$$
This proves that sequences of $7$ numbers exist, but sequences of $8$ do not.
To find these, I used a sieve that finds $n$ where $n+2$, $n+4$, and $n+6$ definitely have the right group number, and $n+1$ is squarefree. I'll describe this in a bit more detail after I describe my original sieve.
Outdated Original Approach (good up to about $10^{12}$):
Before that, I made a really complicated sieve that identifies 3-group numbers by chugging through the conditions in a clever way. We know that $n$ is a 3-group number iff one of the following holds
- I: $n$ is squarefree aside from one square factor $q^2$, there are no relations, and exactly one prime divisor of $n$ divides $q+1$.
- II: $n$ is squarefree with a "chain" of relations, ie $p\mid q-1$ and $q\mid r-1$ for three of its prime factors $p$, $q$, and $r$, but there are no other relations of this type.
I ran a separate sieve in each of these cases, with multiple passes each. In case I, we 1) identify $q$ and any prime factor larger than $\sqrt{\mathrm{MAX}}$ that exists, 2) compute "reduced phi" $\not\varphi(n)=\prod_{p^a\mid n}(p-1)$ and "count" how many prime divisors of $n$ divide $q+1$ (using a 1-bit counter since if 2 are found we mark n as invalid). In case II, we 1) compute $\varphi(n)$ or identify that $n$ is not squarefree, and compute the large prime factor if it exists, 2) identify the primes $p$ and $q$ that multiply to $\gcd(\varphi(n),n)$ and are related, or identify that it's not a semiprime with related factors, 3) count the prime divisors related to $p$ and $q$ and ensure there is one each.
The multiple passes are to avoid any kind of actual factoring or trial division, and to minimize memory usage: the type I sieve uses 64 bits per $n$ and the type II sieve uses 80. The fewer bits we use, the more entries we can store in a segment before we have to use smaller segments (if the segment does not fit in CPU cache, the program performs dramatically worse).
Ultimately, that method is not great, since about $\frac 1{300}$ numbers is a 3-group number, so we are doing pretty expensive work to eliminate not much.
Current Approach (good up to about $10^{15}$):
Looking into Robin's related question here (see my answer for some more context), I extended the results and found something quite amazing. If $\mathrm{gnu}(n+1)=1$, $\mathrm{gnu}(n+2)=2$, $\mathrm{gnu}(n+4)=4$, and $\mathrm{gnu}(n+6)=6$, we have:
- $n = 144m+72$
- $n+1=144m+73$ is squarefree (necessary but not sufficient for $n+1$ condition)
- $n+2=2(72m+37)$ is $2$ times a prime (necessary AND sufficient)
- $n+4=4(36m+19)$ is $4$ times a prime (necessary and sufficient)
- $n+6=6(24m+13)$ is $6$ times a prime (necessary and sufficient)
This basically divides the upper bound by $144$ since we work in terms of $m$ instead of $n$. And it gives us a really simple sieve:
- for every prime $p>3$, mark all $m$ where $p^2\mid144m+73$, $p\mid72m+37$, or etc as invalid
- once we do this for every prime up to $\sqrt{\mathrm{MAX}}$, any $m$ which are not marked as invalid are candidates, and we should check that they produce $n$ with the $n+3$, $n+5$, and $n+1$ conditions met.
My answer on the other question goes into more detail on when gnu equals 4 and 6. The important thing is we know fully the powers of 2 and 3 that divide our numbers. For even numbers, 2 is related to every odd prime so the factorization is really restricted. The cases for $n+5$ and $n+7$ simplify since we know those are odd, but they don't actually simplify that much.
In practice I'm using a parallel segmented sieve with 32 threads, and the threads process segments until they have >= 200000 candidates (or there are no more segments), and then filter their list of candidates, to minimize switching between the sieving and factorization based tests.
I only ran it up to $10^{14}$ which took 8 minutes, but it should be able to do $10^{15}$ in only an hour or two. Using an $m\mod385$ wheel could make it almost 4x faster, and it might be possible to mix in sieves to check or partially check the $n+3$ case, but this would be complicated.
Asymptotics
The four sieves I do use, based on the forms $144m+73$, $72m+37$, etc, show that $\mathrm{gnu}(n+1)=1$, $\mathrm{gnu}(n+2)=2$, $\mathrm{gnu}(n+4)=4$, and $\mathrm{gnu}(n+6)$ are NOT independent conditions. The proportion of numbers having a fixed gnu value seems to converge to a constant, but the proportion of numbers where $n+1$ is squarefree and $n+2$, $n+4$, and $n+6$ have the correct group numbers is related to
$$\prod_{5\le p\le\mathrm{MAX}}\left(1-\frac{3p+1}{p^2}\right).$$
I don't know enough about primes in arithmetic progressions to know the exact connection. It definitely shows that these candidate numbers get rarer as they get larger, since this is true for primes in an arithmetic progression alone. I think it shows there are infinitely many candidates, but I'm not sure about that.
In practice, it's MUCH more effective at filtering out $n$ values that don't work compared to the original 3-group sieve.
Up to $1.44\times10^9$, there are about $4.8\times10^6$ 3-group numbers, but there are only $2.47\times10^4$ candidates with the new sieve. And this only gets better for larger upper bounds.
In particular, I think the number of candidates up to $M$ is $O(\frac M{\log(M)^3})$.
Finally, how rare are candidate $n$ where one or more of the constraints $\mathrm{gnu}(n+1)=1$, $\mathrm{gnu}(n+3)=3$, $\mathrm{gnu}(n+5)=5$, and $\mathrm{gnu}(n+7)=7$ hold? We know that the even constraints plus the $n+1$ constraint are not independent, but what about the rest? Does each additional constraint have some constant density among candidates, but the overall density goes down even among candidates? Are there infinitely many sequences of $7$ consecutive gnu values?
We can actually show that there are infinitely many 7 sequences, ASSUMING the Bateman-Horn conjecture. Just consider a subsequence where $n = 233992702112400m + 1301555283912$ and all of $233992702112400m + 1301555283913$, $116996351056200m + 650777641957$, $15599513474160m + 86770352261$, $58498175528100m + 325388820979$, $682194466800m + 3794621819$, $38998783685400m + 216925880653$, and $4088422800m + 22741343$ are prime. We NEED $n = 72\mod144$, which forces $n+2$, $n+4$, and $n+6$ to be good, and constrains it mod powers of $2$ and $3$. So I constrained $n$ mod $5^2$ so that $n+3$ would have $3$ groups if some linear form is prime, then mod $7^4$ so that $n+5$ would have $5$ groups, then $11^443^2$ so that $n+7$ would have $7$ groups. If you take $n+i$ for $i=1,\ldots,7$ and factor out the gcd from $n+i=am+b$, you get $n+i=k(a'm+b')$ where $g(k)=i$ and if $a'm+b'$ is prime it does not interact with $k$.
If all $7$ of these linear forms are prime, then $g(n+1)=1,\ldots,g(n+7)=7$. There are certainly many terms that this construction does not generate, but it's now easy to see we have infinite terms assuming Bateman-Horn.
Edit 1
- Searched $10^{14}+1$ thru $2\times10^{14}$ and found $2$ more sequences of $7$
- added references including source code
- Proved sequence is infinite assuming Bateman-Horn conjecture (can probably use a weaker assumption)
References:
- Keith Conrad, Groups of order p^3
- J. H. Conway, Heiko Dietrich and E. A. O'Brien, Counting groups: gnus, moas and other exotica, 2008.
- Aban S. Mahmoud, Orders for which there exist exactly six or seven groups, 2024.
- G. A. Miller, Orders for which There Exist Exactly Four or Five Groups, 1932.
- Jørn B. Olsson, Three Group Numbers, 2006.
- Source code: https://github.com/hacatu/sieve_group_seqs