Square of large numbers without any memory limit
...just a code written in #-Link-Snipped-#
setbatchlines -1 No = 1234567891234567891234567891234567891234567899 MsgBox % "Square of " . No . " is:`n" square(No) exitapp square(No) { No := "0" . No Q := R := StrLen(No) zeroes := StrLen(No) * 2 + 2 stringsplit, k, No index := 1 Loop, % StrLen(No) { Loop, % StrLen(No) { if ( append = "" ) append = 0 process := k%Q% * k%R% + append append = stringsplit, A, Process if ( A0 = 2 ) { digit := A2 Append := A1 } else { digit := A1 Append := } ;~ MsgBox % digit M%index% := digit M%index% digit = r-- } append_zeroes := index-1 loop, % append_zeroes app_zer .= 0 M%index% := M%index% . app_zer app_zer = loop, % zeroes - Strlen(M%index%) - 2 Zer .= 0 M%index% := Zer . M%index% ans .= M%index% "`n" StringSplit, new_line, M%index% StringSplit, ol_ne, old_line damm := new_line0 if ( old_line != "" ) { loop, % new_line0 { if ( append2 = "" ) append2 = 0 process2 := new_line%damm% + ol_ne%damm% + append2 append2 = stringsplit, A_A, Process2 if ( A_A0 = 2 ) { digit2 := A_A2 Append2 := A_A1 } else { digit2 := A_A1 Append2 := } damm-- final := digit2 final } append2 = digit2 = } if ( final = "" ) old_line := M%index% else old_line := final if ( A_index != StrLen(No) ) final = Process = Append := Q-- R := StrLen(No) index++ Zer := } StringSplit, the_end, m1 end := the_end%the_end0% final := RegExReplace(final, "(0)+(\d+)0", "$2") final := final . end return final }
Replies
-
zaveriSo what
-
smorgasbordjust ignore, right?
You are reading an archived discussion.
Related Posts
are there any oaching centres give me approprite ones with contact numbers please any one help
In the technology-driven world of India’s most populous city, one would have expected rickshaws to disappear with the faster growth of modern, motorized transport. Instead, the numbers of rickshaws have...
Theo De Raadt, founder of openBSD forked openSSL which contains heartbleed security bug. Theo with his openBSD team found that openSSL is not possible to repair. LibreSSL team already removed...
Steve Cutts has been using his creative skills to create some powerful visuals and animated videos. In his recent video titled 'MAN' he is trying to shade a perspective on...
Before we begin the debate on the topic, let me inform you that Estonia has already passed a law that allows Estonians to have Internet access as one of their...