This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A340501 #43 Jan 13 2021 20:52:27 %S A340501 -1,-1,225,-1,38025,314721,3111696,61058596,1026753849,31529329225, %T A340501 892067027049,-1,803752551280900,29501156485626049, %U A340501 1163446635475467225,-1,2200667320658951859841,104753558229986901966129,5272187100814113874556176,-1,15588378150732414428650569369 %N A340501 Smallest square which when written in base b contains each digit exactly once, or -1 if no such square exists. %C A340501 Note that "pandigital" just means every digit appears at least once. The condition here is stronger. Maybe this should be called "Smallest strictly pandigital square in base b"? %C A340501 Does this sequence contain infinitely many positive terms? Equally, is A339693 infinite? %C A340501 It is shown in A258103 that a(n) = -1 for n = 2,3,5,13,17,21 and infinitely many other values. %H A340501 Chai Wah Wu, <a href="/A340501/b340501.txt">Table of n, a(n) for n = 2..29</a> %e A340501 base a(base) digits %e A340501 4 225 [3, 2, 0, 1] %e A340501 6 38025 [4, 5, 2, 0, 1, 3] %e A340501 7 314721 [2, 4, 5, 0, 3, 6, 1] %e A340501 8 3111696 [1, 3, 6, 7, 5, 4, 2, 0] %e A340501 9 61058596 [1, 3, 6, 8, 0, 2, 5, 7, 4] %e A340501 10 1026753849 [1, 0, 2, 6, 7, 5, 3, 8, 4, 9] %e A340501 11 31529329225 [1, 2, 4, 0, 10, 5, 3, 6, 7, 8, 9] %e A340501 12 892067027049 [1, 2, 4, 10, 7, 11, 5, 3, 8, 6, 0, 9] %e A340501 14 803752551280900 [1, 0, 2, 6, 9, 11, 8, 12, 5, 7, 13, 3, 10, 4] %o A340501 (Python) %o A340501 from sympy import integer_nthroot %o A340501 def digits(n, b): %o A340501 out = [] %o A340501 while n >= b: n, r = divmod(n, b); out.append(r) %o A340501 return [n] + out[::-1] %o A340501 def a(n): %o A340501 b, b2b = n, n**n %o A340501 r, a = integer_nthroot(b**(b-1), 2); s = r**2 %o A340501 while s < b**(b-1): s += 2*r + 1; r += 1 %o A340501 while s < b2b: %o A340501 if len(set(digits(s, b))) == n: return s %o A340501 s += 2*r + 1; r += 1 %o A340501 return -1 %o A340501 print([a(n) for n in range(2, 13)]) # _Michael S. Branicky_, Jan 13 2021 %Y A340501 Inspired by A258103, A260182, A339693. %Y A340501 Cf. A249034, A260191. %K A340501 sign,base %O A340501 2,3 %A A340501 _N. J. A. Sloane_, Jan 13 2021 %E A340501 a(10)-a(22) from _Hugo Pfoertner_ and _Alois P. Heinz_, Jan 13 2021