public void TestLimitOfPatternElevationLemma() { UInt32 max = 5; UInt32[] previousPattern = PatternResearch.CreatePrimeIntervalPattern(1); for (UInt32 i = 2; i <= max; i++) { Console.WriteLine("At Prime Index {0} (PrimeValue {1})", i, PrimeTable.Values[i]); UInt32[] currentPattern = PatternResearch.CreatePrimeIntervalPattern(i); UInt32 sum = 1 + currentPattern[0]; // Verify first Assert.AreEqual(currentPattern[0], previousPattern[0] + previousPattern[1]); //Console.WriteLine(currentPattern[0]); for (int j = 2; j < previousPattern.Length; j++) { if (currentPattern[j - 1] != previousPattern[j]) { Console.WriteLine("Mismatch at value {0}: sequence index {1} ({2} != {3})", sum, j - 1, currentPattern[j - 1], previousPattern[j]); break; } sum += currentPattern[j - 1]; } previousPattern = currentPattern; } }
void PrettyFormatPrintCoprimeIntervalPatterns(UInt32 maxPrimeIndex) { UInt32[] pattern = PatternResearch.CreatePrimeIntervalPattern(maxPrimeIndex); Console.Write("MaxPrime {0,6}: ", PrimeTable.Values[maxPrimeIndex]); for (Int32 i = 0; i < pattern.Length; i++) { Console.Write("{0,5}", pattern[i]); } Console.WriteLine(); }
public void AnalyzeDifferenceInCoprimeIntervalSequences() { UInt32 max = 5; UInt32[] previousPattern = PatternResearch.CreatePrimeIntervalPattern(1); for (UInt32 i = 2; i <= max; i++) { Console.WriteLine("At Prime Index {0} Value {1}", i, PrimeTable.Values[i]); UInt32 totalValuesKnockedOutFromPreviousSequence = 0; UInt32[] currentPattern = PatternResearch.CreatePrimeIntervalPattern(i); UInt32 previousPatternIndex = 0; UInt32 currentPatternIndex = 0; while (currentPatternIndex < currentPattern.Length) { UInt32 currentPatternInterval = currentPattern[currentPatternIndex++]; if (currentPatternInterval == previousPattern[previousPatternIndex]) { previousPatternIndex++; if (previousPatternIndex >= previousPattern.Length) { previousPatternIndex = 0; } } else { // Find the sum of the previous patterns UInt32 previousPatternIntervalSum = previousPattern[previousPatternIndex]; while (true) { previousPatternIndex++; if (previousPatternIndex >= previousPattern.Length) { previousPatternIndex = 0; } previousPatternIntervalSum += previousPattern[previousPatternIndex]; totalValuesKnockedOutFromPreviousSequence++; if (previousPatternIntervalSum > currentPatternInterval) { throw new InvalidOperationException(String.Format( "previousPatternIntervalSum {0} is greater than currentPatternInterval {1}", previousPatternIntervalSum, currentPatternInterval)); } if (previousPatternIntervalSum == currentPatternInterval) { //Console.WriteLine("CurrentPattern knocked out {0} numbers from previous pattern", sumValueCount); previousPatternIndex++; if (previousPatternIndex >= previousPattern.Length) { previousPatternIndex = 0; } break; } } } } Console.WriteLine("CurrentPattern knocked out {0} numbers from previous pattern", totalValuesKnockedOutFromPreviousSequence); previousPattern = currentPattern; } }