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
#!/usr/bin/env python3.2 | |
import csv | |
import datetime | |
import glob | |
import io | |
import os | |
import os.path | |
import sys | |
import tempfile |
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
#!/usr/bin/env ruby1.9 | |
# Project Euler, Problem 14 | |
# | |
# The following iterative sequence is defined for the set of positive | |
# integers: | |
# | |
# n -> n / 2 (n is even) | |
# n -> 3n + 1 (n is odd) | |
# |
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 14 | |
The following iterative sequence is defined for the set of positive | |
integers: | |
n -> n / 2 (n is even) | |
n -> 3n + 1 (n is odd) | |
Using the rule above and starting with 13, we generate the following |
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
#!/usr/bin/env ruby1.9 | |
# Project Euler, Problem 52 | |
# | |
# It can be seen that the number 125874, and its double, 251748, contain | |
# exactly the same digits, but in a different order. | |
# | |
# Find the smallest positive integer x such that 2x, 3x, 4x, 5x, and 6x | |
# contain the same digits. | |
# |
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
#!/usr/bin/env ruby1.9 | |
# Project Euler, Problem 12 | |
# | |
# The sequence of triangle numbers is generated by adding the natural | |
# numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = | |
# 28. The first ten terms would be: | |
# | |
# 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... | |
# |
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 97 | |
-- | |
-- ========== | |
-- The first known prime found to exceed one million digits was discovered | |
-- in 1999, and is a Mersenne prime of the form 2^6972593 - 1; it contains | |
-- exactly 2,098,960 digits. Subsequently other Mersenne primes, of the | |
-- form 2^p - 1, have been found which contain more digits. | |
-- | |
-- However, in 2004 there was found a massive non-Mersenne prime which | |
-- contains 2,357,207 digits: 28433 * 2^7830457 + 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 48 | |
-- | |
-- ========== | |
-- The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317. | |
-- | |
-- Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. | |
-- ========== | |
-- | |
-- Lawrence Velazquez | |
-- 13 June 2011 |
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
class Integer | |
def to_binary_s(n) | |
(n - 1).downto(0).inject("") {|str, i| str << self[i].to_s} | |
end | |
end |
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
#!/usr/bin/env ruby1.9 | |
# Project Euler, Problem 36 | |
# | |
# The decimal number, 585 = 1001001001 (binary), is palindromic in both | |
# bases. | |
# | |
# Find the sum of all numbers, less than one million, which are palindromic | |
# in base 10 and base 2. | |
# |
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
#!/usr/bin/env ruby1.9 | |
# Project Euler, Problem 57 | |
# | |
# It is possible to show that the square root of two can be expressed as an | |
# infinite continued fraction. | |
# | |
# sqrt(2) = 1 + 1/(2 + 1/(2 + 1/(2 + ...))) = 1.414213... | |
# | |
# By expanding this for the first four iterations, we get: |
OlderNewer