A238334 Squares that do not contain a shorter substring that is a square.
0, 1, 4, 9, 25, 36, 576, 676, 5776, 27556, 33856, 538756, 586756, 665856, 682276, 763876, 767376, 853776, 872356, 2637376, 2775556, 2835856, 5635876, 6885376, 7376656, 22886656, 23755876, 23775376, 26275876, 26687556, 26873856, 32672656, 32878756, 37527876
Offset: 1
Links
- Giovanni Resta, Table of n, a(n) for n = 1..10000
- Michael S. Branicky, Python program
- Wikipedia, Substring
Crossrefs
Cf. A130448.
Programs
-
Mathematica
fQ[n_] := Module[{d = IntegerDigits[n], len, ds, sq}, len = Length[d]; ds = FromDigits /@ Flatten[Table[Partition[d, i, 1], {i, len - 1}], 1]; sq = Select[ds, IntegerQ[Sqrt[#]] &]; sq == {}]; Select[Range[0, 10000]^2, fQ]
-
Python
# see link for faster version for producing b-file from math import isqrt from itertools import count, islice def issquare(n): return isqrt(n)**2 == n def cond(s): if len(s) == 1: return True if any(d in s for d in "0149"): return False ss = (s[i:i+l] for i in range(len(s)) for l in range(2, len(s))) return not any(issquare(int(u)) for u in ss) def agen(): yield from (k**2 for k in count(0) if cond(str(k**2))) print(list(islice(agen(), 34))) # Michael S. Branicky, Feb 23 2023