Author Topic: Iterated digits squaring - Rosetta Code  (Read 6669 times)

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Iterated digits squaring - Rosetta Code
« on: September 04, 2021, 02:28:15 pm »
ref http://rosettacode.org/wiki/Iterated_digits_squaring

Who tried this recursively?
Code: QB64: [Select]
  1. _Title "Iterated digits squaring - Rosetta Code" ' b+ try 2021-09-04
  2. ' ref http://rosettacode.org/wiki/Iterated_digits_squaring
  3. start = Timer(.001)
  4. For i& = 1 To 100000000 ' 100 million
  5.     If i& Mod 1000000 = 0 Then Print i&, c& ' progress almost 8 minutes on my system
  6.     c& = c& + sumSQRdigitsIs89%(i&)
  7. Print c&, Timer(.001) - start
  8.  
  9. Function sumSQRdigitsIs89% (number&)
  10.     n$ = _Trim$(Str$(number&))
  11.     For i = 1 To Len(n$)
  12.         sum& = sum& + Val(Mid$(n$, i, 1)) ^ 2
  13.     Next
  14.     If sum& = 89 Then
  15.         sumSQRdigitsIs89% = 1
  16.     ElseIf sum& <> 1 Then
  17.         sumSQRdigitsIs89% = sumSQRdigitsIs89%(sum&)
  18.     End If
  19.  

Of course there must be faster ways even for QB64 ;-))

Hint get rid of the string stuff :)
« Last Edit: September 04, 2021, 02:29:47 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #1 on: September 04, 2021, 05:20:36 pm »
All afternoon to shave off 3.5 mins:
Code: QB64: [Select]
  1. _Title "Iterated digits squaring v2 - Rosetta Code" ' b+ try 2021-09-04
  2. ' ref http://rosettacode.org/wiki/Iterated_digits_squaring
  3. DefLng A-Z
  4. Dim Shared did(649), t(10), sq(10) '9*81 + 1 max sum number
  5. start = Timer(.001)
  6. For i = 1 To 100000000 ' 100 million   now a tad over 4.5 mins shaved off over 3 min.
  7.     t(1) = t(1) + 1: sq(1) = t(1) * t(1)
  8.     For j = 1 To 8
  9.         If t(j) = 10 Then t(j) = 0: sq(j) = 0: t(j + 1) = t(j + 1) + 1: sq(j + 1) = t(j + 1) * t(j + 1)
  10.     Next
  11.     'check this 100 million times less
  12.     'If t(10) = 10 Then Beep: Print "You've just exceeded the limit of the tabulator, goodbye.": End
  13.     sum = sq(1) + sq(2) + sq(3) + sq(4) + sq(5) + sq(6) + sq(7) + sq(8) + sq(9)
  14.     'check this 100 million times less
  15.     'If i Mod 1000000 = 0 Then Print i, c   ' <<< progress
  16.     If sumSQRdigits(sum) = 89 Then c = c + 1
  17. Print c, Timer(.001) - start
  18.  
  19. Function sumSQRdigits (number)
  20.     If number = 89 Then sumSQRdigits = 89: Exit Function
  21.     If number = 1 Then sumSQRdigits = 1: Exit Function
  22.     Dim As Integer sum
  23.     If number < 649 Then
  24.         If did(number) Then
  25.             sumSQRdigits = did(number)
  26.         Else
  27.             n$ = _Trim$(Str$(number))
  28.             For i = 1 To Len(n$)
  29.                 sum = sum + Val(Mid$(n$, i, 1)) ^ 2
  30.             Next
  31.             If sum = 89 Or sum = 1 Then
  32.                 did(number) = sum
  33.                 sumSQRdigits = sum: Exit Function
  34.             Else
  35.                 sumSQRdigits = sumSQRdigits(sum)
  36.             End If
  37.         End If
  38.     Else
  39.         Print " Error: number into sumSQRdigits is > 730."; " end"
  40.     End If
  41.  

Didn't make much difference to comment out progress.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #2 on: September 04, 2021, 06:40:52 pm »
hi bplus
instead of val use asc($)-48
your first example modified
Code: QB64: [Select]
  1. _Title "Iterated digits squaring - Rosetta Code" ' b+ try 2021-09-04
  2. ' ref http://rosettacode.org/wiki/Iterated_digits_squaring
  3. start = Timer(.001)
  4. For i& = 1 To 100000000 ' 100 million
  5.     If i& Mod 1000000 = 0 Then Print i&, c& ' progress almost 8 minutes on my system
  6.     c& = c& + sumSQRdigitsIs89%(i&)
  7. Print c&, Timer(.001) - start
  8.  
  9. Function sumSQRdigitsIs89% (number&)
  10.     n$ = _Trim$(Str$(number&))
  11.     For i = 1 To Len(n$)
  12.         d& = Asc(Mid$(n$, i, 1)) - 48
  13.         sum& = sum& + d& * d&
  14.     Next
  15.     If sum& = 89 Then
  16.         sumSQRdigitsIs89% = 1
  17.     ElseIf sum& <> 1 Then
  18.         sumSQRdigitsIs89% = sumSQRdigitsIs89%(sum&)
  19.     End If
  20.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #3 on: September 04, 2021, 07:42:34 pm »
