Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
33
Task/Tau-number/BCPL/tau-number.bcpl
Normal file
33
Task/Tau-number/BCPL/tau-number.bcpl
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
get "libhdr"
|
||||
|
||||
// Count the divisors of 1..N
|
||||
let divcounts(v, n) be
|
||||
$( // Every positive number is divisible by 1
|
||||
for i=1 to n do v!i := 1;
|
||||
for i=2 to n do
|
||||
$( let j = i
|
||||
while j <= n do
|
||||
$( // J is divisible by I
|
||||
v!j := v!j + 1
|
||||
j := j + i
|
||||
$)
|
||||
$)
|
||||
$)
|
||||
|
||||
// Given a stored vector of divisors counts, is a number a tau number?
|
||||
let tau(v, i) = i rem v!i = 0
|
||||
|
||||
let start() be
|
||||
$( let dvec = vec 1100
|
||||
let n, seen = 1, 0
|
||||
|
||||
divcounts(dvec, 1100) // find amount of divisors for each number
|
||||
while seen < 100 do
|
||||
$( if tau(dvec, n) then
|
||||
$( writed(n, 5)
|
||||
seen := seen + 1
|
||||
if seen rem 10 = 0 then wrch('*N')
|
||||
$)
|
||||
n := n + 1
|
||||
$)
|
||||
$)
|
||||
Loading…
Add table
Add a link
Reference in a new issue