OFFSET
1,1
COMMENTS
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)?
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
From Pontus von Brömssen, Oct 18 2021: (Start)
The largest values of a(n) for n <= 10^11 are:
a(6) = 20,
a(52270140) = 18,
a(42) = 17,
a(1949498670) = 16,
a(35519579340) = 16,
a(10345823670) = 15,
a(14129051580) = 15,
a(27052720860) = 15,
a(40969624920) = 15,
a(44358822060) = 15,
a(45919321350) = 15,
a(71392894740) = 15.
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).
(End)
LINKS
Harry J. Smith, Table of n, a(n) for n = 1..1000
Wikipedia, Borel-Cantelli lemma
EXAMPLE
a(4) = 14 since k = 14 is the least k such that 4k - 1 and 4k + 1 are both composite.
MATHEMATICA
Array[Block[{k = 0}, While[! AllTrue[# k + {-1, 1}, CompositeQ], k++]; k] &, 102] (* Michael De Vlieger, Oct 20 2021 *)
PROG
(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
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Joseph L. Pe, Dec 06 2001
EXTENSIONS
More terms from Rick L. Shepherd, Aug 31 2005
STATUS
approved