Yes! nice one @jack  :)

Try this:
Code: QB64: [Select]
  1. _Title "Iterated digits squaring - Rosetta Code" ' b+ try 2021-09-04
  2. ' ref http://rosettacode.org/wiki/Iterated_digits_squaring
  3. start = Timer(.001)
  4. For i& = 1 To 100000000 ' 100 million
  5.     If i& Mod 1000000 = 0 Then Print i&, c& ' progress almost 8 minutes on my system
  6.     c& = c& + sumSQRdigitsIs89%(i&)
  7. Print c&, Timer(.001) - start
  8.  
  9. Function sumSQRdigitsIs89% (number&)
  10.     n$ = _Trim$(Str$(number&))
  11.     For i = 1 To Len(n$)
  12.         d& = Asc(n$, i) - 48
  13.         sum& = sum& + d& * d&
  14.     Next
  15.     If sum& = 89 Then
  16.         sumSQRdigitsIs89% = 1
  17.     ElseIf sum& <> 1 Then
  18.         sumSQRdigitsIs89% = sumSQRdigitsIs89%(sum&)
  19.     End If
  20.  

Man 3 mins!
« Last Edit: September 04, 2021, 07:45:38 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #4 on: September 04, 2021, 09:25:10 pm »
OK now we're cooking with butter!
Code: QB64: [Select]
  1. _Title "Iterated digits squaring v4 - Rosetta Code" ' b+ try 2021-09-04
  2. DefLng A-Z
  3. ' ref http://rosettacode.org/wiki/Iterated_digits_squaring
  4. start! = Timer(.001)
  5. For i = 1 To 100000000 ' 100 million
  6.     'If i Mod 1000000 = 0 Then Print i, c ' progress  36 secs on my system
  7.     c = c + sumSQRdigitsIs89(i)
  8. Print c, Timer(.001) - start!
  9.  
  10. Function sumSQRdigitsIs89 (number)
  11.     n = number
  12.     While n > 0
  13.         d = n Mod 10
  14.         sum = sum + d * d
  15.         n = n \ 10
  16.     Wend
  17.     If sum = 89 Then
  18.         sumSQRdigitsIs89 = 1
  19.     ElseIf sum <> 1 Then
  20.         sumSQRdigitsIs89 = sumSQRdigitsIs89(sum)
  21.     End If
  22.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #5 on: September 04, 2021, 09:33:12 pm »
Man that's the way to isolate the digits for these challenges, don't mess with string conversions.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #6 on: September 04, 2021, 09:47:58 pm »
about 18% faster
Code: QB64: [Select]
  1. _Title "Iterated digits squaring - Rosetta Code" ' b+ try 2021-09-04
  2. ' ref http://rosettacode.org/wiki/Iterated_digits_squaring
  3. start = Timer(.001)
  4. For i& = 1 To 100000000 ' 100 million
  5.     If i& Mod 1000000 = 0 Then Print i&, c& ' progress almost 8 minutes on my system
  6.     c& = c& + sumSQRdigitsIs89%(i&)
  7. Print c&, Timer(.001) - start
  8.  
  9. Function sumSQRdigitsIs89% (number&)
  10.     n$ = _Trim$(Str$(number&))
  11.     m% = Len(n$)
  12.     For i% = 1 To m%
  13.         d% = Asc(n$, i%) - 48
  14.         sum& = sum& + d% * d%
  15.     Next
  16.     If sum& = 89 Then
  17.         sumSQRdigitsIs89% = 1
  18.     ElseIf sum& <> 1 Then
  19.         sumSQRdigitsIs89% = sumSQRdigitsIs89%(sum&)
  20.     End If
  21.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #7 on: September 04, 2021, 10:06:45 pm »
I started looking at FreeBASIC's, 2 millisecs!!!

