login
a(n) = smallest integer m for which there is an integer k, with 0 < k < m and gcd(k,m)=1, such that the arithmetic progression m+k, 2*m+k, ..., n*m+k contains only composite numbers.
3

%I #44 Mar 21 2022 09:11:16

%S 3,5,7,11,11,13,19,19,19,31,31,31,31,31,31,31,31,47,47,61,61,61,61,

%T 127,127,127,127,127,139,139,139,139,139,193,193,229,229,229,229,283,

%U 283,283,283,283,283,337,337,337,337,337,409,409,409,409,409,409,409,461

%N a(n) = smallest integer m for which there is an integer k, with 0 < k < m and gcd(k,m)=1, such that the arithmetic progression m+k, 2*m+k, ..., n*m+k contains only composite numbers.

%C Richard Guy reports that the sequence originated with Victor Pambuccian, who asks, among other things, if a(n) is always prime. [The answer is no - read on. - _N. J. A. Sloane_, Mar 13 2022]

%C For the corresponding values of k see A352186.

%C a(135) = 8207 is the first nonprime term and there are many other counterexamples to the conjecture: a(150..173) = 12311, a(193..195) = 40247, a(196..202) = 40951, ... . - _Michael S. Branicky_, Mar 13 2022

%H Michael S. Branicky, <a href="/A352185/b352185.txt">Table of n, a(n) for n = 1..232</a>

%H Richard K. Guy, <a href="http://www.jstor.org/stable/2322320">What are the smallest arithmetic progressions of composite numbers?</a>, Amer. Math. Monthly, Vol. 93, No. 8 (1986), p. 627.

%F a(n+1) >= a(n) by construction. - _Michael S. Branicky_, Mar 12 2022

%e For n=1, m=3, k=1, the AP is [4].

%e For n=4, m=11, k=5, the AP is [16, 27, 38, 49].

%o (Python)

%o from math import gcd

%o from sympy import isprime

%o from itertools import count, islice, takewhile

%o def comp(n): return not isprime(n)

%o def agen(): # generator of terms

%o n = 1

%o for m in count(2):

%o for k in range(1, m):

%o if gcd(k, m) != 1:

%o continue

%o ap = len(list(takewhile(comp, (i*m+k for i in count(1)))))

%o if ap >= n:

%o for i in range(n, ap+1):

%o yield m

%o n = ap + 1

%o print(list(islice(agen(), 58))) # _Michael S. Branicky_, Mar 12 2022

%Y Cf. A352186.

%K nonn

%O 1,1

%A _N. J. A. Sloane_, Mar 12 2022

%E a(24) and beyond from _Michael S. Branicky_, Mar 12 2022.