Skip to main content
added 13 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

MATL, 15 bytes

17Lt_Qwhi^d5X^/ 

Try it online! Or verify all test cases.

Explanation

17L % Push ϕ (predefined literal) t_Q % Duplicate, negate, add 1: gives 1-ϕ wh % Swap, concatenate horizontally: gives [1-ϕ, ϕ] i^ % Input n, element-wise power: gives [(1-ϕ)^n, ϕ^n] d % Consecutive difference(s): gives ϕ^n - (1-ϕ)^n 5X^ % Push 5, square root / % Divide.: gives (ϕ^n - (1-ϕ)^n) / sqrt(5) % Implicit display 

MATL, 15 bytes

17Lt_Qwhi^d5X^/ 

Try it online! Or verify all test cases.

Explanation

17L % Push ϕ (predefined literal) t_Q % Duplicate, negate, add 1: gives 1-ϕ wh % Swap, concatenate: gives [1-ϕ, ϕ] i^ % Input n, element-wise power: gives [(1-ϕ)^n, ϕ^n] d % Consecutive difference(s): gives ϕ^n - (1-ϕ)^n 5X^ % Push 5, square root / % Divide. Implicit display 

MATL, 15 bytes

17Lt_Qwhi^d5X^/ 

Try it online! Or verify all test cases.

Explanation

17L % Push ϕ (predefined literal) t_Q % Duplicate, negate, add 1: gives 1-ϕ wh % Swap, concatenate horizontally: gives [1-ϕ, ϕ] i^ % Input n, element-wise power: gives [(1-ϕ)^n, ϕ^n] d % Consecutive difference(s): gives ϕ^n - (1-ϕ)^n 5X^ % Push 5, square root / % Divide: gives (ϕ^n - (1-ϕ)^n) / sqrt(5) % Implicit display 
added 358 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

MATL, 15 bytes

17Lt_Qwhi^d5X^/ 

Try it online! Or verify all test cases.

Explanation

17L % Push ϕ (predefined literal) t_Q % Duplicate, negate, add 1: gives 1-ϕ wh % Swap, concatenate: gives [1-ϕ, ϕ] i^ % Input n, element-wise power: gives [(1-ϕ)^n, ϕ^n] d % Consecutive difference(s): gives ϕ^n - (1-ϕ)^n 5X^ % Push 5, square root / % Divide. Implicit display 

MATL, 15 bytes

17Lt_Qwhi^d5X^/ 

Try it online! Or verify all test cases.

MATL, 15 bytes

17Lt_Qwhi^d5X^/ 

Try it online! Or verify all test cases.

Explanation

17L % Push ϕ (predefined literal) t_Q % Duplicate, negate, add 1: gives 1-ϕ wh % Swap, concatenate: gives [1-ϕ, ϕ] i^ % Input n, element-wise power: gives [(1-ϕ)^n, ϕ^n] d % Consecutive difference(s): gives ϕ^n - (1-ϕ)^n 5X^ % Push 5, square root / % Divide. Implicit display 
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

MATL, 15 bytes

17Lt_Qwhi^d5X^/ 

Try it online! Or verify all test cases.