using System;using System.Collections.Generic;using System.IO;namespace IntegerFactorisation{ public class TheEnd { public static string path = "";//PUT YOUR FILE PATH HERE public static Dictionary<int, Dictionary<int, List<string>>theend = new Dictionary<int, Dictionary<int, List<string>>>(); public static void CreateTheEnd(int i_max = 512, int x_min = 0, int y_min = 0, int x_max = 64, int y_max = 64) { for (int i = 0; i < i_max; i++) { for (int j = 0; j < i; j++) { int a = i - j; int b = i + j; int c = a * b; bool odd = c % 2 == 1; int d = (int)Math.Sqrt(c); int e = c - (d * d); int f = e - ((2 * d) + 1); int n = i - d; int x = d - a; if (!theend.ContainsKey(e)) theend[e] = new Dictionary<int, List<string>>(); if (!theend[e].ContainsKey(n)) { theend[e][n] = new List<string>(); } if (!theend.ContainsKey(f)) theend[f] = new Dictionary<int, List<string>>(); if (!theend[f].ContainsKey(n - 1)) theend[f][n - 1] = new List<string>(); string text = "{" + string.Format("{0}:{1}:{2}:{3}:{4}:{5}", e, n, d, x, a, b) + "}"; theend[e][n].Add(text); text = "{" + string.Format("{0}:{1}:{2}:{3}:{4}:{5}", f, n - 1, d + 1, x + 1, a, b) + "}"; theend[f][n - 1].Add(text); } } } public static void Output(int i_max = 256, int x_min = -64, int y_min = 0, int x_max = 64, int y_max = 64, int set_size = 12) { TextWriter tw = File.CreateText(path + "output.csv"); for (int y = 0; y < y_max; y++) { for (int z = 0; z < set_size; z++) { for (int x = x_min; x < x_max; x++) { if (theend.ContainsKey(x) && theend[x].ContainsKey(y) && theend[x][y].Count > z) { tw.Write(theend[x][y][z] + ","); } else { tw.Write(","); } } tw.WriteLine(""); } } tw.Close(); } }}
You will have no other gods before me