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!)
A085090 If 2n-1 is prime then a(n) = 2n-1, otherwise a(n) = 0. 9
0, 3, 5, 7, 0, 11, 13, 0, 17, 19, 0, 23, 0, 0, 29, 31, 0, 0, 37, 0, 41, 43, 0, 47, 0, 0, 53, 0, 0, 59, 61, 0, 0, 67, 0, 71, 73, 0, 0, 79, 0, 83, 0, 0, 89, 0, 0, 0, 97, 0, 101, 103, 0, 107, 109, 0, 113, 0, 0, 0, 0, 0, 0, 127, 0, 131, 0, 0, 137, 139, 0, 0, 0, 0, 149, 151, 0, 0, 157, 0, 0, 163 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Previous name was: Starting with n+(n-1) go on adding n-2, then n-3, etc. until one gets a prime; a(n) = smallest prime in n+(n-1)+(n-2)+...+(n-i) (with the least i that gives a prime), or 0 if no such prime exists.
LINKS
FORMULA
If 2n-1 is prime then a(n) = 2n-1, otherwise a(n) = 0. - David Wasserman, Jan 25 2005
a(A098090(n)-1)=2*A098090(n)-3; a(n)=(2*n-1)*A101264(n-1). - Reinhard Zumkeller, Sep 14 2006
a(n+1) = (4n-1)!! mod (2n+1)^2; by Gauss generalization of the Wilson's theorem. - Thomas Ordowski, Jul 23 2016
EXAMPLE
a(8) = 0 as there is no prime in the partial sum of the finite sequence 8,7,6,5,4,3,2,1.
a(7) = 13 = 7 + 6.
MATHEMATICA
apr[n_]:=Module[{cl=Select[Rest[Accumulate[Range[n, 1, -1]]], PrimeQ, 1]}, If[cl=={}, 0, First[cl]]]; Array[apr, 100] (* Harvey P. Dale, Jun 01 2012 *)
b[n_] := Mod[(-5 + 4 n)!!, (-1 + 2 n)^2]; a = Array[b, 82] (* Fred Daniel Kline, Oct 04 2018; Thomas Ordowski's formula with adjusted index *)
PROG
(PARI) a(n) = if (isprime(p=2*n-1), p, 0); \\ Michel Marcus, Aug 09 2018
(Magma) DoubleFactorial:=func< n | &*[n..2 by -2] >; [ DoubleFactorial(-5 + 4*n) mod (-1 + 2*n)^2: n in [1..90]]; // Vincenzo Librandi, Oct 04 2018
(Magma) [IsPrime(2*n-1) select 2*n-1 else 0: n in [1..90]]; // Bruno Berselli, Oct 05 2018
CROSSREFS
Cf. A122845.
Sequence in context: A173013 A223174 A225401 * A084713 A162538 A324990
KEYWORD
nonn,easy
AUTHOR
Amarnath Murthy and Meenakshi Srikanth (menakan_s(AT)yahoo.com), Jul 02 2003
EXTENSIONS
More terms from David Wasserman, Jan 25 2005
New name using formula from David Wasserman, Joerg Arndt, Jul 24 2016
STATUS
approved

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 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)