A359344
Largest pandigital square with n digits.
Original entry on oeis.org
9814072356, 99853472016, 998732401956, 9998490637521, 99992580137641, 999984024130576, 9999925800137641, 99999987340240516, 999999258000137641, 9999999562540763281, 99999992580000137641, 999999991102375684521, 9999999925800000137641, 99999999986188478340025
Offset: 10
-
a:=proc(n::posint) local s, k, K: if n<10 then s:=NULL: else for k from floor(sqrt(10^n)) to ceil(sqrt(10^(n-1))) by -1 do K:=convert(k^2,base,10); if nops({op(K)})=10 then s:=k^2: break: fi: od: fi: return s; end:
seq(a(n),n=10..30);
-
from math import isqrt
def c(n): return len(set(str(n))) == 10
def a(n):
ub, lb = isqrt(10**n-1), isqrt(10**(n-1)) if n&1 else isqrt(10**(n-1))+1
return next((k*k for k in range(ub, lb-1, -1) if c(k*k)), None)
print([a(n) for n in range(10, 24)]) # Michael S. Branicky, Dec 27 2022
A359346
Reversible pandigital square numbers.
Original entry on oeis.org
1234549876609, 9066789454321, 123452587690084, 123454387666009, 123454987660900, 123456987654400, 123458987664100, 123478988652100, 125688987432100, 146678985432100, 445678965432100, 480096785254321, 900666783454321, 906678945432100, 10223418547690084
Offset: 1
Sequence starts with 1111103^2 = 1234549876609 <~> 9066789454321 = 3011111^2, which is the smallest possible such number.
- Martin Renner, Table of n, a(n) for n = 1..458
- Allan Cunningham, Question 15789, The Educational Times, and Journal of the College of Preceptors 58 (1905), nr. 530 (June 1), p. 273; Solution 15789, Ibid., 59 (1906), nr. 537 (Jan. 1), p. 39.
-
isok(k) = if (issquare(k), my(d=digits(k)); (#Set(d) == 10) && issquare(fromdigits(Vecrev(d)));); \\ Michel Marcus, Dec 31 2022
-
from math import isqrt
from itertools import count, islice
def c(n): return len(set(s:=str(n)))==10 and isqrt(r:=int(s[::-1]))**2==r
def agen(): yield from (k*k for k in count(10**6) if c(k*k))
print(list(islice(agen(), 15))) # Michael S. Branicky, Dec 27 2022
A359341
Number of pandigital squares with n digits.
Original entry on oeis.org
0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 504, 4275, 29433, 179235, 955818, 4653802, 21034628, 89834238, 366490378, 1440743933, 5493453262
Offset: 1
a(n) = 0 for n < 10, since a number must have at least ten digits to contain all digits from 0 to 9 at least once.
a(10) = 87 since there are 87 ten-digit pandigital squares from 1026753849 to 9814072356 (cf. A036745) containing each digit from 0 to 9, here exactly once.
-
a:=proc(n::posint) local p,k,K: if n<10 then p:=0; else p:=0: for k from ceil(sqrt(10^(n-1))) to floor(sqrt(10^n)) do K:=convert(k^2,base,10); if nops({op(K)})=10 then p:=p+1: fi: od: fi: return p; end:
-
from math import isqrt
def c(n): return len(set(str(n))) == 10
def a(n):
lb = isqrt(10**(n-1)) if n&1 else isqrt(10**(n-1)) + 1
return sum(1 for k in range(lb, isqrt(10**n-1)+1) if c(k*k))
print([a(n) for n in range(1, 14)]) # Michael S. Branicky, Dec 27 2022
Comments