Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
46
Task/Tau-number/FutureBasic/tau-number.basic
Normal file
46
Task/Tau-number/FutureBasic/tau-number.basic
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// Tau Numbers
|
||||
//
|
||||
// FutureBasic 7.0.34, August 2025 R.W
|
||||
//
|
||||
//-------------------------------------
|
||||
//
|
||||
// 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
|
||||
|
||||
// Returns True if n is a Tau number
|
||||
local fn isTau(n as Int) as boolean
|
||||
boolean result = _False
|
||||
if n % fn Tau(n) == 0 then result = _True
|
||||
end fn = result
|
||||
|
||||
window 1,@"Tau numbers"
|
||||
|
||||
print
|
||||
print " First 100 Tau numbers:"
|
||||
print
|
||||
|
||||
int x, c, res
|
||||
c = 1: x = 1
|
||||
while c < 100
|
||||
if fn isTau(x)
|
||||
print using "######";x;
|
||||
if (c % 9 == 0) then print
|
||||
c++
|
||||
end if
|
||||
x++
|
||||
wend
|
||||
|
||||
handleEvents
|
||||
//
|
||||
Loading…
Add table
Add a link
Reference in a new issue