A351426 a(n) is the smallest number that is (zeroless) pandigital in all bases 2 <= k <= n.
1, 5, 45, 198, 4820, 37923, 1021300, 6546092, 514236897, 3166978245, 543912789629, 26110433895907, 1064987485213631, 39225481587293096
Offset: 2
Examples
For n = 2, 1 is the smallest base-2 pandigital number. For n = 3, 5 is the smallest base-3 pandigital number (12) that is also base-2 pandigital (101). For n = 4, 45 is the smallest base-4 pandigital number (231) that is also base-3 pandigital (1200) and base-2 pandigital (101101).
Crossrefs
Cf. A055085.
Programs
-
PARI
isok(i, n) = {for (b = 2, n, if (Set(digits(i, b))[1] && #Set(digits(i, b)) != b - 1, return (0)); if (Set(digits(i, b))[1] == 0 && #Set(digits(i, b)) != b, return(0)); ); return (1)} a(n) = {i = n^(n-2); while (! isok(i, n), i++); i; }
-
Python
from itertools import count, product from sympy.utilities.iterables import multiset_permutations from gmpy2 import digits, mpz def A351426(n): # assumes n <= 62 if n == 2: return 1 dlist = tuple(digits(d,n) for d in range(n)) for l in count(n-2): for d in range(1,n): c = None for t in product(dlist,repeat=l-n+2): for u in multiset_permutations(sorted(t+dlist[1:d]+dlist[d+1:])): m = mpz(''.join((dlist[d],)+tuple(u)),n) for b in range(n-1,1,-1): if len(set(digits(m,b))|{'0'}) < b: break else: if c != None: c = min(m,c) else: c = m if c != None: return int(c) # Chai Wah Wu, Mar 14 2022
Extensions
a(14) corrected by Fernando Solanet Mayou, Apr 08 2022
a(15) from Fernando Solanet Mayou, Jun 28 2022
Comments