5
$\begingroup$

Here is a similar question that asks for $101$ numbers none of them are prime and it is well known that $101!+1,101!+2,101!+3,\cdots,101!+101$ are those numbers. I am interested to know, how we can find exactly $101$(more generally, $n$) consecutive composites, i.e; if the list of composites is $k,k+1,\cdots,k+100$, then neither $k-1$ nor $k+101$ are composite,$($i.e; $k-1,k+101\in \mathbb{P})$.

From this OEIS list, and from wikipedia also, $n$ for which we have primes of the form $n!+1$ are listed. This list doesn't includes $101$, that means, $101!+1$ is composite also. So $101!+1,101!+2,101!+3,\cdots,101!+101$ is not list of exactly $101$ consecutive composite numbers(as, $101!+1$ is also composite). Is there a way to find such list for $101$ consecutive composites? and is it possible to find such list for any given length $n\in\mathbb{N}$ which includes exactly $n$ consecutive composite numbers.

I have tried this for a while and not getting any way out. In other way it is similar to finding primes with gap $102$. Though it is not listed here.


Edit:

I don't think there can be any solution without programming. I have translated this code to Python, one can check here.

$\endgroup$
6
  • 9
    $\begingroup$ Higher up all the primes are odd numbers meaning that there is always an odd number of composites between any two consecutive primes. Therefore exactly 100 is impossible. $\endgroup$ Aug 7, 2018 at 8:20
  • 2
    $\begingroup$ Not an efective method, but a version of Polignac's conjecture asserts that there are infinitely many such primes $p$ such the next prime is $p+100$ (or $p+n$ for every even number). $\endgroup$
    – xarles
    Aug 7, 2018 at 8:21
  • $\begingroup$ @JyrkiLahtonen Yeah, but what about odd gap ? suppose I change $100$ to $101$ ? $\endgroup$ Aug 7, 2018 at 8:23
  • 4
    $\begingroup$ Sorry about making a point by stating the obvious. Well, we have users who would have jumped to post that as an answer :-/. No, your real question is probably very difficult in general. I do guess that somebody with a suitable CAS and a bit of spare time could find a prime gap of exactly 100 or exactly 102 in a reasonable time (exactly how long it would take I dare not guess) by searching in a suitable range (primality testing is efficient in a predicted range here). $\endgroup$ Aug 7, 2018 at 8:28
  • $\begingroup$ @tarit goswami Consider the consecutive primes $7$ and $11$. The gap is filled by $8,9,10$ which is $3$ numbers; odd. See comment by Jyrki Lahtonen. Odd gaps are the only possibility, so gap of exactly $100$ is not possible. $\endgroup$ Sep 6, 2018 at 1:34

2 Answers 2

9
$\begingroup$

Average gap between primes is ~100 around $e^{100}=2.7\times10^{43}$, but it's amazing how frequently we find such gap for much, much smaller numbers:

Gaps of size 100 or 102:

