The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A100813 Smallest number in base 2 which is also prime in base 2+n, or 0 if no such number exists. 1

%I #13 Aug 20 2022 13:37:56

%S 10,11,10,11,10,111,1011,11,10,11,10,101,111,11,10,11,10,101,111,11,

%T 10,101,111011,101,111,11,10,11,10,1011,111,10001,1101,11,10,111,1011,

%U 11,10,11,10,1011,1101,11,10,1011,1100111,111,101001,11,10,101,111011,101

%N Smallest number in base 2 which is also prime in base 2+n, or 0 if no such number exists.

%H Michael S. Branicky, <a href="/A100813/b100813.txt">Table of n, a(n) for n = 1..10000</a>

%e a(6) = 111: 111 (base 2) = 7, which is prime; 111 (base 2+6) = 73, which is prime.

%t a = {}; Do[ k = 1; While[ ! PrimeQ[FromDigits[IntegerDigits[Prime[k], 2], 2 + n]], k++ ]; AppendTo[a, FromDigits[IntegerDigits[Prime[k], 2], 10]];, {n, 50}]; a (* _Ray Chandler_, Jan 10 2005 *)

%o (Python)

%o from sympy import isprime, nextprime

%o def fd(s, b): return sum(b**i for i, si in enumerate(s[::-1]) if si=='1')

%o def a(n):

%o p = 2

%o while not isprime(fd(bin(p)[2:], n+2)): p = nextprime(p)

%o return int(bin(p)[2:])

%o print([a(n) for n in range(1, 55)]) # _Michael S. Branicky_, Aug 20 2022

%K base,nonn

%O 1,1

%A _Ray G. Opao_, Jan 05 2005

%E Corrected and extended by _Ray Chandler_, Jan 10 2005

%E a(51) and beyond from _Michael S. Branicky_, Aug 09 2022

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