(In reply to
computer solution by Charlie)
I translated the program into Mintoris Basic as shown below and it took 2.523 seconds to run on a Samsung Galaxy S7. That's faster than UBASIC emulated in Windows under DOSBox but slower than UBASIC would be running natively, say in Windows XP.
t=time()
open 1,"wtsomtim.txt","w"
dim S$(5)
dim S0$(5)
S0$(1)="260723233115686*1931"
S0$(2)="43744839742282591947"
S0$(3)="1181326544136*5138222"
S0$(4)="186378732807587076747"
S0$(5)="519650114814905002347"
for A=0 to 9
for B=0 to 9
for I=1 to 5
S$(I)=S0$(I)
next
Ix1=instr(S$(1),"*",1)
mid$(S$(1),Ix1,1)=trim$(str$(A))
Ix1=instr(S$(3),"*",1)
mid$(S$(3),Ix1,1)=trim$(str$(B))
Good=1
for I=1 to 3
for J=I+1 to 4
for K=J+1 to 5
Tot$=bigAdd$(bigAdd$(S$(I),S$(J)),S$(K))
Sr$=bigFloor$(bigAdd$(bigSqrt$(Tot$),"0.5"))
if bigMult$(Sr$,Sr$)<>Tot$ then Good=0
next
next
next
if Good then
for I=1 to 3
for J=I+1 to 4
for K=J+1 to 5
Tot$=bigAdd$(bigAdd$(S$(I),S$(J)),S$(K))
Sr$=bigFloor$(bigAdd$(bigSqrt$(Tot$),"0.5"))
writeln 1,S$(I)
writeln 1,S$(J)
writeln 1,S$(K)
writeln 1,Tot$+" "+Sr$
next
next
next
writeln 1," "
endif
next B
next A
print str$((time()-t)/1000)
close 1
Again, manual formatting was done:
26072323311568661931
43744839742282591947
118132654413675138222
187949817467526392100 13709479110
26072323311568661931
43744839742282591947
186378732807587076747
256195895861438330625 16006120575
26072323311568661931
43744839742282591947
519650114814905002347
589467277868756256225 24278947215
26072323311568661931
118132654413675138222
186378732807587076747
330583710532830876900 18181961130
26072323311568661931
118132654413675138222
519650114814905002347
663855092540148802500 25765385550
26072323311568661931
186378732807587076747
519650114814905002347
732101170934060741025 27057368145
43744839742282591947
118132654413675138222
186378732807587076747
348256226963544806916 18661624446
43744839742282591947
118132654413675138222
519650114814905002347
681527608970862732516 26106083754
43744839742282591947
186378732807587076747
519650114814905002347
749773687364774671041 27381995679
118132654413675138222
186378732807587076747
519650114814905002347
824161502036167217316 28708213146
|
Posted by Charlie
on 2018-05-19 11:51:47 |