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
| #project euler problem 8 | |
| #auther @iizukak | |
| def findMaxProd(numstr): | |
| n = map((lambda x: int(x)), numstr) | |
| ans = 0 | |
| for i in range(len(n) - 4): | |
| tmp = n[i] * n[i + 1] * n[i + 2] * n [i + 3] * n[i + 4] | |
| if ans < tmp: | |
| ans = tmp |
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
| #project euler problem 9 | |
| #auther @iizukak | |
| def pitag(): | |
| for a in range(1, 1001): | |
| for b in range(1, 1001): | |
| for c in range(1, 1001): | |
| if a + b + c == 1000: | |
| if a ** 2 + b ** 2 == c ** 2: | |
| return a * b * 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
| #project euler problem 10 | |
| #auther @iizukak | |
| #Sieve of Eratosthenes | |
| #Find primes under n | |
| def sieve(n): | |
| primes = [] | |
| table = [0 for i in range(n+1)] | |
| for i in range(2, n+1): |
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
| #project euler problem 12 | |
| #auther @iizukak | |
| #素因数分解する関数(試し割り法) | |
| def fact(n): | |
| ans = [] | |
| sq = n ** 0.5 | |
| i = 2 | |
| while n != 1: | |
| if i > sq: |
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
| #project euler problem 13 | |
| #http://projecteuler.net/problem=13 | |
| #auther @iizukak | |
| import sys | |
| ans = 0 | |
| for line in sys.stdin: | |
| ans = ans + int(line) |
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
| 75 | |
| 95 64 | |
| 17 47 82 | |
| 18 35 87 10 | |
| 20 04 82 47 65 | |
| 19 01 23 75 03 34 | |
| 88 02 77 73 07 63 67 | |
| 99 65 04 28 06 16 70 92 | |
| 41 41 26 56 83 40 80 70 33 | |
| 41 48 72 33 47 32 37 16 94 29 |
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
| #project euler problem 20 | |
| #http://projecteuler.net/problem=20 | |
| #auther @iizukak | |
| #100!の各桁を足す問題 | |
| def fact(n): | |
| if n == 2: | |
| return 2 | |
| else: | |
| return n * fact(n-1) |
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
| #project euler problem 21 | |
| #http://projecteuler.net/problem=21 | |
| #auther @iizukak | |
| #10000以下の友愛数の和を求める | |
| def finddiv(n): | |
| ans = [0] | |
| for i in range(1, n+1): | |
| tmp = 0 |
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
| L = ["MARY","PATRICIA","LINDA","BARBARA","ELIZABETH","JENNIFER","MARIA","SUSAN","MARGARET","DOROTHY","LISA","NANCY","KAREN","BETTY","HELEN","SANDRA","DONNA","CAROL","RUTH","SHARON","MICHELLE","LAURA","SARAH","KIMBERLY","DEBORAH","JESSICA","SHIRLEY","CYNTHIA","ANGELA","MELISSA","BRENDA","AMY","ANNA","REBECCA","VIRGINIA","KATHLEEN","PAMELA","MARTHA","DEBRA","AMANDA","STEPHANIE","CAROLYN","CHRISTINE","MARIE","JANET","CATHERINE","FRANCES","ANN","JOYCE","DIANE","ALICE","JULIE","HEATHER","TERESA","DORIS","GLORIA","EVELYN","JEAN","CHERYL","MILDRED","KATHERINE","JOAN","ASHLEY","JUDITH","ROSE","JANICE","KELLY","NICOLE","JUDY","CHRISTINA","KATHY","THERESA","BEVERLY","DENISE","TAMMY","IRENE","JANE","LORI","RACHEL","MARILYN","ANDREA","KATHRYN","LOUISE","SARA","ANNE","JACQUELINE","WANDA","BONNIE","JULIA","RUBY","LOIS","TINA","PHYLLIS","NORMA","PAULA","DIANA","ANNIE","LILLIAN","EMILY","ROBIN","PEGGY","CRYSTAL","GLADYS","RITA","DAWN","CONNIE","FLORENCE","TRACY","EDNA","TIFFANY","CARMEN","ROSA","CINDY","GRACE","WENDY","VICTO |
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
| (define multirember | |
| (lambda (a lat) | |
| (cond | |
| ((null? lat) (quote ())) | |
| (else | |
| (cond | |
| ((eq? (car lat) a) | |
| (multirember a (cdr lat))) | |
| (else (cons (car lat) | |
| (multirember a |