RosettaCodeData/Task/Tau-function/FutureBasic/tau-function.basic

40 lines
638 B
Plaintext

//
// Tau Function
//
// FutureBasic 7.0.34, August 2025 R.W
//
// Given a positive integer, count the
// number of its positive divisors.
//---------------------------------------
// Given an integer, returns the
// Tau positive integer
local fn Tau( n as Int) as Int
int x, result
if n < 3
result = n
else
result = 2
for x = 2 to fix((n + 1) / 2)
if n % x == 0 then result++
next x
end if
end fn = result
Window 1,@"Tau Function"
print
print "First 100 positive integer Tau numbers:"
print
int x
for x = 1 to 100
print using "####";fn Tau(x);
if x % 10 == 0 then print
next x
handleEvents