Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Van-Eck-sequence/Tcl/van-eck-sequence.tcl
Normal file
24
Task/Van-Eck-sequence/Tcl/van-eck-sequence.tcl
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
## Mathematically, the first term has index "0", not "1". We do that, also.
|
||||
|
||||
set ::vE 0
|
||||
|
||||
proc vanEck {n} {
|
||||
global vE vEocc
|
||||
while {$n >= [set k [expr {[llength $vE] - 1}]]} {
|
||||
set kv [lindex $vE $k]
|
||||
## value $kv @ $k is not yet stuffed into vEocc()
|
||||
lappend vE [expr {[info exists vEocc($kv)] ? $k - $vEocc($kv) : 0}]
|
||||
set vEocc($kv) $k
|
||||
}
|
||||
return [lindex $vE $n]
|
||||
}
|
||||
|
||||
proc show {func from to} {
|
||||
for {set n $from} {$n <= $to} {incr n} {
|
||||
append r " " [$func $n]
|
||||
}
|
||||
puts "${func}($from..$to) =$r"
|
||||
}
|
||||
|
||||
show vanEck 0 9
|
||||
show vanEck 990 999
|
||||
Loading…
Add table
Add a link
Reference in a new issue