Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -1,18 +1,18 @@
|
|||
fun divisorCount = int by int n
|
||||
int total = 1
|
||||
for ; (n & 1) == 0; n /= 2 do ++total end
|
||||
for int p = 3; p * p <= n; p += 2
|
||||
int count = 1
|
||||
for ; n % p == 0; n /= p do ++count end
|
||||
total *= count
|
||||
fun divisorCount ← int by int n
|
||||
int total ← 1
|
||||
for ; (n & 1) æ 0; n /← 2 do ++total end
|
||||
for int p ← 3; p * p ≤ n; p +← 2
|
||||
int count ← 1
|
||||
for ; n % p æ 0; n /← p do ++count end
|
||||
total *← count
|
||||
end
|
||||
if n > 1 do total *= 2 end
|
||||
if n > 1 do total *← 2 end
|
||||
return total
|
||||
end
|
||||
int limit = 100
|
||||
int limit ← 100
|
||||
writeLine("Count of divisors for the first " + limit + " positive integers:")
|
||||
for int n = 1; n <= limit; ++n
|
||||
text value = text!divisorCount(n)
|
||||
for int n ← 1; n ≤ limit; ++n
|
||||
text value ← text!divisorCount(n)
|
||||
write((" " * (3 - value.length)) + value)
|
||||
if n % 20 == 0 do writeLine() end
|
||||
if n % 20 æ 0 do writeLine() end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue