Geeks With Blogs
Micah's Blog Another Subtext Powered Blog January 2008 Entries
Pythagorean Triplets Part 2
I have updated my pythagorean triplets code. private Image GeneratePythagoreanTripleVi... imageSize) { int size = imageSize - 1; int limit = (int)Math.Ceiling(Math.Sqrt... * size * 2)); Func<int, int, int> greatestCommonDivisor = null; greatestCommonDivisor = (x, y) => x % y == 0 ? y : greatestCommonDivisor(y, x % y); Bitmap triplesImage = new Bitmap(imageSize, imageSize); var perfectSquares = from n in Enumerable.Range(1, limit) select n * n; HashSet<int> perfectSquareSet ......

Posted On Wednesday, January 30, 2008 2:00 PM

Pythagorean Triplets Visualization
One of the examples for my CHADNUG talk is a function to generate an image that represents Pythagorean triplets. private Image GeneratePythagoreanTripleVi... imageSize) { int size = imageSize - 1; int limit = (int)Math.Ceiling(Math.Sqrt... * size * 2)); Bitmap triplesImage = new Bitmap(imageSize, imageSize); var perfectSquares = from n in Enumerable.Range(1, limit) select n * n; HashSet<int> perfectSquareSet = new HashSet<int>(); perfectSquares.ToList().For... => perfectSquareSet.Add(x)); ......

Posted On Saturday, January 26, 2008 12:54 PM

Copyright © Blog Author | Powered by: GeeksWithBlogs.net