Cevap: 1389019170
C/C++:
#include <stdio.h>
int main() {
int i,j,L,T,digit[20];
long long int I;
for(i=1000000030;;) {
I=i;
I*=I;
L=0;
while(I) digit[L]=I%10,I/=10,L++;
T=0;
for(j=2;j<=18;j+=2)
if(digit[j]==10-j/2) T++;
if(T==9) {
printf("%d\n",i);
break;
}
if(i%100==30) i+=40;
else i+=60;
}
return 0;
}
Java:
public class Problem206 {
public static void main(String args[]) {
//1_2_3_4_5_6_7_8_9_0
long lb = 1020304050607080900L;
long ub = 1929394959697989990L;
lb = (long) Math.sqrt(lb);
ub = (long) Math.sqrt(ub);
for (long i = lb; i <= ub; i++) {
String s = Long.toString(i*i);
if(s.charAt(0) != '1') continue;
if(s.charAt(2) != '2') continue;
if(s.charAt(4) != '3') continue;
if(s.charAt(6) != '4') continue;
if(s.charAt(8) != '5') continue;
if(s.charAt(10) != '6') continue;
if(s.charAt(12) != '7') continue;
if(s.charAt(14) != '8') continue;
if(s.charAt(16) != '9') continue;
if(s.charAt(18) != '0') continue;
System.out.println("Found :" + i);
break;
}
}
}
Maple:
> cherche:=proc()
> local i,j,k,l,pastrouve,s,ch,r,li,n,base;
> i:=10^8 - 1;pastrouve:=true;
> while pastrouve do
> s:=0,0,9;ch:=8;
> k:=i;
> for j to 9 do
> r:=irem(k,10);k:=iquo(k,10);
> s:=s,r,ch;
> ch:=ch-1
> od;
> li:=[s];
> n:=0;base:=1;
> for l to nops(li) do
> n:=n+li[l]*base;
> base:=base*10
> od;
> if isqrt(n)^2=n then pastrouve:=false fi;
> i:=i-1;
> od;
> isqrt(n)
> end:
>
> t:=time():cherche();time()-t;
Pascal:
program bidon;
uses minimaple;
function isforme(n:QWORD):boolean;
var i:longint;
total:QWORD;
flag:boolean;
begin
flag:=false;
total:=0;
total:=n mod 10;
for i:=1 to 9 do
begin
n:=n div 100;
total:=total+(n mod 10)*exporapide(10,i);
end;
if total=1234567890 then flag:=true;
isforme:=flag;
end;
function rep:QWORD;
var i:QWORD;
flag:boolean;
begin
flag:=false;
i:=1010101000;
while (i<1389026623) and (flag=false) do
begin
if i mod 1000000=0 then writeln(i);
i:=i+10;
if isforme(i*i)=true then flag:=true;
end;
rep:=i;
end;
begin
writeln(rep);
end.
Mathematica:
Do[If[StringMatchQ[IntegerString[n^2],
"1" ~~ _ ~~ "2" ~~ _ ~~ "3" ~~ _ ~~ "4" ~~ _ ~~ "5" ~~ _ ~~
"6" ~~ _ ~~ "7" ~~ _ ~~ "8" ~~ _ ~~ "9"], Print[n]], {n,
100000007, 141421347, 10}]