Κυριακή 22 Μαρτίου 2026

Compute e - 4000digits

 You can insert a line : Locale 1033 so the decimal point character change to dot ".". The decimal point character return using the Locale$(14). You can see all the values of locale using a loop from 0 to 255 and printing to console using a Print i, ": "+locale$(i) to get all the strings specific to locale value. Locale 1032 is for Greek language, so we get comma "," for decimal point character.



Module FindE {
Function comp_e (n, decimals ){
unit=n:n/=decimals:For i=decimals-1 to 1:n=Unit+n/i:Next i:=n
}
p=4000
k=comp_e(biginteger("1"+string$("0", p)), p)
string t1=str$(k), t=left$(t1, 39)
if len(t1)>39 then
for i=40 to len(t1) step 40
t+={
}+mid$(t1, i, 40)
next
end if
all=(comp_e(1@, 28))+" Decimal"+{
}+(comp_e(1, 19))+" Double"+{
}+(comp_e(1~, 11))+" Float"+{
}+(comp_e(1#, 8))+" Currency"+{
}+ left$(t,1)+locale$(14)+mid$(t,2) +" Arbitrary-precision :"+p
Clipboard all
Report all
}
FindE


2,7182818284590452353602874712 Decimal
2,71828182845905 Double
2,718282 Float
2,7181 Currency
2,71828182845904523536028747135266249775
7247093699959574966967627724076630353547
5945713821785251664274274663919320030599
2181741359662904357290033429526059563073
8132328627943490763233829880753195251019
0115738341879307021540891499348841675092
4476146066808226480016847741185374234544
2437107539077744992069551702761838606261
3313845830007520449338265602976067371132
0070932870912744374704723069697720931014
1692836819025515108657463772111252389784
4250569536967707854499699679468644549059
8793163688923009879312773617821542499922
9576351482208269895193668033182528869398
4964651058209392398294887933203625094431
1730123819706841614039701983767932068328
2376464804295311802328782509819455815301
7567173613320698112509961818815930416903
5159888851934580727386673858942287922849
9892086805825749279610484198444363463244
9684875602336248270419786232090021609902
3530436994184914631409343173814364054625
3152096183690888707016768396424378140592
7145635490613031072085103837505101157477
0417189861068739696552126715468895703503
5402123407849819334321068170121005627880
2351930332247450158539047304199577770935
0366041699732972508868769664035557071622
6844716256079882651787134195124665201030
5921236677194325278675398558944896970964
0975459185695638023637016211204774272283
6489613422516445078182442352948636372141
7402388934412479635743702637552944483379
9801612549227850925778256209262264832627
7933386566481627725164019105900491644998
2893150566047258027786318641551956532442
5869829469593080191529872117255634754639
6447910145904090586298496791287406870504
8958586717479854667757573205681288459205
4133405392200011378630094556068816674001
6984205580403363795376452030402432256613
5278369511778838638744396625322498506549
9588623428189970773327617178392803494650
1434558897071942586398772754710962953741
5211151368350627526023264847287039207643
1005958411661205452970302364725492966693
8115137322753645098889031360205724817658
5118063036442812314965507047510254465011
7272115551948668508003685322818315219600
3735625279449515828418829478761085263981
3955990067376482922443752871846245780361
9298197139914756448826260390338144182326
2515097482798777996437308997038886778227
1383605772978824125611907176639465070633
0452795466185509666618566470971134447401
6070462621568071748187784437143698821855
9670959102596862002353718588748569652200
0503117343920732113908032936344797273559
5527734907178379342163701205005451326383
5440001863239914907054797780566978533580
4896690629511943247309958765523681285904
1383241160722602998330535370876138939639
1779574540161372236187893652605381558415
8718692553860616477983402543512843961294
6035291332594279490433729908573158029095
8631382683291477116396337092400316894586
3606064584592512699465572483918656420975
2685082307544254599376917041977780085362
7309417101634349076964237222943523661255
7250881477922315197477806056967253801718
0776360346245927877846585065605078084421
1529697521890874019660906651803516501792
5046195013665854366327125496399085491442
0001457476081930221206602433009641270489
4390397177195180699086998606636583232278
7093765022601492910115171776359446020232
4930028040186772391028809786660565118326
0043688508817157238669842242201024950551
8816948032210025154264946398128736776589
2768816359831247788652014117411091360116
4995076629077943646005851941998560162647
9076153210387275571269925182756879893027
6176114616254935649590379804583818232336
8612016243736569846703785853305275833337
9399075216606923805336988795651372855938
8349989470741618155012539706464817194670
8348197214488898790676503795903669672494
9925452790337296361626589760394985767413
9735944102374432970935547798262961459144
2936451428617158587339746791897571211956
1873857836447584484235555810500256114923
9151889309946342841393608038309166281881
1503715284967059741625628236092168075150
1777253874025642534708790891372917228286
1151591568372524163077225440633787593105
9826760944203261924285317018781772960235
4130606721360460003896610936470951414171
8577701418060644363681546444005331608778
3143174440811949422975599314011888683314
8328027065538330046932901157441475631399
97 Arbitrary-precision :4000



Κυριακή 15 Μαρτίου 2026

Example of an http Server (localhost)

 Use 127.0.0.1/5080 to use it!


Press Click me:


Go back and write my name George Karras to search frame:


Press enter:


You can choose to not use the favicon, the icon - it is a png file loaded from popup menu - scroll it down - and converted to base64, so the Binary {} as name1 make a buffer name1 with actrual bytes, so name1(0) is the real adderss of data and len(name1) is the lenght of bytes, which we have to send to client using the send method of socket.

There is a limit of 100 concurrent sockets (way too much). Change to 1 to see what happen. Normally Chrome open and close the connection quick but if we open firefox we can open two pages (not connected to socket) and we can push reload to each quick to get the fault "503 Service Unavailable".

So there are max 100 sockets which we can keep open. Each time one close we push the id to a stack, so each time we want a "free" socket first we see if stack isn't empty and pop from there or we get from the top index to array.

As you see, M2000 Interpreter create 100 sockets wich never get out from array, and if we use it in the  OnAccept event of Serversck (Server socket which listen), we assign the outer call to server which the one on array. When the one of them get an event, this event has the first parameter the id. How this happen? Although the M2000 written using VB 6, which can't use array of objects (only array of controls can be used with the index property), they utilize a dynamic way to make events objects so not only can be used to make an array of objects with events, but also we can resize it (not shown here), to make more objects for the user.


About events.

When an event fired from an object search for a function with the name of the object, the underscore and the name of the event. If not find it place it in an exclude list, to skip more calls. When the event fire, we get a call to service function. So that call can send parameters (but for arrays send the index of the object). Also some parameters maybe passed by reference (always send the same way for same event). We can use the Stack statement which show the stack without use it to get the values. All variables which passed by reference have a string in stack. That string used by the Read statement with a & symbol before the new name which will be the reference. The string has the absolute name of a variable which M2000 make for the specific event. So we get a reference, and we can change the value and at the end of the call, M2000 provide this value to the actual caller, which wait to get the value. So events which need to get values back (by reference) have to service them quick. This example has no use of by reference parameters through events.

Calling the function for event we have a new stack (with anything the event send) and the code executed in the name space when the object created, so the same name space for the function which we use, and this is the module which we define the objects. Anything we make new (or local using Local, or global using Global) in the event service function erased at the return. Because some other events may fired before the current terminate we always use the new for read (read new) and as you see everywhere. So if another event run, interrupts the current thread, execute the code, shadowing the same named variables, then return erasing all the new variables, and the older event continue to execute, with no problem. If we want to call a sub it is better to use a module and use the Call Local which is the "cascade" call from an event service function. The call local has the same stack as one from the caller and the same namespace as the one of the caller, and finally at the exit delete everything new - so we can also make local variables.

Αν δεν υπάρχουν δυο μόνιτορ τότε το παρακάτω μικρό πρόγραμμα φτιάχνει ένα μικρότερο παράθυρο, στο οποίο θα εμφανιστεί το κύριο πρόγραμμα (το οποίο απλά δείχνει την κατάσταση του server)

window 12, 12000, 8000
a=(pos.x, pos.y)
a+=1000
(x,y)=a
motion.w  x, y


Το πρόγραμμα (τερματίζει με το πλήκτρο Esc). Για να το χρησιμοποιήσουμε ακολουθούμε τις οδηγίες στις εικόνες παραπάνω!

Module Server1 {
binary {
            iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACWklEQVR4AZRT3UtT
            YRj/vYcxWLhd5LQb1xY00i6aUwfhVLof1U1RhC6vRPpYV5G4VqcivLCvgeCfYFNk
            fUAX3djHpdsomJs5dqYQRRcmtBuX67w9zzt2AgvC8T7v+/y+nr2cs2nY9Vn+uHok
            UzSSVMVMoVxTVTSKhJOs7bLDGqDrupYtlnXYbHlIGaPqJLNdlZSdhGOssYe9xKtl
            DYicjc5KidtCCJtS/rGxxp7IuehsU1YDlgvGiBByrEn+7xRSjuUowz5taUnaBOR9
            BnspkzKc1VoOGCdM0/ToiUnELo1jITWHn7XaX7NqxM0/nVMePREHZzirCYFQvV5H
            xTCwtfUdL56lcffOLVSrVWsI9/f0BF4+TytPxSiDM5zVBMR+u92OQLDHCmxUKphJ
            PqYHL1XNPHmEjfV1Sw/29IIznNXI8pWVkegoWlqc3KoqrOTxIZdFLptBobCiON6c
            TheGL45yC85q2NFeEZJt7e2YiCfQ2uom2Fil0hpKa58agHbWbsRvwu1uI0R5ymp9
            xw6tSiDNjNfnw9T0A5y/MIzwwBD6BwYRHhxCmE7mpqYfwuv1sRWc4az6HfzaMa/R
            dTZZcTj2IXLyFMYvX0FHhwcez0HqryrO4XCwhcJykzMM1IDjAf9nCHmGiG0qtd6/
            ewujXIZBT5x7RTa2bfaqDGE1gE6EuvxvIMzTdDX1/pxOJxYXUlicT8HlcrGFvhlV
            9iivYvDnz8S4r8v/GpD9Aih002u9PjEJrkB3EMyx1vCwu1HWDRoQCB09nP/xTeuV
            0oxT4AsX98yx1vQ1z98AAAD//zbMFRIAAAAGSURBVAMA8iAJqkWBAh0AAAAASUVO
            RK5CYII=
} as favicon
locale 1033
form 100, 50
Flush
Escape Off
declare withevents Serversck SOCKET
Method Serversck, "create", SocketPort:=5080, SocketAddress:="localhost" as Ok
? ok
Method Serversck, "Listen" as ok
? ok
String sAddr
Long lPort
Method Serversck, "GetSockName", &sAddr, &lPort as ok
If Ok Then
? sAddr
? lPort
end if
Function Serversck_OnError {
stack
}
max_connections=100
connections=0
declare withevents c(max_connections) Socket
ret=stack
long id=0
Boolean Use_Favicon = true
Function Serversck_OnAccept {
local ok as boolean
if len(ret)>0 then
stack ret {
read new id
}
method Serversck, "Accept", c(id) as ok
if ok then print "New User "+id:connections++
else.if id<max_connections then
method Serversck, "Accept", c(id) as ok
If ok then
print "New User "+id
id++
connections++
end if
else
declare local c socket
method Serversck, "Accept", c as ok
if ok then
resp$={HTTP/1.1 503 Service Unavailable
Retry-After: 3600
Content-Type: text/html
Content-Length: #
Connection: keep-alive

}
txt$={<html>
<head><title>503 Service Unavailable</title></head>
<body>
<h1>Service Unavailable</h1>
<p>The server is currently unable to handle the request due to a temporary overload.</p>
</body>
</html>
}
resp$=replace$( "#", str$(Len(string$(txt$ as UTF8enc))*2,""), resp$)+{
}+txt$
// print #-2, resp$
method c, "SendText", resp$ as new ok
? ok
method c,"close_"
end if
end if

}
// modules called from event service fucntions
module alfa (new s$) {
local txt$={<html>
<head><title>Bravo @</title>
<style>div {text-align: center;}</style>
</head>
<body>
<h1>Renspose to @</h1>
<p>bla bla bla</p>
<div><button type="button"  onclick="location.href='/'">Go Back</button></div>
</body>
</html>
}
txt$=replace$( "@", s$, txt$)
resp$=replace$( "#", str$(Len(string$(txt$ as UTF8enc))*2,""), resp$)+{
}+txt$
method c(id), "Sendtext", resp$ as new ok
? ">>>>>>>>>>>>> ok"
}
module mainpage {
local txt$={<!DOCTYPE html>
<html>
<body>
<head>
<title>M2000 Html Server1</title>
<style>
div {text-align: center;}
</style>
</head>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
<p>Ελληνικά γράμματα</p>
<search>
<form>
<input name="something" id="something" placeholder="Search Server1">
</form>
</search>
<div>
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
Sorry, your browser does not support inline SVG.
</svg>
</div>
<div><button type="button"  onclick="location.href='/alfa.html'">Click Me!</button></div>
###
</body>
</html>
}
txt$=replace$("###",date$(today, "long Date")+", "+time$(now,"Long Time"), txt$)
local resp$={HTTP/1.1 200 OK
Cache-Control: no-store
Content-Type: text/html; charset=UTF-8
Content-Length: #
Connection: keep-alive

}
resp$=replace$( "#", str$(Len(string$(txt$ as UTF8enc))*2,""), resp$)+{
}+txt$
//print #-2, resp$
method c(id), "SendText", resp$ as new ok
? ok
}
function c_OnReceive (new id){
Print "OnReceive "+id
method c(id), "ReceiveText"  as new txt$
Print #-2, txt$
if left$(txt$, 14) = "GET / HTTP/1.1" then
call local mainpage
else.if Ucase$(left$(txt$, 16)) = "GET /?SOMETHING=" then
local search$=string$(filter$(leftpart$(mid$(txt$, 17), " "), "@") as URLdec +)
local resp$={HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: #
Location: http://127.0.0.1:5080/alfa.html

}
call local alfa, search$
else.if UCASE$(left$(txt$, 15)) = "GET /ALFA.HTML " then
local resp$={HTTP/1.1 200 OK
Cache-Control: no-store
Content-Type: text/html; charset=UTF-8
Content-Length: #
Connection: keep-alive

}
call local alfa, "You"
else.if UCASE$(left$(txt$, 25)) = "GET /FAVICON.ICO HTTP/1.1" then
if Use_Favicon then
Print "Favicon..."
local resp$={HTTP/1.1 201 OK
Content-Type: image/png
Content-Length: #
Cache-Control: public, max-age=31536000

}
resp$=replace$( "#", str$(Len( favicon),""), resp$)
method c(id), "Sendtext", resp$ as new ok
method c(id), "Send", favicon(0), len(favicon) as new total_send
? total_send, Len(favicon)
? "connections = ";connections
else
local resp$={
HTTP/1.1 204 No Content
Cache-Control: public, max-age=31536000

}
method c(id), "Sendtext", resp$ as new ok
end if
end if
}
function c_OnClose(new id) {
method c(id), "Close_"
stack ret {push id}
Print "close "+id
connections--
Print "opened connections: ";connections
Print Ret
refresh
}
function c_OnError(new id, erNum, mask) {
Print "Error "+id
Hex erNum
method c(id), "GetErrorDescription",erNum as new ret$
Print "Description: "; ret$
Print "Mask "+mask
}
do
if keypress(27) then exit
refresh
wait 100
always
declare Serversck nothing
Escape on
}
Server1

Σάββατο 14 Μαρτίου 2026

Pi Day Bonus Program

 From http://www.pi314.net/eng/goutte.php 

We use this function (it is 3 times faster than the one we use there https://georgekarras.blogspot.com/2018/07/18-93-pi.html


The program has an object to redirect output to screen and to a file together. My laptop has a Celeron 11th generation and M2000 run in one thread. 



This is the Output.txt file:

                              Compute 4 Pi digits

        Pi=3.1415


                              Compute 28 Pi digits

        Pi=3.14159 26535 89793 23846 26433 832

                Decimal type pi = 3.1415926535897932384626433832


                             Compute 150 Pi digits

        Pi=3.14159 26535 89793 23846 26433 83279 50288 41971 69399 37510

             58209 74944 59230 78164 06286 20899 86280 34825 34211 70679

             82148 08651 32823 06647 09384 46095 50582 23172 53594 08128

             

                       Time to compute 150 digits:9.96sec


                             Compute 500 Pi digits

        Pi=3.14159 26535 89793 23846 26433 83279 50288 41971 69399 37510

             58209 74944 59230 78164 06286 20899 86280 34825 34211 70679

             82148 08651 32823 06647 09384 46095 50582 23172 53594 08128

             48111 74502 84102 70193 85211 05559 64462 29489 54930 38196

             44288 10975 66593 34461 28475 64823 37867 83165 27120 19091

             45648 56692 34603 48610 45432 66482 13393 60726 02491 41273

             72458 70066 06315 58817 48815 20920 96282 92540 91715 36436

             78925 90360 01133 05305 48820 46652 13841 46951 94151 16094

             33057 27036 57595 91953 09218 61173 81932 61179 31051 18548

             07446 23799 62749 56735 18857 52724 89122 79381 83011 94912

             

                      Time to compute 500 digits:106.14sec


You can change Decimal with BigInteger (arbitrary-precision integer). Because on revision 7 Number not fixed to return BigInteger from stack, you have to add a function 

This statement

F.Out (Number+1) mod 10

Change to these two statements

read pp

F.Out (pp+1) mod 10

Or wait to upload the revision 8 of version 14.



Form 80, 32
Module Checkpi {
Locale 1033
' locale$(14) is dot "." for Locale 1033
Module FindPi (D as integer, f as Group){
Long k, q, n
d++
n=Int(d/0.9)
PlusOne=Lambda a=0, b=-1 -> {=a*b:a++:b+=2} ' first would change to zero
PlusTwo=Lambda a=1, b=2 -> {=a*b*3:a+=3:b+=3}
Init=Lambda a=3 -> {=a:a+=5}
Dim A(n) as Decimal<<PlusOne(), B(n) as Decimal<<PlusTwo(), mul10() as Decimal
Dim Ten(n) as Decimal, CarrierOver(n) as Decimal, Sum(n) as Decimal, Remainder(n) as Decimal<<Init()
OutPutDigits=D
Predigits=Stack
F.Lmargin 8
F.OutStr "Pi="
While D
CarrierOver=0
For k=n-1 to 1
Ten(k)=Remainder(k)*10
CarrierOver(k)=CarrierOver
Sum(k)=Ten(k)+CarrierOver(k)
q=Sum(k) div B(k)
Remainder(k)=Sum(k)-B(k)*q
CarrierOver=A(k)*q
Next

Ten(0)=Remainder(0)*10
CarrierOver(0)=CarrierOver
Sum(0)=Ten(0)+CarrierOver(0)
q=Sum(0) div 10
Remainder(0)=Sum(0)-10*q
if q<>9 and q<>10 then
Stack Predigits {
While not empty
F.out
if D>0 then D--
If D=0 then flush ' empty stack
End While
Push q
}
Else.if q=9 Then
Stack Predigits { Data q }
Else
Stack Predigits {
While not empty
F.Out (Number+1) mod 10
if D>0 then D--
If D=0 then flush ' empty stack
End While
Push 0
}
End if
End While
}
Class HandleOutput {
boolean fl=true
long f, Chars, p, w=80
Module LMargin {
.p<=number
if .p<pos then print : ? #.f
}
Module OutStr (s as string){
if .p>0 and pos<.p then a=string$(" ", pos-.p): ?#.f, a;: ? a;
? #.f,s;:? s;
}
Module OutTitle (a as string){
if pos>0 then .p<=0: .Cr
if len(a)>78 then a=" "+left$(a, 78) else a=string$(" ", (80-len(a)) div 2)+a
? #.f,a:? a
}
Module Cr {
string a=string$(" ", .p)
? #.f: ?#.f,a;
? : ? a;
}
Module Out (x) {
? #.f, x;:? x;
.Chars++
If .fl then
? #.f, Locale$(14); : ? Locale$(14); : .fl<=false : .Chars<=0
.p<=pos: exit
Else.If .Chars=50 then
.Cr : .Chars<=0:refresh
Else.if .Chars mod 5%=0 then
? #.f, " ";:? " ";:refresh
End if
}
class:
module HandleOutput (.f) {
}
}
set fast !
open "output.txt" for wide output as #file
F=HandleOutput(file)
F.OutTitle "Compute 4 Pi digits"
FindPi 4, F
F.Lmargin 0
F.Cr
F.OutTitle "Compute 28 Pi digits"
FindPi 28, F
F.Lmargin 0
F.OutTitle "Decimal type pi = "+pi
F.Cr
L=(150, 500)
M=each(L)
While M
         n=Array(M)
          F.OutTitle "Compute "+(n)+" Pi digits"
         profiler
         FindPi n, F
         t=timecount
         string r=(Round(t/1000,2))+"sec"
         F.Lmargin 0
         F.OutTitle "Time to compute "+n+" digits:"+r
         F.Cr
End While
close #file
win "notepad", dir$+"output.txt"
Set fast
}
Flush
CheckPi


Πέμπτη 12 Μαρτίου 2026

Integer Square Root (Addition: BigInteger)

Update: https://rosettacode.org/wiki/Isqrt_(integer_square_root)_of_X#M2000_Interpreter


Check function IntSqrt using BigInteger at the the last part of module integer_square_root

module integer_square_root (f=-2) {
Locale 1033
function comma$(a) {
string z, f, p
const c$=locale$(15)
if type$(a)="BigInteger" then z=str$(a) else z=a
long m=len(z)
z=strrev$(z)
for i=1 to len(z) step 3
p=mid$(z,i, 3)
f+=p+if$(m-i>=3->c$,"")
next
=strrev$(f)
}
function IntSqrt(x as long long) {
long long q=1, z=x, t, r
do q*=4&& : until (q>x)
while q>1&&
q|div 4&&:t=z-r-q:r|div 2&&
if t>-1&& then z=t:r+= q
end while
=r
}
long i
print #f, "The integer square root of integers from 0 to 65 are:"
for i=0 to 65
print #f, IntSqrt(i)+" ";
next
print #f
print #f, "Using Long Long Type"
print #f, "The integer square roots of powers of 7 from 7^1 up to 7^21 are:"
for i=1 to 21 step 2 {
print #f, "IntSqrt(7^"+i+")="+comma$(IntSqrt(7&&^i))+" of 7^"+i+" ("+comma$(7&&^I)+")"
}
print #f
function IntSqrt(x as decimal) {
decimal q=1, z=x, t, r
do q*=4 : until (q>x)
while q>1
q/=4:t=z-r-q:r/=2
if t>-1 then z=t:r+= q
end while
=r
}
print #f, "Using Decimal Type"
print #f, "The integer square roots of powers of 7 from 7^23 up to 7^33 are:"
decimal j,p
for i=23 to 33 step 2 {
p=1:for j=1 to i:p*=7@:next
print #f, "IntSqrt(7^"+i+")="+comma$(IntSqrt(p))+" of 7^"+i+" ("+comma$(p)+")"
}
print #f


function IntSqrt(x as double) {
double q=1, z=x, t, r
do q*=4 : until (q>x)
while q>1
q/=4:t=z-r-q:r/=2
if t>-1 then z=t:r+= q
end while
=r
}
print #f, "Using Double Type"
print #f, "The integer square roots of powers of 7 from 7^19 up to 7^35 are:"
for i=19 to 35 step 2 {
print #f, "IntSqrt(7^"+i+")="+comma$(IntSqrt(7^i))+" of 7^"+i+" ("+(7^i)+")"
}
print #f
print #f, "Using BigInteger Type"

function IntSqrt(x as BigInteger) {
BigInteger q=1, z=x, t, r
do q*=4 : until (q>x)
while q>1
q|div 4:t=z-r-q:r|div 2
if t>-1 then z=t:r+= q
end while
=r
}
BigInteger Z=7
z=modpow(7u, 19u, BigInteger("1"+String$("0", 100)))
print #f, "The integer square roots of powers of 7 from 7^19 up to 7^35 are:"
for i=19 to 73 step 2 {
print #f, "IntSqrt(7^"+i+")="+comma$(IntSqrt(Z))+" of 7^"+i+" ("+comma$(Z)+")"
Z*=7*7
}
print #f

}
open "" for output as #f // f = -2 now, direct output to screen
integer_square_root
close #f
open "out.txt" for output as #f
integer_square_root f
close #f
win "notepad", dir$+"out.txt"


Output:

The integer square root of integers from 0 to 65 are:

0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 

Using Long Long Type

The integer square roots of powers of 7 from 7^1 up to 7^21 are:

IntSqrt(7^1)=2 of 7^1 (7)

IntSqrt(7^3)=18 of 7^3 (343)

IntSqrt(7^5)=129 of 7^5 (16,807)

IntSqrt(7^7)=907 of 7^7 (823,543)

IntSqrt(7^9)=6,352 of 7^9 (40,353,607)

IntSqrt(7^11)=44,467 of 7^11 (1,977,326,743)

IntSqrt(7^13)=311,269 of 7^13 (96,889,010,407)

IntSqrt(7^15)=2,178,889 of 7^15 (4,747,561,509,943)

IntSqrt(7^17)=15,252,229 of 7^17 (232,630,513,987,207)

IntSqrt(7^19)=106,765,608 of 7^19 (11,398,895,185,373,143)

IntSqrt(7^21)=747,359,260 of 7^21 (558,545,864,083,284,007)


Using Decimal Type

The integer square roots of powers of 7 from 7^23 up to 7^33 are:

IntSqrt(7^23)=5,231,514,822 of 7^23 (27,368,747,340,080,916,343)

IntSqrt(7^25)=36,620,603,758 of 7^25 (1,341,068,619,663,964,900,807)

IntSqrt(7^27)=256,344,226,312 of 7^27 (65,712,362,363,534,280,139,543)

IntSqrt(7^29)=1,794,409,584,184 of 7^29 (3,219,905,755,813,179,726,837,607)

IntSqrt(7^31)=12,560,867,089,291 of 7^31 (157,775,382,034,845,806,615,042,743)

IntSqrt(7^33)=87,926,069,625,040 of 7^33 (7,730,993,719,707,444,524,137,094,407)


Using Double Type

The integer square roots of powers of 7 from 7^19 up to 7^35 are:

IntSqrt(7^19)=106,765,608 of 7^19 (1.13988951853731E+16)

IntSqrt(7^21)=747,359,260 of 7^21 (5.58545864083284E+17)

IntSqrt(7^23)=5,231,514,822 of 7^23 (2.73687473400809E+19)

IntSqrt(7^25)=36,620,603,758 of 7^25 (1.34106861966396E+21)

IntSqrt(7^27)=256,344,226,312 of 7^27 (6.57123623635343E+22)

IntSqrt(7^29)=1,794,409,584,184 of 7^29 (3.21990575581318E+24)

IntSqrt(7^31)=12,560,867,089,291 of 7^31 (1.57775382034846E+26)

IntSqrt(7^33)=87,926,069,625,040 of 7^33 (7.73099371970744E+27)

IntSqrt(7^35)=615,482,487,375,282 of 7^35 (3.78818692265665E+29)


Using BigInteger Type

The integer square roots of powers of 7 from 7^19 up to 7^35 are:

IntSqrt(7^19)=106,765,608 of 7^19 (11,398,895,185,373,143)

IntSqrt(7^21)=747,359,260 of 7^21 (558,545,864,083,284,007)

IntSqrt(7^23)=5,231,514,822 of 7^23 (27,368,747,340,080,916,343)

IntSqrt(7^25)=36,620,603,758 of 7^25 (1,341,068,619,663,964,900,807)

IntSqrt(7^27)=256,344,226,312 of 7^27 (65,712,362,363,534,280,139,543)

IntSqrt(7^29)=1,794,409,584,184 of 7^29 (3,219,905,755,813,179,726,837,607)

IntSqrt(7^31)=12,560,867,089,291 of 7^31 (157,775,382,034,845,806,615,042,743)

IntSqrt(7^33)=87,926,069,625,040 of 7^33 (7,730,993,719,707,444,524,137,094,407)

IntSqrt(7^35)=615,482,487,375,282 of 7^35 (378,818,692,265,664,781,682,717,625,943)

IntSqrt(7^37)=4,308,377,411,626,977 of 7^37 (18,562,115,921,017,574,302,453,163,671,207)

IntSqrt(7^39)=30,158,641,881,388,842 of 7^39 (909,543,680,129,861,140,820,205,019,889,143)

IntSqrt(7^41)=211,110,493,169,721,897 of 7^41 (44,567,640,326,363,195,900,190,045,974,568,007)

IntSqrt(7^43)=1,477,773,452,188,053,281 of 7^43 (2,183,814,375,991,796,599,109,312,252,753,832,343)

IntSqrt(7^45)=10,344,414,165,316,372,973 of 7^45 (107,006,904,423,598,033,356,356,300,384,937,784,807)

IntSqrt(7^47)=72,410,899,157,214,610,812 of 7^47 (5,243,338,316,756,303,634,461,458,718,861,951,455,543)

IntSqrt(7^49)=506,876,294,100,502,275,687 of 7^49 (256,923,577,521,058,878,088,611,477,224,235,621,321,607)

IntSqrt(7^51)=3,548,134,058,703,515,929,815 of 7^51 (12,589,255,298,531,885,026,341,962,383,987,545,444,758,743)

IntSqrt(7^53)=24,836,938,410,924,611,508,707 of 7^53 (616,873,509,628,062,366,290,756,156,815,389,726,793,178,407)

IntSqrt(7^55)=173,858,568,876,472,280,560,953 of 7^55 (30,226,801,971,775,055,948,247,051,683,954,096,612,865,741,943)

IntSqrt(7^57)=1,217,009,982,135,305,963,926,677 of 7^57 (1,481,113,296,616,977,741,464,105,532,513,750,734,030,421,355,207)

IntSqrt(7^59)=8,519,069,874,947,141,747,486,745 of 7^59 (72,574,551,534,231,909,331,741,171,093,173,785,967,490,646,405,143)

IntSqrt(7^61)=59,633,489,124,629,992,232,407,216 of 7^61 (3,556,153,025,177,363,557,255,317,383,565,515,512,407,041,673,852,007)

IntSqrt(7^63)=417,434,423,872,409,945,626,850,517 of 7^63 (174,251,498,233,690,814,305,510,551,794,710,260,107,945,042,018,748,343)

IntSqrt(7^65)=2,922,040,967,106,869,619,387,953,625 of 7^65 (8,538,323,413,450,849,900,970,017,037,940,802,745,289,307,058,918,668,807)

IntSqrt(7^67)=20,454,286,769,748,087,335,715,675,381 of 7^67 (418,377,847,259,091,645,147,530,834,859,099,334,519,176,045,887,014,771,543)

IntSqrt(7^69)=143,180,007,388,236,611,350,009,727,669 of 7^69 (20,500,514,515,695,490,612,229,010,908,095,867,391,439,626,248,463,723,805,607)

IntSqrt(7^71)=1,002,260,051,717,656,279,450,068,093,686 of 7^71 (1,004,525,211,269,079,039,999,221,534,496,697,502,180,541,686,174,722,466,474,743)

IntSqrt(7^73)=7,015,820,362,023,593,956,150,476,655,802 of 7^73 (49,221,735,352,184,872,959,961,855,190,338,177,606,846,542,622,561,400,857,262,407)