#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### In this Discussion

edited September 25 in General Posts: 7,923

I had the opportunity to try my Pi program on 4 different iPads to see what the speed differences were. I ran the program which is set to calculate 25,000 digits of Pi. I commented out the line that prints the digits. This was on an iPad 1, an iPad Air 1, an iPad Pro 1, and an iPad Air 3. I ran it several times on each iPad and selected the lowest time. Here are the results. You can try this on your iPad and post your time.

``````iPad 1      178 seconds
iPad Pro 1  7.19 seconds    (12.9”)
``````
``````function setup()
s=require("socket")
local digits=25000 -- number of digits of Pi
print("Calculating "..digits.." digits of pi.")
local pi,tab={},{}
local size=math.ceil(digits/7)+1
local size1=math.ceil(size*7)
local sum,carry,b,z2
local d1,d2=10000000,9999999
local str=""
start=s.gettime()
for z=0,size1 do
tab[z]=5*z+3
end
for t=1,size do
carry=0
for z=size1,0,-1 do
z2=z*z
sum=tab[z]*d1+carry
b=27*(z2+z)+6
tab[z]=sum%b
carry=(sum//b)*(2*z2-z)
end
tab=sum%d1
table.insert(pi,sum//d1)
end
carry=0
for z=size,1,-1 do
b=pi[z]+carry
if b>d2 then
b=b-d1
carry=1
else
carry=0
end
pi[z]=string.format("%07d",b)
end
pi="3.\n"
str=table.concat(pi)
--print(string.sub(str,1,digits+2))
print(digits.."  digits of Pi in "..s.gettime()-start,"seconds")
end
``````

• Posts: 122
iPhone 6+
25000 digits of Pi in 13.592967033386 seconds
• Posts: 5,054

iPhone X: 5.5s