login
a(n) = minimum pandigital prime in base n.
10

%I #28 Apr 04 2024 10:13:49

%S 2,11,283,3319,48761,863231,17119607,393474749,10123457689,

%T 290522736467,8989787252711,304978405943587,11177758345241723,

%U 442074237951168419,18528729602926047181,830471669159330267737,39482554816041508293677,1990006276023222816118943,105148064265927977839670339,5857193485931947477684595711

%N a(n) = minimum pandigital prime in base n.

%C a(n) is the smallest prime whose base-n representation contains all digits (i.e., 0,1,...,n-1) at least once.

%H Chai Wah Wu, <a href="/A185122/b185122.txt">Table of n, a(n) for n = 2..386</a> (terms 2..100 from Per H. Lundow)

%H Chai Wah Wu, <a href="https://arxiv.org/abs/2403.20304">Pandigital and penholodigital numbers</a>, arXiv:2403.20304 [math.GM], 2024. See p. 3.

%e The corresponding base-b representations are:

%e 2 10

%e 3 102

%e 4 10123

%e 5 101234

%e 6 1013425

%e 7 10223465

%e 8 101234567

%e 9 1012346785

%e 10 10123457689

%e 11 1022345689a7

%e 12 101234568a79b

%e 13 10123456789abc

%e 14 10123456789cdab

%e 15 10223456789adbce

%e ...

%o (Python)

%o from math import gcd

%o from itertools import count

%o from sympy import nextprime

%o from sympy.ntheory import digits

%o def A185122(n):

%o m = n

%o j = 0

%o if n > 3:

%o for j in range(1,n):

%o if gcd((n*(n-1)>>1)+j,n-1) == 1:

%o break

%o if j == 0:

%o for i in range(2,n):

%o m = n*m+i

%o elif j == 1:

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

%o m = n*m+i

%o else:

%o for i in range(2,1+j):

%o m = n*m+i

%o for i in range(j,n):

%o m = n*m+i

%o m -= 1

%o while True:

%o if len(set(digits(m:=nextprime(m),n)[1:]))==n:

%o return m # _Chai Wah Wu_, Mar 12 2024

%K nonn,base

%O 2,1

%A _Per H. Lundow_, Jan 16 2012