Sequence: smallest number greater than previous term with exactly n divisors: Difference between revisions

Added Dyalect programming language
(Add Factor example)
(Added Dyalect programming language)
Line 159:
1 2 4 6 16 18 64 66 100 112 1024 1035 4096 4288 4624
</pre>
 
=={{header|Dyalect}}==
 
{{trans|Go}}
 
<lang dyalect>func countDivisors(n) {
var count = 0
var i = 1
while i * i <= n {
if n % i == 0 {
if i == n / i {
count += 1
} else {
count += 2
}
}
i += 1
}
return count
}
const max = 15
print("The first \(max) terms of the sequence are:")
var (i, next) = (1, 1)
while next <= max {
if next == countDivisors(i) {
print("\(i) ", terminator: "")
next += 1
}
i += 1
}
 
print()</lang>
 
{{out}}
 
<pre>The first 15 terms of the sequence are:
1 2 4 6 16 18 64 66 100 112 1024 1035 4096 4288 4624</pre>
 
=={{header|Factor}}==
Anonymous user