Determine all possible digits a for which
9...9a0...09 is a square number. (Excluding the digit a there are 101 9's and 100 0's in the number)
digits 220
for a=0:9
n=vpa(9);
for i=1:99
n=n*10+9;
end
n=n*10+a;
for i=1:101
n=n*10;
end
n=n+9;
sr=sqrt(n);
sq=round(sr)*round(sr);
disp(n)
disp(a)
disp(sr)
disp(sq-n)
fprintf('\n')
end
Each group below begins with the trial value of a on a line by itself. The resulting number itself then is on the next two lines, the line split immediately after the inserted digit. A blank line is placed next followed by the square root of that number. Only in the instance where a perfect square was found does this take up only one line. Finally, if the square root is rounded to an integer and the result squared, is shown the difference between the original number and the square of its rounded square root.
0
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009.0
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999994.
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999992
16.0
1
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009.0
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995.
49999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999994375
-99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999984.0
2
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999992
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009.0
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995.
999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999965
7.0
3
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999993
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009.0
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999996.
49999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998375
-99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999993.0
4
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999994
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009.0
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997.0
0.0
5
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009.0
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997.
50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001375
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995.0
6
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999996
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009.0
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998.
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000025
-5.0
7
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009.0
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998.
50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003375
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999992.0
8
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009.0
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004
-8.0
9
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009.0
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.
50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004375
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991.0
The only value of a that works is 4. The square root of its resulting number is
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997.
|
Posted by Charlie
on 2020-11-12 16:11:33 |