login
Numbers k such that 2k-1 is not prime.
15

%I #76 Aug 02 2024 15:58:59

%S 1,5,8,11,13,14,17,18,20,23,25,26,28,29,32,33,35,38,39,41,43,44,46,47,

%T 48,50,53,56,58,59,60,61,62,63,65,67,68,71,72,73,74,77,78,80,81,83,85,

%U 86,88,89,92,93,94,95,98,101,102,103,104,105,107,108,109,110,111,113

%N Numbers k such that 2k-1 is not prime.

%C Same as A053726 except for the first term of this sequence.

%C Numbers k such that A064216(k) is not prime. - _Antti Karttunen_, Apr 17 2015

%C Union of 1 and terms of the form (u+1)*(v+1) + u*v with 1 <= u <= v. - _Ralf Steiner_, Nov 17 2021

%H Vincenzo Librandi (first 1000 terms) & Antti Karttunen, <a href="/A104275/b104275.txt">Table of n, a(n) for n = 1..10001</a>

%F a(n) = A047845(n-1) + 1.

%F For n > 1, a(n) = A053726(n-1) = n + A008508(n-1). - _Antti Karttunen_, Apr 17 2015

%F a(n) = (A014076(n)+1)/2. - _Robert Israel_, Apr 17 2015

%e a(1) = 1 because 2*1-1=1, not prime.

%e a(2) = 5 because 2*5-1=9, not prime (2, 3 and 4 give 3, 5 and 7 which are primes).

%e From _Vincenzo Librandi_, Jan 15 2013: (Start)

%e As a triangular array (apart from term 1):

%e 5;

%e 8, 13;

%e 11, 18, 25;

%e 14, 23, 32, 41;

%e 17, 28, 39, 50, 61;

%e 20, 33, 46, 59, 72, 85;

%e 23, 38, 53, 68, 83, 98, 113;

%e 26, 43, 60, 77, 94, 111, 128, 145;

%e 29, 48, 67, 86, 105, 124, 143, 162, 181;

%e 32, 53, 74, 95, 116, 137, 158, 179, 200, 221; etc.

%e which is obtained by (2*h*k + k + h + 1) with h >= k >= 1. (End)

%e The above array, which contains the same terms as A053726 but in different order and with some duplicates, has its own entry A144650. - _Antti Karttunen_, Apr 17 2015

%p remove(t -> isprime(2*t-1), [$1..1000]); # _Robert Israel_, Apr 17 2015

%t Select[Range[115], !PrimeQ[2#-1] &] (* _Robert G. Wilson v_, Apr 18 2005 *)

%o (Magma) [n: n in [1..220]| not IsPrime(2*n-1)]; // _Vincenzo Librandi_, Jan 28 2011

%o (Scheme) (define (A104275 n) (if (= 1 n) 1 (A053726 (- n 1)))) ;; More code in A053726. - _Antti Karttunen_, Apr 17 2015

%o (Python)

%o from sympy import isprime

%o def ok(n): return not isprime(2*n-1)

%o print(list(filter(ok, range(1, 114)))) # _Michael S. Branicky_, May 08 2021

%o (Python)

%o from sympy import primepi

%o def A104275(n):

%o if n <= 2: return ((n-1)<<2)+1

%o m, k = n-1, (r:=primepi(n-1)) + n - 1 + (n-1>>1)

%o while m != k:

%o m, k = k, (r:=primepi(k)) + n - 1 + (k>>1)

%o return r+n-1 # _Chai Wah Wu_, Aug 02 2024

%o (PARI) select( {is_A104275(n)=!isprime(n*2-1)}, [1..115]) \\ _M. F. Hasler_, Aug 02 2022

%o (SageMath) [n for n in (1..250) if not is_prime(2*n-1)] # _G. C. Greubel_, Oct 17 2023

%Y Cf. A006254 (complement), A246371 (a subsequence).

%Y Cf. A005097, A008508, A014076, A047845, A053726, A064216, A144650.

%K easy,nonn

%O 1,2

%A _Alexandre Wajnberg_, Apr 17 2005

%E More terms from _Robert G. Wilson v_, Apr 18 2005