Last active
June 18, 2021 17:52
-
-
Save FloWi/65c1e828e46b94ce05a53335220c9fd8 to your computer and use it in GitHub Desktop.
ganzzahlige Vektorlängen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val maxNum = 20 | |
val res = for { | |
x <- 1.to(maxNum) | |
y <- x.to(maxNum) | |
z <- y.to(maxNum) | |
squareSum = x*x+y*y+z*z | |
sqrtSquareSum = math.sqrt(squareSum) | |
if (sqrtSquareSum.toInt.toDouble == sqrtSquareSum) | |
} yield s"$x,$y,$z,$squareSum,${sqrtSquareSum.toInt}" | |
println(s"""x,y,z,Summe Quadrate, Wurzel (Summe Quadrate) | |
${res.mkString("\n")}""") | |
//https://scastie.scala-lang.org/JeqpJgCtQqmt26LEHPd1mA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x | y | z | Summe Quadrate | Wurzel (Summe Quadrate) | |
---|---|---|---|---|---|
1 | 2 | 2 | 9 | 3 | |
1 | 4 | 8 | 81 | 9 | |
1 | 6 | 18 | 361 | 19 | |
1 | 12 | 12 | 289 | 17 | |
2 | 3 | 6 | 49 | 7 | |
2 | 4 | 4 | 36 | 6 | |
2 | 5 | 14 | 225 | 15 | |
2 | 6 | 9 | 121 | 11 | |
2 | 8 | 16 | 324 | 18 | |
2 | 10 | 11 | 225 | 15 | |
3 | 4 | 12 | 169 | 13 | |
3 | 6 | 6 | 81 | 9 | |
3 | 14 | 18 | 529 | 23 | |
4 | 4 | 7 | 81 | 9 | |
4 | 5 | 20 | 441 | 21 | |
4 | 6 | 12 | 196 | 14 | |
4 | 8 | 8 | 144 | 12 | |
4 | 8 | 19 | 441 | 21 | |
4 | 12 | 18 | 484 | 22 | |
4 | 13 | 16 | 441 | 21 | |
5 | 10 | 10 | 225 | 15 | |
6 | 6 | 7 | 121 | 11 | |
6 | 6 | 17 | 361 | 19 | |
6 | 9 | 18 | 441 | 21 | |
6 | 10 | 15 | 361 | 19 | |
6 | 12 | 12 | 324 | 18 | |
6 | 13 | 18 | 529 | 23 | |
7 | 14 | 14 | 441 | 21 | |
8 | 8 | 14 | 324 | 18 | |
8 | 9 | 12 | 289 | 17 | |
8 | 11 | 16 | 441 | 21 | |
8 | 16 | 16 | 576 | 24 | |
9 | 12 | 20 | 625 | 25 | |
9 | 18 | 18 | 729 | 27 | |
10 | 20 | 20 | 900 | 30 | |
12 | 12 | 14 | 484 | 22 | |
12 | 15 | 16 | 625 | 25 | |
17 | 20 | 20 | 1089 | 33 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment