Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/Mian-Chowla-sequence/Sidef/mian-chowla-sequence.sidef
Normal file
24
Task/Mian-Chowla-sequence/Sidef/mian-chowla-sequence.sidef
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
var (n, sums, ts, mc) = (100, Set([2]), [], [1])
|
||||
var st = Time.micro_sec
|
||||
for i in (1 ..^ n) {
|
||||
for j in (mc[i-1]+1 .. Inf) {
|
||||
mc[i] = j
|
||||
for k in (0 .. i) {
|
||||
var sum = mc[k]+j
|
||||
if (sums.exists(sum)) {
|
||||
ts.clear
|
||||
break
|
||||
}
|
||||
ts << sum
|
||||
}
|
||||
if (ts.len > 0) {
|
||||
sums = (sums|Set(ts...))
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
var et = (Time.micro_sec - st)
|
||||
var s = " of the Mian-Chowla sequence are:\n"
|
||||
say "The first 30 terms#{s}#{mc.ft(0, 29).join(' ')}\n"
|
||||
say "Terms 91 to 100#{s}#{mc.ft(90, 99).join(' ')}\n"
|
||||
say "Computation time was #{et} seconds."
|
||||
Loading…
Add table
Add a link
Reference in a new issue