For one thing they aren't using recursion but something like this for function:
Code: QB64: [Select]
  1. _Title "Iterated digits squaring v5 - Rosetta Code" ' b+ try 2021-09-04
  2. DefLng A-Z
  3. ' ref http://rosettacode.org/wiki/Iterated_digits_squaring
  4. start! = Timer(.001)
  5. For i = 1 To 100000000 ' 100 million
  6.     If i Mod 1000000 = 0 Then Print i, c ' progress  18 secs on my system
  7.     c = c + sumSQRdigitsIs89(i)
  8. Print c, Timer(.001) - start!
  9.  
  10. Function sumSQRdigitsIs89 (number)
  11.     n = number
  12.     Do
  13.         While n > 0
  14.             d = n Mod 10
  15.             sum = sum + d * d
  16.             n = n \ 10
  17.         Wend
  18.         If sum = 89 Then
  19.             sumSQRdigitsIs89 = 1: Exit Function
  20.         ElseIf sum = 1 Then
  21.             sumSQRdigitsIs89 = 0: Exit Function
  22.         Else
  23.             n = sum
  24.             sum = 0
  25.         End If
  26.     Loop

I am down from 36 secs v4 to 18 secs now v5 but no where near 2 millisecs. They do a bunch more though in main that I have to figure out.
« Last Edit: September 04, 2021, 10:08:27 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #8 on: September 04, 2021, 10:28:10 pm »
OMG, Don't know what they did but it works in thousandths of a sec!
Code: QB64: [Select]
  1. _Title "Iterated digits squaring v6 - Rosetta Code" ' b+ try 2021-09-04
  2. DefLng A-Z
  3. ' ref http://rosettacode.org/wiki/Iterated_digits_squaring
  4. start! = Timer(.001)
  5.  
  6. Dim sums(0 To 8 * 81) ' copied and translated to QB64 from FreeBASIC entry at Rosetta Code
  7. sums(0) = 1
  8. sums(1) = 0
  9. For n = 1 To 8
  10.     For i = n * 81 To 1 Step -1
  11.         For j = 1 To 9
  12.             s = j * j
  13.             If s > i Then Exit For
  14.             sums(i) = sums(i) + sums(i - s)
  15.         Next j
  16.     Next i
  17.     If n = 8 Then
  18.         count89 = 0
  19.         For i = 1 To n * 81
  20.             If sumSQRdigitsIs89(i) Then count89 = count89 + sums(i)
  21.         Next i
  22.         Print "There are"; count89; " numbers from 1 to 100 million ending with 89"
  23.     End If
  24. Print Timer(.001) - start!
  25.  
  26. Function sumSQRdigitsIs89 (number)
  27.     n = number
  28.     Do
  29.         While n > 0
  30.             d = n Mod 10
  31.             sum = sum + d * d
  32.             n = n \ 10
  33.         Wend
  34.         If sum = 89 Then
  35.             sumSQRdigitsIs89 = 1: Exit Function
  36.         ElseIf sum = 1 Then
  37.             sumSQRdigitsIs89 = 0: Exit Function
  38.         Else
  39.             n = sum
  40.             sum = 0
  41.         End If
  42.     Loop
  43.  

 
Iterated digits squaring v6.PNG
« Last Edit: September 04, 2021, 10:33:07 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #9 on: September 04, 2021, 10:49:35 pm »
I remove the 2nd block For loop in main and move it outside to save a couple lines of code:
Code: QB64: [Select]
  1. _Title "Iterated digits squaring v7 - Rosetta Code" ' b+ try 2021-09-04
  2. DefLng A-Z
  3. ' ref http://rosettacode.org/wiki/Iterated_digits_squaring
  4. start! = Timer(.001)
  5. Dim sums(0 To 8 * 81) ' copied and translated to QB64 from FreeBASIC entry at Rosetta Code
  6. sums(0) = 1
  7. sums(1) = 0
  8. For n = 1 To 8
  9.     For i = n * 81 To 1 Step -1
  10.         For j = 1 To 9
  11.             s = j * j
  12.             If s > i Then Exit For
  13.             sums(i) = sums(i) + sums(i - s)
  14.         Next j
  15.     Next i
  16. For i = 1 To 8 * 81
  17.     If sumSQRdigitsIs89(i) Then count89 = count89 + sums(i)
  18. Print "There are"; count89; " numbers from 1 to 100 million ending with 89"
  19. Print Timer(.001) - start!
  20.  
  21. Function sumSQRdigitsIs89 (number)
  22.     n = number
  23.     Do
  24.         While n > 0
  25.             d = n Mod 10
  26.             sum = sum + d * d
  27.             n = n \ 10
  28.         Wend
  29.         If sum = 89 Then
  30.             sumSQRdigitsIs89 = 1: Exit Function
  31.         ElseIf sum = 1 Then
  32.             sumSQRdigitsIs89 = 0: Exit Function
  33.         Else
  34.             n = sum
  35.             sum = 0
  36.         End If
  37.     Loop
  38.  
  39.  
  40.  
