login
a(n) is the least number that is prime when interpreted in bases 2 to n, but not n+1.
0

%I #12 Feb 09 2023 21:56:21

%S 11,10,101111,10010111,110111111101001,111110100001,11000011101101111,

%T 10011110011011110110110011,110100000010101111110001010011001110001,

%U 1000000010000011110100010001000101001010110111001,10100001011000101000110101011011011101111110100101011

%N a(n) is the least number that is prime when interpreted in bases 2 to n, but not n+1.

%C Since a(n) must be a valid base-2 integer, it can only have digits 0 and 1.

%e a(4) = 101111 because 101111 interpreted in base-2 is 47 (prime), base-3 is 283 (prime), base-4 is 1109 (prime), but base-5 is 3281 (not prime).

%p V:= Vector(9): count:= 0:

%p f:= proc(n) local L,P,x,b,i;

%p L:= convert(n,base,10);

%p P:= add(L[i]*x^(i-1),i=1..nops(L));

%p for b from 2 do if not isprime(eval(P,x=b)) then return b-1 fi od

%p end proc:

%p for i from 1 while count < 8 do

%p X:= convert(i,binary);

%p v:= f(X);

%p if v >= 1 and v <= 9 and V[v] = 0 then

%p V[v]:= X;

%p count:= count+1;

%p fi

%p od:

%p convert(V[2..9],list);

%o (Python)

%o from sympy import isprime

%o from itertools import count, islice, product

%o def f(s): return next(b-1 for b in count(2) if not isprime(int(s, b)))

%o def agen():

%o n, adict = 2, {2:11, 3:10}

%o for d in count(3):

%o for b in product("01", repeat=d-2):

%o s = "1" + "".join(b) + "1"

%o v = f(s)

%o if v not in adict: adict[v] = int(s)

%o while n in adict: yield adict[n]; n += 1

%o print(list(islice(agen(), 7))) # _Michael S. Branicky_, Feb 09 2023

%Y Cf. A086884.

%K nonn,base

%O 2,1

%A _Robert Israel_, Feb 09 2023

%E a(10)-a(12) using A086884 from _Michael S. Branicky_, Feb 09 2023