Smallest square that begins with n: Difference between revisions

m
m (→‎{{header|Phix}}: use pow10)
Line 1,783:
 
=={{header|Julia}}==
<syntaxhighlight lang="julia">function squaresstartinguptosmsq(n, verbose=true 49)
res, numfoundresults = zeros(Int, n), 0
p_intfound, square, delta = collect(0, 1:n), 3
while found < n
p_string = string.(p_int)
for i in 1:typemax(Int) k = square
sqwhile =k i> * i0
sq_s if k <= n && results[k] == string(sq)0
for (j, s) in enumerate(p_string) results[k] = square
if res[j] == 0 &&found length(sq_s) >+= length(s) && sq_s[1:length(s)] == s
res[j] = sq
numfound += 1
end
k res[j] ÷= sq10
end
ifsquare numfound =+= ndelta
delta += if verbose2
for p in enumerate(res)
print(rpad(p[2], 6), p[1] % 10 == 0 ? "\n" : "")
end
end
break
end
end
return resresults
end
 
foreach(p -> print(rpad(p[2], 6), p[1] % 10 == 0 ? "\n" : ""), enumerate(smsq()))
squaresstartingupto(49)
</syntaxhighlight>{{out}}
<pre>
4,108

edits