« Last Edit: September 04, 2021, 10:54:23 pm by bplus »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Iterated digits squaring - Rosetta Code
« Reply #10 on: September 04, 2021, 11:25:22 pm »
You could probably do some precalculation and save time too.  For example:

s = j * j


Instead:

FOR j = 1 TO 9
   s(j) = j * j
NEXT

Then use s(j) directly, rather than calculating the value each loop.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #11 on: September 05, 2021, 02:08:57 am »
Thanks @SMcNeill that s=j*j looks like it is needed in line 14, but I don't know.

I definitely don't know what is going in the first For loops in the main block.

Can anyone explain it?

The 81's are the maximum square for a digit if you have n digits then the maximum sum of them is n * 81 which is  allot less than the numbers we run through for the 89 sums. I did start a table that recorded where the sums would go, the did() array (in V2) so we could avoid doing those calculation sequences over and over. But I don't think the FreeBASIC code is doing quite the same thing.
« Last Edit: September 05, 2021, 02:10:12 am by bplus »

Offline david_uwi

  • Newbie
  • Posts: 71
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #12 on: September 06, 2021, 03:57:14 am »
We can't let freebasic beat QB64 so here's my code. The timing is not accurate because of the small execution time.
Code: QB64: [Select]
  1. nn = 8 'this is the number of digits 8 --> 100,000,000
  2. pp = 81 * nn
  3. DIM xa(pp) AS LONG
  4. DIM xb(pp, nn) AS LONG
  5. DIM qsq(12) AS INTEGER
  6. DIM sum AS LONG
  7. start! = TIMER(.001) 'this is not reliable for these short execution times
  8. FOR i = 1 TO 9
  9.     sq1 = i * i
  10.     qsq(i + 1) = sq1
  11.     xb(sq1, 1) = xb(sq1, 1) + 1
  12. qsq(1) = 0
  13. FOR jkl = 2 TO nn
  14.     FOR j = 1 TO pp
  15.         IF xb(j, jkl - 1) <> 0 THEN
  16.             FOR k = 1 TO 10
  17.                 ind = j + qsq(k)
  18.                 xb(ind, jkl) = xb(ind, jkl) + xb(j, jkl - 1)
  19.             NEXT k
  20.         END IF
  21.     NEXT j
  22. NEXT jkl
  23. FOR i = 1 TO pp
  24.     FOR jkl = 1 TO nn
  25.         xa(i) = xb(i, jkl) + xa(i)
  26.     NEXT jkl
  27. FOR i = 1 TO pp
  28.     IF xa(i) <> 0 THEN
  29.         sum = sum + xa(i)
  30.     END IF
  31. FOR i = 1 TO pp
  32.     IF xa(i) <> 0 THEN
  33.         z1 = i
  34.         k = 0
  35.         DO
  36.             k = k + 1
  37.             a = 0
  38.             a = z1 \ 100
  39.             z1 = z1 MOD 100
  40.             b = z1 \ 10
  41.             c = z1 MOD 10
  42.             z1 = a * a + b * b + c * c
  43.             IF z1 = 89 THEN m89 = m89 + xa(i): EXIT DO
  44.             IF z1 = 1 THEN m1 = m1 + xa(i): EXIT DO
  45.         LOOP
  46.     END IF
  47. PRINT "time taken= "; TIMER(.001) - start!
  48. PRINT "number ending in 89 = "; m89; ""
  49. PRINT "number ending in 1 = "; m1 + 1
  50. PRINT "total numbers = "; m1 + m89 + 1

Marked as best answer by bplus on September 06, 2021, 02:56:26 am

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #13 on: September 06, 2021, 06:55:50 am »
@david_uwi

