login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the smallest positive integer that when expressed in bases 2 to n, but read in base n, is always prime.
1

%I #31 Nov 22 2021 22:51:07

%S 2,2,43,2,45481,2,65484343,186914543201,50006393431,2

%N a(n) is the smallest positive integer that when expressed in bases 2 to n, but read in base n, is always prime.

%C a(n)=2 whenever n is prime.

%C Proof:

%C Let n be a prime number.

%C 2 expressed in any base larger than 2 is still 2, which is prime.

%C 2 expressed in base 2 is 10. And 10 read in base n is 1*n + 0 = n, which is prime.

%C The sequence, even when prime indexes are omitted, is not necessarily increasing.

%C Proof: a(9) > a(10).

%e a(4) = 43, because

%e 43 is prime

%e 43 in base 3 is 1121 = 1*3^3 + 1*3^2 + 2*3 + 1 and

%e 1*4^3 + 1*4^2 + 2*4 + 1 = 89, which is prime;

%e 43 in base 2 is 101011 = 1*2^5 + 0*2^4 + 1*2^3 + 0*2^2 + 1*2^1 + 1 and

%e 1*4^5 + 0*4^4 + 1*4^3 + 0*4^2 + 1*4^1 + 1 = 1093, which is prime;

%e and 43 is the smallest positive integer with this property.

%e a(10) = 50006393431

%e = 153060758677_9

%e = 564447201127_8

%e = 3420130221331_7

%e = 34550030320411_6

%e = 1304403114042211_5

%e = 232210213100021113_4

%e = 11210002000211222202121_3

%e = 101110100100100111010000001001010111_2;

%e if we read these numbers as base-10 numbers, they are all prime. And 50006393431 is the smallest positive integer with this property.

%o (PARI) isok(k, n) = {for (b=2, n, if (! ispseudoprime(fromdigits(digits(k, b), n)), return (0));); return (1);}

%o a(n) = my(k=1); while (!isok(k, n), k++); k; \\ _Michel Marcus_, Oct 09 2021

%o (Python)

%o from gmpy2 import digits, is_prime, next_prime

%o def A348226(n): # code assumes n <= 63 or n is prime

%o if is_prime(n):

%o return 2

%o p = 2

%o while True:

%o for i in range(n-1,1,-1):

%o s = digits(p,i)

%o if not is_prime(int(s,n)):

%o break

%o else:

%o return p

%o p = next_prime(p) # _Chai Wah Wu_, Nov 19 2021

%K nonn,base,more

%O 2,1

%A _Jesús Bellver Arnau_, Oct 09 2021