login
a(n) is the least k such that nk - 1 and nk + 1 are both composite.
1

%I #17 Oct 21 2021 01:59:35

%S 5,13,3,14,1,20,1,7,1,5,1,10,1,4,1,4,1,8,1,6,1,7,1,5,1,1,1,2,1,4,1,2,

%T 1,1,1,4,1,2,1,3,1,17,1,4,1,2,1,3,1,1,1,4,1,4,1,1,1,2,1,2,1,2,1,1,1,8,

%U 1,3,1,8,1,2,1,4,1,1,1,8,1,2,1,3,1,11,1,1,1,2,1,10,1,1,1,1,1,3,1,4,1,3,1,2

%N a(n) is the least k such that nk - 1 and nk + 1 are both composite.

%C Inspired by the entry on "120" in David Wells's Dictionary of Curious and Interesting Numbers. Question: Is 20 the maximum value of a(n)?

%C The maximum value of a(n) for n <= 10^9 is a(6)=20. a(52270140)=18. Up to n=10^9: 20,19,18,17,16,15,14,13,12,11 occur 1,0,1,1,0,0,8,21,46,184 times, respectively. - _Rick L. Shepherd_, Aug 31 2005

%C From _Pontus von Brömssen_, Oct 18 2021: (Start)

%C The largest values of a(n) for n <= 10^11 are:

%C a(6) = 20,

%C a(52270140) = 18,

%C a(42) = 17,

%C a(1949498670) = 16,

%C a(35519579340) = 16,

%C a(10345823670) = 15,

%C a(14129051580) = 15,

%C a(27052720860) = 15,

%C a(40969624920) = 15,

%C a(44358822060) = 15,

%C a(45919321350) = 15,

%C a(71392894740) = 15.

%C The following heuristic argument suggests that {a(n)} is unbounded: a(n) > m holds exactly when at least one of n*k - 1 and n*k + 1 is prime for 1 <= k <= m. For large (random) n and a fixed k <= m, the probability that at least one of n*k - 1 and n*k + 1 is prime is of the order 1/(log n). Assuming independence between different k, the probability that a(n) > m is of the order 1/(log n)^m. Since the sum over n of 1/(log n)^m diverges, a(n) > m should occur infinitely often by the second Borel-Cantelli lemma (assuming independence between different n).

%C (End)

%H Harry J. Smith, <a href="/A065865/b065865.txt">Table of n, a(n) for n = 1..1000</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Borel-Cantelli_lemma">Borel-Cantelli lemma</a>

%e a(4) = 14 since k = 14 is the least k such that 4k - 1 and 4k + 1 are both composite.

%t Array[Block[{k = 0}, While[! AllTrue[# k + {-1, 1}, CompositeQ], k++]; k] &, 102] (* _Michael De Vlieger_, Oct 20 2021 *)

%o (PARI) for(n=1,150, k=1; while(isprime(k*n-1)||isprime(k*n+1), k++); print1(k,",")) \\ _Rick L. Shepherd_, Aug 31 2005

%o (PARI) { for (n = 1, 1000, a=1; while(isprime(a*n - 1) || isprime(a*n + 1), a++); write("b065865.txt", n, " ", a) ) } \\ _Harry J. Smith_, Nov 02 2009

%K nonn

%O 1,1

%A _Joseph L. Pe_, Dec 06 2001

%E More terms from _Rick L. Shepherd_, Aug 31 2005