fork download
  1. #!/usr/bin/env bash
  2.  
  3. read w h d s
  4. r=$(bc<<<"scale=5;($d^4 / $h^4 - 1) * $h * $w * 3 / 13 / (1 + $s)")
  5. r=${r#-}
  6. q=$(bc<<<"scale=5;sqrt($r)")
  7. t="$(for i in $(seq 1 ${q%%.*}); do
  8. m=$(bc<<<"scale=5;$r/$i")
  9. echo "${m##*.}|$i: $m"
  10. done | sort -n | cut -d\| -f2-)"
  11. echo -e "\nsqrt = $q\n"
  12. head -15 <<<"$t"
  13. echo ""
  14. tail -15 <<<"$t"
  15.  
Success #stdin #stdout 0.16s 5324KB
stdin
65 160 232 0
stdout
sqrt = 90.60463

76: 108.01578
72: 114.01666
57: 144.02105
54: 152.02222
48: 171.02500
38: 216.03157
36: 228.03333
27: 304.04444
24: 342.05000
19: 432.06315
18: 456.06666
16: 513.07500
29: 283.07586
12: 684.10000
82: 100.11219

60: 136.82000
5: 1641.84000
52: 157.86923
37: 221.87027
53: 154.89056
17: 482.89411
83: 98.90602
43: 190.91162
79: 103.91392
21: 390.91428
10: 820.92000
23: 356.92173
74: 110.93513
51: 160.96470
69: 118.97391