Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Tau-function/Gambas/tau-function.gambas
Normal file
20
Task/Tau-function/Gambas/tau-function.gambas
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Public Sub Main()
|
||||
|
||||
Print "The tau functions for the first 100 positive integers are:\n"
|
||||
For i As Integer = 1 To 100
|
||||
Print Format$(numdiv(i), "####");
|
||||
If i Mod 10 = 0 Then Print
|
||||
Next
|
||||
|
||||
End
|
||||
|
||||
Public Function numdiv(n As Integer) As Integer
|
||||
|
||||
Dim c As Integer = 1
|
||||
For i As Integer = 1 To (n + 1) \ 2
|
||||
If n Mod i = 0 Then c += 1
|
||||
Next
|
||||
If n = 1 Then c -= 1
|
||||
Return c
|
||||
|
||||
End Function
|
||||
Loading…
Add table
Add a link
Reference in a new issue