Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
14
Task/Fibonacci-word/Uiua/fibonacci-word.uiua
Normal file
14
Task/Fibonacci-word/Uiua/fibonacci-word.uiua
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Build the string recursively.
|
||||
F ← |1 memo⟨⟨⊂∩F-1.-1|"0"◌⟩=2.|"1"◌⟩=1.
|
||||
# General entropy formula - quite slow for this task.
|
||||
Egen ← /+(¯×ₙ2.)÷/+.≡(⧻⊚=)⊃◴¤
|
||||
# Specific entropy formula for a binary string.
|
||||
E ← ⍥(0◌)=NaN.+∩(¯×ₙ2.)⟜(¯-1)÷⊃⧻(⧻⊚="1")
|
||||
|
||||
# Much faster approach -- don't even build the string, just count
|
||||
# how many "0"s and "1"s the string will have.
|
||||
Fx ← |1 memo⟨⟨+∩Fx-1.-1|[1 0]◌⟩=2.|[0 1]◌⟩=1.
|
||||
Ex ← ⍥(0◌)=NaN./+(¯×ₙ2.)÷/+.
|
||||
|
||||
# Print and time it
|
||||
⍜now(≡(⇌[⊃/+ (⍜(×1e8)⁅Ex)Fx.])+1⇡37)
|
||||
Loading…
Add table
Add a link
Reference in a new issue