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
<?xml version="1.0"?> | |
<!DOCTYPE module PUBLIC | |
"-//Puppy Crawl//DTD Check Configuration 1.3//EN" | |
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> | |
<!-- | |
Checkstyle configuration that checks the sun coding conventions from: | |
- the Java Language Specification at |
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
ruby -e 'puts (("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a).shuffle[0..32].join' |
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
import java.text.DecimalFormat | |
object Problem9 extends App { | |
for (a <- 1 to 1000; b <- 1 to 1000) yield { | |
val total = math.pow(a, 2) + math.pow(b, 2) | |
val c = math.sqrt(total).floor | |
val t = c * c |
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
object Problem6 extends App { | |
val numbers = 1 to 100 | |
def square(n: Int) = n * n | |
val r = square(numbers.sum) - numbers.map(square).sum | |
Console.println(r) |
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
object Problem8 extends App { | |
val target = "73167176531330624919225119674426574742355349194934" + | |
"96983520312774506326239578318016984801869478851843" + | |
"85861560789112949495459501737958331952853208805511" + | |
"12540698747158523863050715693290963295227443043557" + | |
"66896648950445244523161731856403098711121722383113" + | |
"62229893423380308135336276614282806444486645238749" + | |
"30358907296290491560440772390713810515859307960866" + | |
"70172427121883998797908792274921901699720888093776" + |
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
object Problem8 extends App { | |
val target = "73167176531330624919225119674426574742355349194934" + | |
"96983520312774506326239578318016984801869478851843" + | |
"85861560789112949495459501737958331952853208805511" + | |
"12540698747158523863050715693290963295227443043557" + | |
"66896648950445244523161731856403098711121722383113" + | |
"62229893423380308135336276614282806444486645238749" + | |
"30358907296290491560440772390713810515859307960866" + | |
"70172427121883998797908792274921901699720888093776" + |
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
object Problem7 extends App { | |
lazy val ps: Stream[Int] = 2 #:: Stream.from(3).filter( | |
i => { | |
// 素数だけのリストを作る。jはiの平方根より小さい数で、iが割り切れる数である。 | |
ps.takeWhile(j => { j * j <= i }).forall(i % _ > 0) | |
} | |
) | |
Console.println(ps.take(10001).last) |
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
import java.text.DecimalFormat | |
object Problem6 extends App { | |
val a = math.pow(1 to 100 sum, 2) | |
val b = 1 to 100 map(math.pow(_, 2)) sum | |
val formatter = new DecimalFormat("#") | |
Console.println(formatter.format(a - b)) |
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
Range(20, Int.MaxValue) | |
.find(n => Range(2, 21).forall(n % _ == 0)).get |
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
object Problem5 extends App { | |
lazy val ps: Stream[Int] = 2 #:: Stream.from(3).filter( | |
i => { | |
// 素数だけのリストを作る。jはiの平方根より小さい数で、iが割り切れる数である。 | |
ps.takeWhile(j => { j * j <= i }).forall(i % _ > 0) | |
} | |
) | |
val limit = 20 |