Pell's equation: Difference between revisions

Content added Content deleted
m (→‎{{header|Wren}}: Minor tidy)
Line 1,070: Line 1,070:
=={{header|langur}}==
=={{header|langur}}==
{{trans|D}}
{{trans|D}}
{{works with|langur|0.10}}
Prior to 0.10, multi-variable declaration/assignment would use parentheses around variable names and values.

<syntaxhighlight lang="langur">val .fun = f [.b, .b x .c + .a]
<syntaxhighlight lang="langur">val .fun = f [.b, .b x .c + .a]


val .solvePell = f(.n) {
val .solvePell = f(.n) {
val .x = truncate .n ^/ 2
val .x = trunc .n ^/ 2
var .y, .z, .r = .x, 1, .x x 2
var .y, .z, .r = .x, 1, .x x 2
var .e1, .e2, .f1, .f2 = 1, 0, 0, 1
var .e1, .e2, .f1, .f2 = 1, 0, 0, 1
Line 1,103: Line 1,100:
val .x, .y = .solvePell(.n)
val .x, .y = .solvePell(.n)
writeln $"x² - \.n;y² = 1 for:\n\tx = \.x:.C;\n\ty = \.y:.C;\n"
writeln $"x² - \.n;y² = 1 for:\n\tx = \.x:.C;\n\ty = \.y:.C;\n"
}</syntaxhighlight>
}
</syntaxhighlight>


{{out}}
{{out}}