cp's OEIS Frontend

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.

A238694 Smallest k such that 2^n - k and k*2^n - 1 are both prime or 0 if no such k exists.

This page as a plain text file.
%I A238694 #15 Feb 18 2022 10:03:21
%S A238694 0,1,1,3,1,3,1,5,25,5,31,5,1,15,49,17,1,5,1,17,9,33,69,89,61,111,199,
%T A238694 309,75,297,1,5,49,131,31,17,31,131,165,437,55,33,309,495,361,437,999,
%U A238694 89,139,195,129,183,685,315,915,189,585,1035,931,93,1,57,165
%N A238694 Smallest k such that 2^n - k and k*2^n - 1 are both prime or 0 if no such k exists.
%C A238694 If a(n)=1, then the two primes are same and they are Mersenne primes (A000668).
%H A238694 Alois P. Heinz, <a href="/A238694/b238694.txt">Table of n, a(n) for n = 1..1000</a>
%e A238694 a(9) = 25 because 2^9 - 25  = 487 and 25*2^9 - 1 = 12799 are both prime.
%p A238694 a:= proc(n) local k, p; p:= 2^n;
%p A238694       for k while not (isprime(p-k) and isprime(k*p-1))
%p A238694         do if k>=p then return 0 fi od; k
%p A238694     end:
%p A238694 seq(a(n), n=1..70);  # _Alois P. Heinz_, Mar 03 2014
%t A238694 a[n_] := Module[{k, p}, p = 2^n;
%t A238694      For[k = 1, !(PrimeQ[p - k] && PrimeQ[k*p - 1]), k++,
%t A238694            If[k >= p, Return[0]]]; k];
%t A238694 Table[a[n], {n, 1, 70}] (* _Jean-François Alcover_, Feb 18 2022, after _Alois P. Heinz_ *)
%Y A238694 Cf. A238554.
%K A238694 nonn
%O A238694 1,4
%A A238694 _Ilya Lopatin_ and _Juri-Stepan Gerasimov_, Mar 03 2014
%E A238694 More terms from _Alois P. Heinz_, Mar 03 2014