login
a(n) = smallest penholodigital prime in base n.
4

%I #22 Apr 04 2024 10:14:17

%S 3,5,103,823,10061,157427,2439991,49100173,1123465789,31148488997,

%T 816695154683,25401384476191,859466293047623,33373273595699879,

%U 1234907033823334111,51892599148660469993,2322058300483667372689,115713970660820468376569,5533344265927977839343539

%N a(n) = smallest penholodigital prime in base n.

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

%H Chai Wah Wu, <a href="/A371194/b371194.txt">Table of n, a(n) for n = 2..387</a>

%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.

%F a(n) >= A023811(n).

%e The corresponding base-n representations are:

%e n a(n) in base n

%e ------------------------

%e 2 11

%e 3 12

%e 4 1213

%e 5 11243

%e 6 114325

%e 7 1223654

%e 8 11235467

%e 9 112345687

%e 10 1123465789

%e 11 1223456789a

%e 12 11234567a98b

%e 13 112345678abc9

%e 14 112345678cadb9

%e 15 1223456789adcbe

%e 16 1123456789abcedf

%e 17 1123456789abdgfec

%e 18 1123456789abcehfgd

%e 19 1223456789abcdefghi

%e 20 1123456789abcdefhigj

%e 21 1123456789abcdefgihjk

%e 22 1123456789abcdefgjhikl

%e 23 1223456789abcdefghjimlk

%e 24 1123456789abcdefghkmijln

%e 25 1123456789abcdefghijklnom

%e 26 1123456789abcdefghijkmnpol

%e 27 1223456789abcdefghijklmqnop

%e 28 1123456789abcdefghijklmnqorp

%e 29 1123456789abcdefghijklmnrqspo

%e 30 1123456789abcdefghijklmnosqprt

%e 31 1223456789abcdefghijklmnoptusrq

%e 32 1123456789abcdefghijklmnopqrvust

%e 33 1123456789abcdefghijklmnopqsrtuvw

%e 34 1123456789abcdefghijklmnopqrstuxwv

%e 35 1223456789abcdefghijklmnopqrstuxwvy

%e 36 1123456789abcdefghijklmnopqrstuwzyxv

%o (Python)

%o from math import gcd

%o from sympy import nextprime

%o from sympy.ntheory import digits

%o def A371194(n):

%o m, j = 1, 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 s = digits(m:=nextprime(m),n)[1:]

%o if 0 not in s and len(set(s))==n-1:

%o return m

%Y Cf. A023811, A185122.

%K nonn

%O 2,1

%A _Chai Wah Wu_, Mar 14 2024