login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A166109 a(1)=5. For n >= 2, a(n) = the smallest prime p > a(n-1) where neither p+1 nor p-1 is divisible by any (earlier) term of this sequence. 1

%I #10 Jun 16 2019 22:30:42

%S 5,7,17,23,37,53,157,163,173,193,227,233,257,263,283,353,383,397,457,

%T 487,523,557,563,607,677,683,733,787,823,857,863,877,947,983,997,1033,

%U 1097,1117,1153,1187,1193,1237,1277,1283,1297,1307,1423,1433,1447,1453

%N a(1)=5. For n >= 2, a(n) = the smallest prime p > a(n-1) where neither p+1 nor p-1 is divisible by any (earlier) term of this sequence.

%C This sequence would have terminated after only one term if a(1) equaled 2 or 3.

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

%e a(5) = 37. So we want to look at the primes > 37 to get a(6). 41 - 1 is divisible by a(1)=5. (And 41+1 is divisible by a(2)=7.) 43-1 is divisible by a(2)=7. 47-1 is divisible by a(4)=23. By 53-1 is not divisible by any earlier terms of the sequence, and 53+1 is not divisible by any earlier terms of the sequence. So a(6) = 53.

%p Res:= 5: S:= 5: p:= 5:

%p count:= 1:

%p while count < 100 do

%p p:= nextprime(p);

%p if igcd((p+1)*(p-1),S) = 1 then

%p count:= count+1; Res:= Res, p;

%p S:= S*p;

%p fi

%p od:

%p Res; # _Robert Israel_, Jun 16 2019

%K nonn

%O 1,1

%A _Leroy Quet_, Oct 06 2009

%E Extended by _Ray Chandler_, Mar 12 2010

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 20 11:59 EDT 2024. Contains 371838 sequences. (Running on oeis4.)