A052339 Values of n at which record values in A052340 are reached.
1, 4, 12, 13, 42, 43, 73, 658
Offset: 1
Extensions
659*2^n-1 is composite for n<2^17.
One more term supplied by David Broadhurst, Jan 02 2000
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
For n=4; the smallest m>=1 such that (4+1)*2^m-1 is prime is m=2: 5*2^2-1=19 (prime). - _Jaroslav Krizek_, Feb 13 2011
A050412 := proc(n) local twox1,k ; twox1 := 2*n+1 ; k := 1; while not isprime(twox1) do twox1 := 2*twox1+1 ; k := k+1 ; end do: return k; end proc: # R. J. Mathar, Jul 23 2015
a[n_] := Block[{s=n, c=1}, While[ ! PrimeQ[2*s+1], s = 2*s+1; c++]; c]; Table[ a[n], {n, 1, 99} ] (* Jean-François Alcover, Feb 06 2012, after Pari *) a[n_] := Block[{k = 1}, While[ !PrimeQ[2^k (n + 1) - 1], k++];k]; Array[a, 100] (* Robert G. Wilson v, Feb 14 2015 *) (* Corrected by Paolo Xausa, Jul 30 2024 *)
a(n)=if(n<0,0,s=n; c=1; while(isprime(2*s+1)==0,s=2*s+1; c++); c) (Python, designed specifically for n = 104917) #! /usr/bin/env python3 from labmath import primegen, isprime, mpz, count from multiprocessing import Pool primes = list(primegen(1000000)) def test(n): for p in primes: if (104917 * pow(2, n, p)) % p == 1: return (n, False) return (n, isprime(104917 * mpz(2)**n - 1, tb=[])) with Pool(24) as P: for (n, result) in P.imap(test, count()): print('\b'*80, n, end='', flush=True) if result: break # Lucas A. Brown, Aug 01 2024
a(4)=19 because 4 -> 9 (composite) -> 19 (prime).
Table[NestWhile[2#+1&,2n+1,!PrimeQ[#]&,1,1000],{n,60}] (* Harvey P. Dale, May 08 2011 *)
a(n)=while(!isprime(n=2*n+1),);n \\ oo loop when a(n) = 0. - Charles R Greathouse IV, May 08 2011
record = 2; Reap[For[n = 1, n <= 100, n++, k = n; While[ !PrimeQ[k = 2*k + 1]]; If[k > record, Print[k]; Sow[k]; record = k]]][[2, 1]] (* Jean-François Alcover, Jul 19 2013 *)
43 leads to composites 87, 175 etc. and eventually to the prime 738197503.
Comments