Last active
December 17, 2015 08:48
-
-
Save hwiorn/5582328 to your computer and use it in GitHub Desktop.
Revisions
-
hwiorn revised this gist
May 21, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ //소수(<20)의 최대 제곱수(<20)를 모두 곱셈 println((2 to 20).filter(BigInt(_).isProbablePrime(5)). map(k => (1 to 4).map(math.pow(k, _)). filter(_ <= 20).max).product.toInt) -
hwiorn revised this gist
May 16, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ //20보다 작은 소수의 제곱끼리 모아서 곱셈 println((2 to 20).filter(BigInt(_).isProbablePrime(5)). map(k => (1 to 4).map(scala.math.pow(k, _)). filter(_ <= 20).max).product.toInt) -
hwiorn revised this gist
May 15, 2013 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ //20보다 작은 소수의 제곱끼리 모아서 곱셈 println((2 to 20).filter(BigInt(_).isProbablePrime(5)). map(k => (1 to 20).map(scala.math.pow(k, _)). filter(_ <= 20).max).product.toInt) -
hwiorn revised this gist
May 15, 2013 . 1 changed file with 0 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,4 @@ //20보다 작은 소수의 제곱끼리 모아서 곱셈 println((2 to 20).filter(x => BigInt(x).isProbablePrime(1)). map(k => (1 to 20).map(y => scala.math.pow(k, y)). filter(n => n <= 20).max).product.toInt) -
hwiorn revised this gist
May 15, 2013 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,10 @@ //20보다 작은 소수의 제곱끼리 모아서 곱셈 //-#1 println ((for(x <- 2 to 20; if((BigInt(x).isProbablePrime(1)))) yield ((for(y <- 1 to 20; if(scala.math.pow(x, y) <= 20)) yield scala.math.pow(x, y)).max)).product.toInt) //-#2 println((2 to 20).filter(x => BigInt(x).isProbablePrime(1)). map(k => (1 to 20).map(y => scala.math.pow(k, y)). filter(n => n <= 20).max).product.toInt) -
hwiorn revised this gist
May 15, 2013 . 1 changed file with 4 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,4 @@ //20보다 작은 소수의 제곱끼리 모아서 곱셈 println ((for(x <- 2 to 20; if((BigInt(x).isProbablePrime(1)))) yield ((for(y <- 1 to 20; if(scala.math.pow(x, y) <= 20)) yield scala.math.pow(x, y)).max)).product.toInt) -
hwiorn created this gist
May 15, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ def z(x: Int, y: Int): Int = { if(x <= 1) y else if(x % y == 0) z(x / y, y) else z(x, y+1) } def l(a: Int) = (for(x <- 2 to a; if(z(x, 2)==x)) yield ((for(y <- 1 to a; if(scala.math.pow(x, y) <= a)) yield scala.math.pow(x, y)).max)).product.toInt println(l(20))