login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Primes p(n) such that gcd(n, prime(n-1)+prime(n+1)) > 1.
4

%I #16 Dec 07 2022 12:27:15

%S 7,11,13,19,23,29,31,37,43,47,53,61,71,73,79,89,97,101,107,113,131,

%T 137,139,149,151,163,167,173,181,193,199,223,229,233,239,251,263,269,

%U 271,281,293,311,317,337,349,359,373,379,383,397,409,421,433,443,449

%N Primes p(n) such that gcd(n, prime(n-1)+prime(n+1)) > 1.

%H Robert Israel, <a href="/A336381/b336381.txt">Table of n, a(n) for n = 1..10000</a>

%e In the following table, P(n) = A000040(n) = prime(n).

%e n P(n) P(n-1)+P(n+1) gcd

%e 2 3 7 1

%e 3 5 10 1

%e 4 7 16 4

%e 5 11 20 5

%e 6 13 28 2

%e 2 and 3 are in A336378; 4 and 5 are in A336379; 3 and 5 are in A336380; 7 and 11 are in A336381.

%p q:= 2: r:= 3:

%p R:= NULL: count:= 0:

%p for n from 2 while count < 100 do

%p p:= q; q:= r; r:= nextprime(r);

%p if igcd(n,p+r) > 1 then count:= count+1; R:= R, q; fi

%p od:

%p R; # _Robert Israel_, Dec 08 2020

%t p[n_] := Prime[n];

%t u = Select[Range[2, 200], GCD[#, p[# - 1] + p[# + 1]] == 1 &] (* A336378 *)

%t v = Select[Range[2, 200], GCD[#, p[# - 1] + p[# + 1]] > 1 &] (* A336379 *)

%t Prime[u] (* A336380 *)

%t Prime[v] (* A336381 *)

%t Select[Partition[Prime[Range[100]],3,1],GCD[PrimePi[#[[2]]],#[[1]]+#[[3]]]>1&][[All,2]] (* _Harvey P. Dale_, Dec 07 2022 *)

%o (PARI) for(n=2,200,if(gcd(n,prime(n-1)+prime(n+1))>1,print1(prime(n),", "))) \\ _Derek Orr_, Nov 23 2020

%Y Cf. A000040, A048448, A336366, A336378, A336379, A336380.

%K nonn

%O 1,1

%A _Clark Kimberling_, Oct 25 2020

%E Offset changed by _Robert Israel_, Dec 08 2020