I hereby claim:
- I am mbc9news on github.
- I am mbc9news (https://keybase.io/mbc9news) on keybase.
- I have a public key ASD-WIHdX7pzOjRYhsW_1uiQ1eVVzFmAHDU-J1S2Lui2Rgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import java.io.FileInputStream | |
object FreeCell { | |
def check(n : Float , d:Float ,g:Float) : Boolean = { | |
if((g == 100 && d != 100) || (g == 0 && d != 0)) | |
false | |
else{ | |
val tmp1 = (1 to n.toInt).toList.filter(n => 100%n == 0).map(100/_) | |
val tmp2 = 0 to 100 |
object Euler_014 extends App { | |
def collatz(curNum:BigInt, times:Int = 1):Int = { | |
if(curNum equals 1) return times | |
if(curNum%2 equals 0) collatz(curNum/2, times+1) | |
else collatz(3*curNum+1, times+1) | |
} | |
val result = (1 to 1000000).map(collatz(_)) | |
println(result.indexOf(result.max)+1) |
object Euler_013 extends App { | |
val RAW_DATA = """ | |
37107287533902102798797998220837590246510135740250 | |
46376937677490009712648124896970078050417018260538 | |
74324986199524741059474233309513058123726617309629 | |
91942213363574161572522430563301811072406154908250 | |
23067588207539346171171980310421047513778063246676 | |
89261670696623633820136378418383684178734361726757 | |
28112879812849979408065481931592621691275889832738 | |
44274228917432520321923589422876796487670272189318 |
object Euler_012 extends App { | |
def getPrimeList(orgNum:Int, curNum:Int=1, primeList:List[Int] = List()): List[Int] = { | |
if(orgNum < curNum) return primeList | |
if (orgNum%curNum equals 0) getPrimeList(orgNum, curNum+1, primeList:+curNum) | |
else getPrimeList(orgNum, curNum+1, primeList) | |
} | |
def getAnsByPListNum(tNum:Int, sNum:Int = 2, cSum:Int = 1) : Int = { |
object Euler_011 extends App { | |
val RAW_DATA = """ | |
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 | |
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 | |
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65 | |
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91 | |
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80 | |
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50 | |
32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70 | |
67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21 |
object Euler_010 extends App { | |
def sumPrimeList(pList:List[Int], pSum:Long = 0):Long = { | |
// println(pList.length) | |
if(pList.length equals 0) return pSum | |
sumPrimeList(pList.filterNot(n => n%pList.head equals 0), pSum+pList.head) | |
} | |
sumPrimeList((2 to 10).toList) | |
sumPrimeList((2 to 2000000).toList) | |
} |
import Math._ | |
print((for(a <-1 to 1000; b <- 1 to 1000; c <- 1 to 1000; if a<b; if b<c; if a+b+c equals 1000; if pow(a,2)+pow(b,2) equals pow(c,2)) yield (a*b*c)).toList(0)) |
//http://euler.synap.co.kr/prob_detail.php?id=8 | |
//여기서 붉게 표시된 71112의 경우 7, 1, 1, 1, 2 각 숫자를 모두 곱하면 14가 됩니다. | |
//이런 식으로 맨 처음 (7 × 3 × 1 × 6 × 7 = 882) 부터 맨 끝 (6 × 3 × 4 × 5 × 0 = 0) 까지 5자리 숫자들의 곱을 구할 수 있습니다. | |
//이렇게 구할 수 있는 5자리 숫자의 곱 중에서 가장 큰 값은 얼마입니까? | |
object Euler_008 extends App { | |
val RAW_STR = """ | |
73167176531330624919225119674426574742355349194934 | |
96983520312774506326239578318016984801869478851843 | |
85861560789112949495459501737958331952853208805511 | |
12540698747158523863050715693290963295227443043557 |
//소수를 크기 순으로 나열하면 2, 3, 5, 7, 11, 13, ... 과 같이 됩니다. | |
// 이 때 10,001번째의 소수를 구하세요. | |
object Euler_007 extends App { | |
def isPrimeNum(targetNum:Int, startNum:Int = 2):Boolean = { | |
if (startNum equals targetNum) return true | |
if (targetNum % startNum == 0) return false | |
else isPrimeNum(targetNum, startNum+1) | |
} | |
def getSpePrimeNum(targetCount:Int, curNum:Int = 2, count:Int = 0):BigInt = { |