This file contains 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
// A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. | |
// Find the largest palindrome made from the product of two 3-digit numbers. | |
// https://projecteuler.net/problem=4 | |
void Main() | |
{ | |
// xyz * XYZ = abccba | |
foreach (var p in sixDigitPalindroms()) | |
{ | |
foreach (var prm in permutationsOf(dividersOf(p)).Distinct(new Cmp())) | |
{ |
This file contains 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
// 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. | |
// What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? | |
// https://projecteuler.net/problem=5 | |
void Main() | |
{ | |
var bop = new BagOfPrimes(); | |
Enumerable.Range(1, 20) | |
.Select(d=>dividersOf(d).GroupBy(_=>_).Aggregate(bop, (c,n) => c.add(n)).value) | |
.Dump(); |
This file contains 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
// By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13 | |
// What is the 10 001st prime number? | |
// https://projecteuler.net/problem=7 | |
void Main() | |
{ | |
var knownPrimes = new List<int>(new int[] { 2 }); | |
int N = 3; | |
while (knownPrimes.Count() < 10001) | |
{ |
This file contains 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
// https://projecteuler.net/problem=8 | |
var N = @" | |
73167176531330624919225119674426574742355349194934 | |
96983520312774506326239578318016984801869478851843 | |
85861560789112949495459501737958331952853208805511 | |
12540698747158523863050715693290963295227443043557 | |
66896648950445244523161731856403098711121722383113 | |
62229893423380308135336276614282806444486645238749 | |
30358907296290491560440772390713810515859307960866 | |
70172427121883998797908792274921901699720888093776 |
This file contains 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
//https://projecteuler.net/problem=9 | |
void Main() | |
{ | |
int P = 1000; | |
var t = Enumerable.Range(1,P) | |
.Select(a => possibleBC(a, P)) | |
.SelectMany(_ => _) | |
.Where(_=>_.Item2*_.Item2+_.Item3*_.Item3==_.Item1*_.Item1) | |
.First(); |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am maxint137 on github. | |
* I am maxint (https://keybase.io/maxint) on keybase. | |
* I have a public key ASCrzuZRguTE-KNFEFGqp0M6RGR8pYeTYmHA2-wNrYd2nAo | |
To claim this, I am signing this object: |
This file contains 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 projecteuler018 | |
{ | |
void parseRawData() | |
{ | |
istringstream iss{ rawdata }; | |
string row; | |
int i{}; | |
while(getline(iss, row, '\n')) | |
{ |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>SVG in HTML</title> | |
<style> | |
body { | |
font-family: cursive; | |
} | |
circle { |
This file contains 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
void Main() | |
{ | |
var n0 = new Node<string>("n0", null); | |
var n1 = new Node<string>("n1", null); | |
var n2 = new Node<string>("n2", null); | |
var n3 = new Node<string>("n3", null); | |
var n4 = new Node<string>("n4", null); | |
var n5 = new Node<string>("n5", null); | |
var n6 = new Node<string>("n6", null); | |
var n7 = new Node<string>("n7", null); |
This file contains 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
void Main() | |
{ | |
int N = 8; | |
var nodes = new List<Node>(N + 1); | |
foreach (var n in Enumerable.Range(0, N + 1)) | |
{ | |
nodes.Add(new Node($"n{n}", null)); | |
} | |
nodes[1].setNodes(new Node[] { nodes[2] }); |
OlderNewer