396733 -> 396833: gap = 100
838249 -> 838349: gap = 100
1313467 -> 1313567: gap = 100
1444309 -> 1444411: gap = 102
1648081 -> 1648181: gap = 100
1655707 -> 1655807: gap = 100
1761187 -> 1761289: gap = 102
1775069 -> 1775171: gap = 102
2242549 -> 2242651: gap = 102
2305169 -> 2305271: gap = 102
2345989 -> 2346089: gap = 100
2784373 -> 2784473: gap = 100
3254959 -> 3255059: gap = 100
3392341 -> 3392443: gap = 102
3595489 -> 3595589: gap = 100
4044077 -> 4044179: gap = 102
4047157 -> 4047257: gap = 100
4315607 -> 4315709: gap = 102
4359403 -> 4359503: gap = 100
4447321 -> 4447423: gap = 102
4535717 -> 4535819: gap = 102
4571107 -> 4571207: gap = 100
4596731 -> 4596833: gap = 102
4665553 -> 4665653: gap = 100
4686709 -> 4686811: gap = 102
4783873 -> 4783973: gap = 100
5209177 -> 5209279: gap = 102
5211109 -> 5211209: gap = 100
5323949 -> 5324051: gap = 102
5398597 -> 5398697: gap = 100
5528287 -> 5528387: gap = 100
5723899 -> 5723999: gap = 100
5837399 -> 5837501: gap = 102
5976079 -> 5976181: gap = 102
6027283 -> 6027383: gap = 100
6242263 -> 6242363: gap = 100
6429223 -> 6429323: gap = 100
6836867 -> 6836969: gap = 102
6845417 -> 6845519: gap = 102
6851863 -> 6851963: gap = 100
7259167 -> 7259267: gap = 100
7309427 -> 7309529: gap = 102
7554367 -> 7554467: gap = 100
7662517 -> 7662617: gap = 100
7683131 -> 7683233: gap = 102
8073647 -> 8073749: gap = 102
8166107 -> 8166209: gap = 102
8257057 -> 8257157: gap = 100
8294021 -> 8294123: gap = 102
8332427 -> 8332529: gap = 102
8350483 -> 8350583: gap = 100
8441869 -> 8441969: gap = 100
8806891 -> 8806991: gap = 100
8841529 -> 8841629: gap = 100
8850671 -> 8850773: gap = 102
8921467 -> 8921569: gap = 102
8939597 -> 8939699: gap = 102
8947217 -> 8947319: gap = 102
8981461 -> 8981563: gap = 102
9162367 -> 9162467: gap = 100
9251059 -> 9251161: gap = 102
9389827 -> 9389927: gap = 100
9413533 -> 9413633: gap = 100
9548999 -> 9549101: gap = 102
9550813 -> 9550913: gap = 100
9573481 -> 9573583: gap = 102
9812611 -> 9812711: gap = 100
9918421 -> 9918521: gap = 100
9964667 -> 9964769: gap = 102
9972811 -> 9972913: gap = 102
10149721 -> 10149823: gap = 102
10172221 -> 10172321: gap = 100
10194227 -> 10194329: gap = 102
10194607 -> 10194707: gap = 100
10295821 -> 10295921: gap = 100
10440641 -> 10440743: gap = 102
10508359 -> 10508461: gap = 102
10569007 -> 10569107: gap = 100
10641937 -> 10642039: gap = 102
10668421 -> 10668521: gap = 100
10670389 -> 10670489: gap = 100
10703741 -> 10703843: gap = 102
10937921 -> 10938023: gap = 102
10942753 -> 10942853: gap = 100
10986277 -> 10986377: gap = 100
11126701 -> 11126803: gap = 102
11330197 -> 11330299: gap = 102
11366947 -> 11367047: gap = 100
11609203 -> 11609303: gap = 100
11765659 -> 11765759: gap = 100
11853031 -> 11853133: gap = 102
11930561 -> 11930663: gap = 102
11936809 -> 11936909: gap = 100
12069517 -> 12069619: gap = 102
12117121 -> 12117221: gap = 100
12459229 -> 12459329: gap = 100
12468457 -> 12468557: gap = 100
12501067 -> 12501169: gap = 102
12522973 -> 12523073: gap = 100
12557317 -> 12557417: gap = 100
12613721 -> 12613823: gap = 102
12623089 -> 12623189: gap = 100
12686647 -> 12686747: gap = 100
12780409 -> 12780511: gap = 102
13161601 -> 13161703: gap = 102
13200001 -> 13200101: gap = 100
13226921 -> 13227023: gap = 102
13251547 -> 13251647: gap = 100
13290547 -> 13290647: gap = 100
13331309 -> 13331411: gap = 102
13339429 -> 13339531: gap = 102
13385431 -> 13385531: gap = 100
13399709 -> 13399811: gap = 102
13582297 -> 13582399: gap = 102
13660663 -> 13660763: gap = 100
13720933 -> 13721033: gap = 100
13734913 -> 13735013: gap = 100
13776067 -> 13776167: gap = 100
13877329 -> 13877431: gap = 102
13905607 -> 13905707: gap = 100
14059657 -> 14059757: gap = 100
14076757 -> 14076857: gap = 100
14159149 -> 14159251: gap = 102
14160877 -> 14160977: gap = 100
14200141 -> 14200243: gap = 102
14243287 -> 14243389: gap = 102
14252431 -> 14252531: gap = 100
14272201 -> 14272301: gap = 100
14292571 -> 14292673: gap = 102
14312281 -> 14312381: gap = 100
14552269 -> 14552371: gap = 102
14933491 -> 14933591: gap = 100
14986009 -> 14986109: gap = 100
15028001 -> 15028103: gap = 102
15073999 -> 15074099: gap = 100
15455851 -> 15455953: gap = 102
15602989 -> 15603089: gap = 100
15666229 -> 15666331: gap = 102
15744541 -> 15744643: gap = 102
15805513 -> 15805613: gap = 100
15817831 -> 15817931: gap = 100
15913399 -> 15913501: gap = 102
16034591 -> 16034693: gap = 102
16117151 -> 16117253: gap = 102
16188649 -> 16188749: gap = 100
16250347 -> 16250447: gap = 100
16652869 -> 16652969: gap = 100
16699901 -> 16700003: gap = 102
16806071 -> 16806173: gap = 102
16988399 -> 16988501: gap = 102
17041789 -> 17041891: gap = 102
17198017 -> 17198119: gap = 102
17208497 -> 17208599: gap = 102
17318023 -> 17318123: gap = 100
17514089 -> 17514191: gap = 102
17573477 -> 17573579: gap = 102
17766599 -> 17766701: gap = 102
17823581 -> 17823683: gap = 102
17826733 -> 17826833: gap = 100
17844361 -> 17844461: gap = 100
17869591 -> 17869693: gap = 102
18042361 -> 18042463: gap = 102
18069371 -> 18069473: gap = 102
18112019 -> 18112121: gap = 102
18118367 -> 18118469: gap = 102
18153547 -> 18153649: gap = 102
18158731 -> 18158831: gap = 100
18341161 -> 18341261: gap = 100
18366133 -> 18366233: gap = 100
18475663 -> 18475763: gap = 100
18494401 -> 18494501: gap = 100
18687169 -> 18687269: gap = 100
18719983 -> 18720083: gap = 100
18751441 -> 18751541: gap = 100
18785467 -> 18785567: gap = 100
19158547 -> 19158649: gap = 102
19161631 -> 19161731: gap = 100
19188649 -> 19188751: gap = 102
19266127 -> 19266229: gap = 102
19282741 -> 19282843: gap = 102
19294423 -> 19294523: gap = 100
19304167 -> 19304267: gap = 100
19415699 -> 19415801: gap = 102
19416511 -> 19416611: gap = 100
19553129 -> 19553231: gap = 102
19643839 -> 19643941: gap = 102
19759177 -> 19759279: gap = 102
19871281 -> 19871381: gap = 100
19896707 -> 19896809: gap = 102
19917067 -> 19917167: gap = 100
19954471 -> 19954573: gap = 102
19956227 -> 19956329: gap = 102
19998047 -> 19998149: gap = 102
20122241 -> 20122343: gap = 102
20256967 -> 20257067: gap = 100
20304313 -> 20304413: gap = 100
20315917 -> 20316017: gap = 100
20583601 -> 20583701: gap = 100
20583709 -> 20583809: gap = 100
20664139 -> 20664239: gap = 100
20737259 -> 20737361: gap = 102
20781931 -> 20782031: gap = 100
20796077 -> 20796179: gap = 102
20851109 -> 20851211: gap = 102
20892757 -> 20892857: gap = 100
21007321 -> 21007423: gap = 102
21024643 -> 21024743: gap = 100
21041879 -> 21041981: gap = 102
21110263 -> 21110363: gap = 100
21146399 -> 21146501: gap = 102
21177139 -> 21177239: gap = 100
21222043 -> 21222143: gap = 100
21242237 -> 21242339: gap = 102
21354451 -> 21354551: gap = 100
21369109 -> 21369209: gap = 100
21425893 -> 21425993: gap = 100
21550939 -> 21551039: gap = 100
21652537 -> 21652639: gap = 102

