%I #22 Nov 19 2022 21:55:50
%S 2,2,47,151,4001,4001,100207,41532851,447045215857,282607273285049,
%T 5678228814363947
%N Decimal equivalents of strings in A086884.
%H Mersenneforum.org, <a href="https://mersenneforum.org/showthread.php?t=5866">Multibase primes</a>
%e a(5) = 10010111 because 10010111 (base 2) = 151, 10010111 (base 3) = 2281, 10010111 (base 4) = 16661 and 10010111 (base 5) = 78781 are all prime and 10010111 is the smallest such string.
%t a[n_] := (While[b = FromDigits[ IntegerDigits[k, 2]]; Union[ PrimeQ[ Table[ FromDigits[ IntegerDigits[b], i], {i, 2, n}]]] != {True}, k++ ]; b); k = 1; Do[ Print[ a[n]], {n, 2, 10}]
%o (Python)
%o from sympy import isprime
%o def conv(s, b): return sum(b**k for k, bk in enumerate(s[::-1]) if bk=='1')
%o def ok(s, n): return all(isprime(conv(s, b)) for b in range(2, n+1))
%o def a(n):
%o if n < 4: return 2
%o k = 3
%o while not ok(bin(k)[2:], n): k += 2
%o return int(bin(k)[2:], 2)
%o print([a(n) for n in range(2, 9)]) # _Michael S. Branicky_, Oct 10 2021
%Y Cf. A086884.
%K nonn,base,more
%O 2,1
%A Richard FitzHugh (fitzhughrichard(AT)hotmail.com), Aug 22 2003
%E Edited by _Robert G. Wilson v_, Aug 24 2003
%E Two more terms added by _James G. Merickel_, Feb 15 2010
%E One more term added by _Andreas Höglund_, Oct 17 2022 (found by Jim Viebke)
|