

A065865


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


1



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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)



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 BorelCantelli lemma (assuming independence between different n).
(End)


LINKS

Harry J. Smith, Table of n, a(n) for n = 1..1000
Wikipedia, BorelCantelli 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*n1)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

Sequence in context: A282063 A035412 A338985 * A088618 A121645 A057691
Adjacent sequences: A065862 A065863 A065864 * A065866 A065867 A065868


KEYWORD

nonn


AUTHOR

Joseph L. Pe, Dec 06 2001


EXTENSIONS

More terms from Rick L. Shepherd, Aug 31 2005


STATUS

approved



