# Python program for OEIS A053918 and A053919 # Michael S. Branicky, May 15 2021 from time import time time0 = time() # N.B. "digits" search is to 2*digits of squares of terms from itertools import product from sympy import integer_nthroot def auptodigs(maxdigits, verbose=False): A053918 = [] A053919 = [] nextkk = 1 for d in range(2, maxdigits*2+1): for p in product("235", repeat=d): kk = int("".join(p)) if kk < nextkk: continue k, ok = integer_nthroot(kk, 2) if ok: A053918.append(k) A053919.append(k*k) nextkk = (k+1)**2 if verbose and d%2 == 0: print("done to", d//2, "digits,", time()-time0) print(" ", A053918) print(" ", A053919) return A053918, A053919 print(auptodigs(10, verbose=True)) # ~~~~