Skip to main content
Commonmark migration
Source Link

#Pyth, 38 bytes

Pyth, 38 bytes

#Pyth, 38 bytes

Pyth, 38 bytes

Source Link
Sok
  • 6.2k
  • 1
  • 19
  • 30

#Pyth, 38 bytes

J*K1.96Kmc++dhQcJ2+sQJ_B*K@+cJ4c*FQsQ2 

Input is as a list of values, [n_s, n_f]. Output is [upper, lower] Try it online here, or verify all the test cases at once here.

J*K1.96Kmc++dhQcJ2+sQJ_B*K@+cJ4c*FQsQ2 Implicit: Q=eval(input()) K1.96 Set variable K=1.96 (z) J*K K Set variable J=K*K (z^2) *FQ Product of input pair c sQ Divide the above by the sum of the input pair cJ4 J / 4 + Add the two previous results @ 2 Take the square root of the above *K Multiply by K _B Pair the above with itself, negated m Map each in the above, as d, using: hQ First value of input (i.e. n_s) cJ2 J / 2 ++d Sum the above two with d c Divided by... +sQJ ... (J + sum of input)