etc.

The following Java code will list all prime pairs with the given gap:

import java.util.List; 
import java.util.ArrayList;

public class Prime100 {
    private List<Long> primes = new ArrayList<>();
    private long targetGap;

    public Prime100(long targetGap) {
        this.targetGap = targetGap;
        primes.add(2L);
        primes.add(3L);
    }

    boolean isPrime(long n) {
        boolean ok = true;
        for(long p: primes) {
            if(p * p > n) {
                break;
            }
            if(n % p == 0) {
                ok = false;
                break;
            }
        }
        if(ok) {
            long lastPrime = primes.get(primes.size() - 1);
            long gap = n - lastPrime;
            if(gap == targetGap) {
                System.out.println(lastPrime + " -> " + n + ": gap = " + gap);
            }
            primes.add(n);

        }
        return ok;
    }

    public static void main(String[] args) {
        Prime100 primeChecker = new Prime100(102);
        long n = 5;
        while(true) {           
            primeChecker.isPrime(n++);
        }
    }

}

In the following line just replace 102 with the gap you are interested in:

Prime100 primeChecker = new Prime100(102);
$\endgroup$
7
  • 3
    $\begingroup$ Thank you! Is there any mathematical way? without help of program. $\endgroup$ Aug 7, 2018 at 10:17
  • $\begingroup$ I don't think so. $\endgroup$
    – Saša
    Aug 7, 2018 at 13:03
  • 3
    $\begingroup$ According to the paper First Occurrence Prime Gaps, by Dr. Thomas R. Nicely, the first prime gap of exactly $102$ is from $1,444,309$ to $1,444,411$, discovered bt Glaisher in 1877, $\endgroup$ Sep 6, 2018 at 8:54
  • $\begingroup$ @DanielWainfleet Nice (and in sync with the output form my script)! I can only imagine how difficult it was in 1877. $\endgroup$
    – Saša
    Sep 6, 2018 at 11:50
  • 1
    $\begingroup$ I don't think there can be any solution without programming. I have translated this code to Python, one can check here $\endgroup$ Mar 29, 2019 at 11:47
0
$\begingroup$

See OEIS A000230 for smallest gaps of a given size including some programs. Can we do it without a computer? Sure if you have enough patience and concentration, but I believe historically these people were called computers, so .... But if the question is whether there is a nice mathematical shortcut, no. We need to exhaustively search or use results of other people's exhaustive searches.

Simple programs for finding lots of gaps of a given size. These will be a lot faster than those using trial division.

# Replace '200' with your chosen gap size, and 1e10 with how far you care to look.

perl -E 'use ntheory ":all"; my($g,$l)=(200,0); forprimes { say $l if $_-$l==$g; $l=$_; } 1e10'

# Pari/GP, about 2-4x slower
g=200; l=0; forprime(p=2, 10^10, p-l==g && print(l); l=p)
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .