Skrip Posted April 16, 2008 Share Posted April 16, 2008 (edited) I made a program that calculates Fermat's last theorem.Unless AutoIt can calculate higher numbers, he seems to be correct.Only issue with this program is that it fails at calculation #442 due to a limition in AutoIt and/or Windows.His theorem is basically showing that in the Pythagorean theorem (A^2+B^2=C^2) that if the exponant is greater than two (2) then it will be incorrect.Check it out, and reply! EDIT: Writing Excel Export right now.expandcollapse popup#include <GUIConstants.au3> #include <GuiListView.au3> #include <ExcelCOM_UDF.au3> $continue = 0 $go = 1 $EXCEL = 1 #Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\Exp.kxf $Form1 = GUICreate("Exponential Generator", 1250, 447, 193, 125) $List1 = _GUICtrlListView_Create($Form1, "Exponant", 336, 8, 900, 432) $Input1 = GUICtrlCreateInput("3", 56, 32, 41, 21) $Label1 = GUICtrlCreateLabel("+", 104, 32, 10, 17) $Input2 = GUICtrlCreateInput("4", 120, 32, 41, 21) $Label2 = GUICtrlCreateLabel("=", 168, 32, 10, 17) $Input3 = GUICtrlCreateInput("5", 184, 32, 41, 21) $Label3 = GUICtrlCreateLabel("A^N + B^N = C^N", 64, 64, 155, 17) $Label4 = GUICtrlCreateLabel("Until Exponant Equals: ", 64, 88, 114, 17) $Input4 = GUICtrlCreateInput("", 184, 88, 73, 21) $Button1 = GUICtrlCreateButton("Begin Testing...", 120, 115, 150, 30) $Button2 = GUICtrlCreateButton("Export to Excel (Retests)", 120, 145, 200, 30) _GUICtrlListView_AddColumn($List1, "A", 150) _GUICtrlListView_AddColumn($List1, "B", 150) _GUICtrlListView_AddColumn($List1, "C", 150) _GUICtrlListView_AddColumn($List1, "Total (A+B)", 250) _GUICtrlListView_AddColumn($List1, "A+B>C?", 75) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE Exit Case $Msg = $Button1 $go = 1 $continue = 0 _CALC() Case $Msg = $Button2 ;~ $text = GUICtrlRead($List1) ;~ Run("Notepad.exe") ;~ Sleep(1000) ;~ ControlSetText("Untitled - Notepad", "", "Edit1", $text) _Excel_CALC() EndSelect WEnd Func _CALC() If GUICtrlRead($Input4) = "" Then _Error("Please fill in the end input. -1 for infinate.") If $go = 1 Then ControlDisable($Form1, "", $Button1) GUICtrlSetData($Button1, "Restart Program") $A = GUICtrlRead($Input1) $B = GUICtrlRead($Input2) $C = GUICtrlRead($Input3) Do $continue = $continue + 1 _GUICtrlListView_AddItem($List1, $continue) _GUICtrlListView_AddSubItem($List1, $continue-1, $A^$continue, 1) _GUICtrlListView_AddSubItem($List1, $continue-1, $B^$continue, 2) _GUICtrlListView_AddSubItem($List1, $continue-1, $C^$continue, 3) _GUICtrlListView_AddSubItem($List1, $continue-1, $A^$continue+$B^$continue, 4) ;=========>>>>ERROR CHECK THAT FAILS If $A^$continue+$B^$continue = "1.#INF" Then $go = 0 _GUICtrlListView_AddSubItem($List1, $continue-1, "ERROR_INF", 5) EndIf ;=========>>>NO MORE CHECKZORZ If $go = 1 Then If $A^$continue+$B^$continue >= $C^$continue Then _GUICtrlListView_AddSubItem($List1, $continue-1, "Yes", 5) Else _GUICtrlListView_AddSubItem($List1, $continue-1, "No", 5) EndIf EndIf $go = 1 Until $continue = GUICtrlRead($Input4) EndIf EndFunc Func _Excel_CALC() If GUICtrlRead($Input4) = "" Then _Error("Please fill in the end input. -1 for infinate.") $oExcel = _ExcelBookNew(1) ; Create new book in COM object, make it visible, overwrite if necessary _ExcelWriteCell($oExcel, "Exponant", "A1", "1") _ExcelWriteCell($oExcel, "A", "B1", "1") _ExcelWriteCell($oExcel, "B", "C1", "1") _ExcelWriteCell($oExcel, "C", "D1", "1") _ExcelWriteCell($oExcel, "Total", "E1", "1") _ExcelWriteCell($oExcel, "A+B=C?", "F1", "1") If $go = 1 Then ControlDisable($Form1, "", $Button1) GUICtrlSetData($Button1, "Restart Program") $A = GUICtrlRead($Input1) $B = GUICtrlRead($Input2) $C = GUICtrlRead($Input3) Do $continue = $continue + 1 _ExcelWriteCell($oExcel, $continue, "A" & $continue) _ExcelWriteCell($oExcel, $A^$continue, "B" & $continue) _ExcelWriteCell($oExcel, $B^$continue, "C" & $continue) _ExcelWriteCell($oExcel, $C^$continue, "D" & $continue) _ExcelWriteCell($oExcel, $A^$continue+$B^$continue, "E" & $continue) ;=========>>>>ERROR CHECK THAT FAILS ;~ If $A^$continue+$B^$continue = "1.#INF" Then ;~ $go = 0 ;~ _GUICtrlListView_AddSubItem($List1, $continue-1, "ERROR_INF", 5) ;~ EndIf ;=========>>>NO MORE CHECKZORZ ;~ If $go = 1 Then If $A^$continue+$B^$continue >= $C^$continue Then _ExcelWriteCell($oExcel, "YES", "F1", $continue) Else _ExcelWriteCell($oExcel, "NO", "F1", $continue) EndIf ;~ EndIf ;~ $go = 1 Until $continue = GUICtrlRead($Input4) EndIf EndFunc Func _Error($msgbo="") MsgBox(0, "", $msgbo) $go = 0 EndFunc Edited July 28, 2008 by Firestorm [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
weaponx Posted April 16, 2008 Share Posted April 16, 2008 Why don't you just write the code in Excel? Link to comment Share on other sites More sharing options...
Skrip Posted April 16, 2008 Author Share Posted April 16, 2008 I didn't think of it until it was already done. lol [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
-Ultima- Posted April 16, 2008 Share Posted April 16, 2008 (edited) Demonstrating by example doesn't prove a theorem like this... Despite all the examples you may show where a theorem works, all it takes is one counter-example for a theorem to fall apart and be considered false. Unless you can literally test every possible number (you can't, considering how the set of integers is infinitely large), then brute-force calculations won't do you any good, since you'll never know if a counter-example lies outside of the numbers you've tested (or the numbers you could possibly test). No amount of calculation power or increase in number limit would allow you to prove this to be true by brute-force. Edited April 16, 2008 by -Ultima- [ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ] Link to comment Share on other sites More sharing options...
Skrip Posted April 16, 2008 Author Share Posted April 16, 2008 (edited) Yeah. I realise that, but I believe that I've shown this to the extent of AutoIt. That's why I added the...'sorta' in the title. lol Edited April 16, 2008 by Firestorm [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
jvanegmond Posted April 16, 2008 Share Posted April 16, 2008 Your problem with AutoIt recognizing these large numbers as infinity is unsolvable without making modifications to the AutoIt interpreter, you may as well remove the request to "fix it". github.com/jvanegmond Link to comment Share on other sites More sharing options...
martin Posted April 16, 2008 Share Posted April 16, 2008 (edited) Your problem with AutoIt recognizing these large numbers as infinity is unsolvable without making modifications to the AutoIt interpreter,Actually, without making modifications to the way PC's are designed, and possibly the universe as well.BTW, congratulations on your prestigious No. #1 programmer award!. I imagine your thinking regarding the panel of judges was a bit like the one time head of FerrariFiat, who said that a board of directors worked best if there was an odd number of directors, and three was too many.I'm probably just old fashioned but I liked your "I'm a charging ma laser" avatar.EDIT:I had the wrong car. Edited April 19, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
jvanegmond Posted April 16, 2008 Share Posted April 16, 2008 I'm probably just old fashioned but I liked your "I'm a charging ma laser" avatar.Know what, I'll change it back just for you. Was it this image: ?? github.com/jvanegmond Link to comment Share on other sites More sharing options...
martin Posted April 17, 2008 Share Posted April 17, 2008 Know what, I'll change it back just for you. Was it this image: ??It was similar but I'm sure it wasn't that one, and I'm sure it said 'charging' not 'firing'. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
jvanegmond Posted April 17, 2008 Share Posted April 17, 2008 It was similar but I'm sure it wasn't that one, and I'm sure it said 'charging' not 'firing'.It's probably different then what I first had, but it's close. Right? github.com/jvanegmond Link to comment Share on other sites More sharing options...
martin Posted April 17, 2008 Share Posted April 17, 2008 It's probably different then what I first had, but it's close. Right?It's very close Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now