Sturmian word: Difference between revisions
Content added Content deleted
(→{{header|Wren}}: Modified to deal with Sturmian words derived from quadratric as well as rational numbers.) |
|||
Line 27: | Line 27: | ||
== {{header|Phix}} == |
== {{header|Phix}} == |
||
Rational part translated from Python, quadratic part modified from the [[Continued fraction convergents]] task. |
|||
{{trans|Python}} |
|||
<!--(phixonline)--> |
<!--(phixonline)--> |
||
<syntaxhighlight lang="Phix"> |
<syntaxhighlight lang="Phix"> |
||
Line 61: | Line 61: | ||
sturmian = sturmian_word(13, 21) |
sturmian = sturmian_word(13, 21) |
||
assert(fib[1..length(sturmian)] == sturmian) |
assert(fib[1..length(sturmian)] == sturmian) |
||
printf(1," %s <== 13/21\n",sturmian) |
|||
function cfck(integer a, b, m, n, k) |
function cfck(integer a, b, m, n, k) |
||
Line 85: | Line 85: | ||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
01001010010010100101001001010010 <== 13/21 |
|||
01001010010010100101001001010010 <== 1/phi (8th convergent) |
01001010010010100101001001010010 <== 1/phi (8th convergent) |
||
</pre> |
</pre> |