I tried to give our codes more work to do so the times would be extended for comparing. I got the FB version timing number of digits 1 through 19 (after that even _Unsigned _Integer64 has overflow errors)
Code: QB64: [Select]
  1. _Title "Iterated digits squaring v8 - Rosetta Code" ' b+ try 2021-09-04  v8 2021-09-06
  2. ' ref http://rosettacode.org/wiki/Iterated_digits_squaring
  3. ' add more chores to v7 so takes enough time to differentiate with david_uwi's version
  4.  
  5. start! = Timer(.001)
  6. For nDigits = 1 To 19 ' it's wrong after 19
  7.     ReDim sums(0 To nDigits * 81) ' copied and translated to QB64 from FreeBASIC entry at Rosetta Code
  8.     sums(0) = 1
  9.     sums(1) = 0
  10.     For n = 1 To nDigits
  11.         For i = n * 81 To 1 Step -1
  12.             For j = 1 To 9
  13.                 s = j * j
  14.                 If s > i Then Exit For
  15.                 sums(i) = sums(i) + sums(i - s)
  16.             Next j
  17.         Next i
  18.     Next
  19.     count89 = 0
  20.     For i = 1 To nDigits * 81
  21.         If sumSQRdigitsIs89(i) Then count89 = count89 + sums(i)
  22.     Next i
  23.     Print "For 10 ^"; nDigits; "there are"; count89; "numbers ending with 89."
  24. Print Timer(.001) - start!
  25.  
  26. Function sumSQRdigitsIs89 (number)
  27.     n = number
  28.     Do
  29.         While n > 0
  30.             d = n Mod 10
  31.             sum = sum + d * d
  32.             n = n \ 10
  33.         Wend
  34.         If sum = 89 Then
  35.             sumSQRdigitsIs89 = 1: Exit Function
  36.         ElseIf sum = 1 Then
  37.             sumSQRdigitsIs89 = 0: Exit Function
  38.         Else
  39.             n = sum
  40.             sum = 0
  41.         End If
  42.     Loop
  43.  

Ha! still not enough work for one click of the clock!

I tried modifying your code but my attempts ran into wrong numbers after the number of digits hit 14?
« Last Edit: September 06, 2021, 07:00:34 am by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Iterated digits squaring - Rosetta Code
« Reply #14 on: September 06, 2021, 07:27:31 am »
@david_uwi maybe you can see what's happening:

My attempt to mod your code (I tried to do one time stuff outside main loop but kept getting errors so tried just redoing everything at start of new nn (number of Digits) set in main For loop, better but errors after 13 digits).
Code: QB64: [Select]
  1. _Title "Iterated digits squaring - Rosetta Code david_uwi version mod b+"
  2. ' from   https://www.qb64.org/forum/index.php?topic=4160.msg135168#msg135168
  3. ' copied and modified by b+ for a timed test with FB version 2021-09-06
  4. ' mod notes: change all to _Integer64 and Loop nDigits 1 to 19
  5.  
  6. nn = 8 'this is the number of digits 8 --> 100,000,000
  7. start! = Timer(.001) 'this is not reliable for these short execution times
  8. For nn = 1 To 19
  9.     pp = 81 * nn
  10.     ReDim xa(pp)
  11.     ReDim xb(pp, nn)
  12.     ReDim qsq(12)
  13.     sum = 0
  14.     For i = 1 To 9
  15.         sq1 = i * i
  16.         qsq(i + 1) = sq1
  17.         xb(sq1, 1) = xb(sq1, 1) + 1
  18.     Next i
  19.     qsq(1) = 0
  20.     m89 = 0
  21.     For jkl = 2 To nn
  22.         For j = 1 To pp
  23.             If xb(j, jkl - 1) <> 0 Then
  24.                 For k = 1 To 10
  25.                     ind = j + qsq(k)
  26.                     xb(ind, jkl) = xb(ind, jkl) + xb(j, jkl - 1)
  27.                 Next k
  28.             End If
  29.         Next j
  30.     Next jkl
  31.     For i = 1 To pp
  32.         For jkl = 1 To nn
  33.             xa(i) = xb(i, jkl) + xa(i)
  34.         Next jkl
  35.     Next i
  36.     For i = 1 To pp
  37.         If xa(i) <> 0 Then
  38.             sum = sum + xa(i)
  39.         End If
  40.     Next i
  41.     For i = 1 To pp
  42.         If xa(i) <> 0 Then
  43.             z1 = i
  44.             k = 0
  45.             Do
  46.                 k = k + 1
  47.                 a = 0
  48.                 a = z1 \ 100
  49.                 z1 = z1 Mod 100
  50.                 b = z1 \ 10
  51.                 c = z1 Mod 10
  52.                 z1 = a * a + b * b + c * c
  53.                 If z1 = 89 Then m89 = m89 + xa(i): Exit Do
  54.                 If z1 = 1 Then m1 = m1 + xa(i): Exit Do
  55.             Loop
  56.         End If
  57.     Next i
  58.  
  59.     Print "For 10 ^"; nn; " the number ending in 89 ="; m89
  60.     'Print "number ending in 1 = "; m1 + 1
  61.     'Print "total numbers = "; m1 + m89 + 1
  62. Print "time taken= "; Timer(.001) - start!
  63.  
Iterated digits squaring b+ mod david_uwi version.PNG
« Last Edit: September 06, 2021, 07:30:07 am by bplus »