cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A294078 a(n) is the smallest even number k such that k*prime(n) - 1 or k*prime(n) + 1 is prime.

This page as a plain text file.
%I A294078 #24 Mar 19 2018 06:28:38
%S A294078 2,2,2,2,2,4,4,2,2,2,2,2,2,4,6,2,6,6,4,4,4,2,2,2,2,6,6,6,6,2,4,2,4,2,
%T A294078 8,6,2,4,10,2,2,6,2,4,4,2,2,8,4,2,2,2,6,2,6,4,6,2,4,2,6,2,2,6,6,6,2,2,
%U A294078 6,8,10,2,2,4,2,4,6,6,8,4
%N A294078 a(n) is the smallest even number k such that k*prime(n) - 1 or k*prime(n) + 1 is prime.
%C A294078 For n <= 10^9 the largest term is 186.
%C A294078 First occurrence of 2k, k=1,2,3,...: 1, 6, 15, 35, 39, 117, 1134, 199, 152, 362, ..., . - _Robert G. Wilson v_, Feb 08 2018
%e A294078 For n = 6, prime(6) = 13. The smallest even number k such that k * 13 + 1 is a prime number is k = 4, because 4 * 13 + 1 = 53 (not k = 2). So 4 is the sixth term.
%t A294078 f[n_] := Block[{k = 2, p = Prime@ n}, While[ !PrimeQ[k*p -1] && !PrimeQ[k*p +1], k += 2]; k]; Array[f, 100] (* _Robert G. Wilson v_, Feb 08 2018 *)
%o A294078 (PARI) {
%o A294078   forprime(p=2,100,
%o A294078     k=2;
%o A294078     while(!isprime(k*p-1)&&!isprime(k*p+1),k+=2);
%o A294078     print1(k", ");
%o A294078   )
%o A294078 }
%Y A294078 Cf. A000040, A071407 (with "and" rather than "or").
%K A294078 nonn
%O A294078 1,1
%A A294078 _Dimitris Valianatos_, Feb 07 2018