A085090 If 2n-1 is prime then a(n) = 2n-1, otherwise a(n) = 0.
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
Offset: 1
Examples
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.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Crossrefs
Cf. A122845.
Programs
-
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
-
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 *)
-
PARI
a(n) = if (isprime(p=2*n-1), p, 0); \\ Michel Marcus, Aug 09 2018
Formula
If 2n-1 is prime then a(n) = 2n-1, otherwise a(n) = 0. - David Wasserman, Jan 25 2005
a(n+1) = (4n-1)!! mod (2n+1)^2; by Gauss generalization of the Wilson's theorem. - Thomas Ordowski, Jul 23 2016
Extensions
More terms from David Wasserman, Jan 25 2005
New name using formula from David Wasserman, Joerg Arndt, Jul 24 2016
Comments