public override object Run(RunModes runMode, object input, bool Logging) { var multPermutation = (int) input; var start = 1; while(true) { if (start.ToString().Length != (start * multPermutation).ToString().Length) { start = (int) Math.Pow(10, start.ToString().Length); continue; } if (!start.ToString().Any(c => c == '5' || c == '0')) { start++; continue; } if (!Permutations.UniqueDigits(start)) { start++; continue; } var permutations = Permutations.Generate(start); var missingMultiple = false; for (int i = 1; i <= multPermutation; i++) { if (!permutations.Contains(start*i)) { missingMultiple = true; break; } } if (!missingMultiple) return start; start++; } }
public override object Run(RunModes runMode, object input, bool Logging) { Primes.InitPrimes(500); List <string> pandigitals = Permutations.Generate("9876543210").ToList(); List <string> pandigitalsIndexProperty = new List <string>(); bool notIndexProperty = false; foreach (var pandigital in pandigitals) { notIndexProperty = false; for (int i = 0; i < 7; i++) { if (Int64.Parse(pandigital.Substring(i + 1, 3)) % Primes.AllPrimes[i] != 0) { notIndexProperty = true; break; } } if (!notIndexProperty) { pandigitalsIndexProperty.Add(pandigital); } } var bigIntList = pandigitalsIndexProperty.Select(item => new BigInt(item)).ToList(); return(new BigInt("").SumBigIntNumbers(bigIntList).Value); }
public override object Run(RunModes runMode, object input, bool Logging) { Primes.InitPrimes((long)Math.Sqrt(987654321)); List <long> permutations = Permutations.Generate(123456789).OrderByDescending(item => item).ToList(); foreach (long permutation in permutations) { if (Primes.AllPrimes.All(item => (permutation != item && permutation % item != 0) || permutation == item)) { return(permutation); } } permutations = Permutations.Generate(12345678).OrderByDescending(item => item).ToList(); foreach (long permutation in permutations) { if (Primes.AllPrimes.All(item => (permutation != item && permutation % item != 0) || permutation == item)) { return(permutation); } } permutations = Permutations.Generate(1234567).OrderByDescending(item => item).ToList(); foreach (long permutation in permutations) { if (Primes.AllPrimes.All(item => (permutation != item && permutation % item != 0) || permutation == item)) { return(permutation); } } return(1); }
public override object Run(RunModes runMode, object input, bool Logging) { var upperLimit = (int)input; int repeatingTermLength = 0; int MaxTerm = 0; for (int i = 1; i <= upperLimit; i++) { var repeating = CalcLongDivision(new LongDivisionMember(1, i)); LongDivisionResult = LongDivisionResult.Insert(1, "."); if (repeating) { var repeatingTerm = LongDivisionCache.Last(); var firstRepeatingIndex = LongDivisionCache.IndexOf(repeatingTerm); LongDivisionResult = LongDivisionResult.Insert(firstRepeatingIndex + 2, "("); LongDivisionResult += ")"; if (LongDivisionCache.Count - 1 - firstRepeatingIndex > repeatingTermLength) { repeatingTermLength = LongDivisionCache.Count; MaxTerm = i; } } if (Logging) { Console.WriteLine(String.Format("{0}->{1}", i, LongDivisionResult)); } LongDivisionResult = LongDivisionSeed; LongDivisionCache.Clear(); } return(MaxTerm); }
public override object Run(RunModes runMode, object input, bool Logging) { Primes.InitPrimes((long)input); var primes = Primes.AllPrimes.Where(p => { var s = p.ToString(); return(!s.Contains("0") && !s.Contains("2") && !s.Contains("4") && !s.Contains("6") && !s.Contains("8")); }).ToList(); primes.Insert(0, 2); foreach (long prime in primes) { if (CircularPrimes.Contains(prime)) { continue; } var permutations = Permutations.GenerateRotations(prime).Distinct(); var addPrime = permutations.All(Primes.IsPrime); if (addPrime) { CircularPrimes.AddRange(permutations); } } return(CircularPrimes.Count); }
public override object Run(RunModes runMode, object input, bool Logging) { for (int i = 10; i < 100; i++) { for (int j = i + 1; j < 100; j++) { var numDigit1 = i / 10; var numDigit2 = i % 10; var denomDigit1 = j / 10; var denomDigit2 = j % 10; if ((numDigit1 == denomDigit2 && denomDigit1 != 0 && (double)numDigit2 / (double)denomDigit1 == (double)i / (double)j) || (numDigit2 == denomDigit1 && denomDigit2 != 0 && (double)numDigit1 / (double)denomDigit2 == (double)i / (double)j) || (numDigit2 == denomDigit2 && denomDigit1 != 0 && (double)numDigit1 / (double)denomDigit1 == (double)i / (double)j && numDigit2 != 0)) { WeirdFractions.Add(new Fraction(i, j)); } } } var numerator = WeirdFractions.Aggregate((BigInteger)1, (product, item) => product * item.Numerator); var denominator = WeirdFractions.Aggregate((BigInteger)1, (product, item) => product * item.Denominator); var gcd = GreatestCommonDenominator.Get(new List <BigInteger> { numerator, denominator }); return(denominator / gcd); }
public override object Run(RunModes runMode, object input, bool Logging) { var currentSeed = 345; while (true) { var nextSeed = SeedCubes(currentSeed); var foundPermsMaster = CubesDictionary[currentSeed].ToList(); foreach (var cube in CubesDictionary[currentSeed]) { var count = 0; var foundPerms = new List <long>(); foreach (var cube2 in foundPermsMaster) { if (Permutations.IsPermutations(cube, cube2) && !foundPerms.Contains(cube)) { count++; foundPerms.Add(cube); } if (count == 5) { return(cube); } } foundPermsMaster.RemoveAll(foundPerms.Contains); } currentSeed = nextSeed; } }
private void LoadConfigured() { mode = RunModes.WorkingDirectory; prompt = ">"; Reload(); }
public override object Run(RunModes runMode, object input, bool Logging) { int runAndNumberDistinctPrimeFactors = (int) input; Primes.InitPrimes(); int i = 2; int startRun = 0; int runCount = 0; while (true) { if (Primes.UniquePrimeFactors(i, false).Count() == runAndNumberDistinctPrimeFactors) { if (runCount == 0) startRun = i; runCount++; } else { startRun = 0; runCount = 0; } if (runCount == runAndNumberDistinctPrimeFactors) return startRun; i++; } }
public override object Run(RunModes runMode, object input, bool Logging) { var upperLimit = (int)input; long maxSeed = 0; long maxChain = 0; for (long i = 1; i < upperLimit; i++) { long temp = ChainLength(i, Logging); if (temp > maxChain) { maxChain = temp; maxSeed = i; } if (Logging) { Console.Write(String.Format(":{0}", temp)); Console.WriteLine(); } } if (Logging) { Console.WriteLine(); Console.WriteLine(); } return(maxSeed); }
public override object Run(RunModes runMode, object input, bool Logging) { int replacePrimeFamilyCount = (int)input; Primes.InitPrimes(); Primes.TrimPrimes(9, 1000000); var primeList = Primes.AllPrimes.OrderBy(p=>p); int primeInitLength = 0; foreach (var start in primeList) { var stringStart = start.ToString(); var stringStartLength = stringStart.Length; if (stringStartLength > primeInitLength) { Primes.InitPrimes((long) Math.Pow(10, stringStartLength)); Primes.TrimPrimes((long) (Math.Pow(10, stringStartLength - 1)-1), (long) Math.Pow(10, stringStartLength)); primeInitLength = stringStartLength; } for (int indecesToReplace = 1; indecesToReplace < stringStartLength; indecesToReplace++) { var indeces = Combinations.ChooseStringIndeces(indecesToReplace, stringStartLength); foreach (var index in indeces) { var permutations = Permutations.GenerateReplacements(stringStart, index); if (permutations.Count() >= replacePrimeFamilyCount && permutations.Count(Primes.IsPrime) >= replacePrimeFamilyCount) return permutations.Min(); } } } return 0; }
public override object Run(RunModes runMode, object input, bool Logging) { int replacePrimeFamilyCount = (int)input; Primes.InitPrimes(); Primes.TrimPrimes(9, 1000000); var primeList = Primes.AllPrimes.OrderBy(p => p); int primeInitLength = 0; foreach (var start in primeList) { var stringStart = start.ToString(); var stringStartLength = stringStart.Length; if (stringStartLength > primeInitLength) { Primes.InitPrimes((long)Math.Pow(10, stringStartLength)); Primes.TrimPrimes((long)(Math.Pow(10, stringStartLength - 1) - 1), (long)Math.Pow(10, stringStartLength)); primeInitLength = stringStartLength; } for (int indecesToReplace = 1; indecesToReplace < stringStartLength; indecesToReplace++) { var indeces = Combinations.ChooseStringIndeces(indecesToReplace, stringStartLength); foreach (var index in indeces) { var permutations = Permutations.GenerateReplacements(stringStart, index); if (permutations.Count() >= replacePrimeFamilyCount && permutations.Count(Primes.IsPrime) >= replacePrimeFamilyCount) { return(permutations.Min()); } } } } return(0); }
public override object Run(RunModes runMode, object input, bool Logging) { Primes.InitPrimes((long)input); var maxRunCount = 0; long maxPrime = 0; var orderedPrimes = Primes.AllPrimes.OrderBy(p => p).ToList(); for (int i = 1; i < orderedPrimes.Count; i++) { for (int j = 0; j < Math.Min(orderedPrimes.Count, 4); j++) { var runCount = 0; long runSum = 0; var k = j; while (true) { runSum += orderedPrimes[k]; runCount++; if (runSum == orderedPrimes[i]) { if (runCount > maxRunCount) { maxRunCount = runCount; maxPrime = runSum; } break; } if (runSum > orderedPrimes[i]) { break; } k++; } } } if (Logging) Console.WriteLine(maxRunCount); return maxPrime; }
public override object Run(RunModes runMode, object input, bool Logging) { int runAndNumberDistinctPrimeFactors = (int)input; Primes.InitPrimes(); int i = 2; int startRun = 0; int runCount = 0; while (true) { if (Primes.UniquePrimeFactors(i, false).Count() == runAndNumberDistinctPrimeFactors) { if (runCount == 0) { startRun = i; } runCount++; } else { startRun = 0; runCount = 0; } if (runCount == runAndNumberDistinctPrimeFactors) { return(startRun); } i++; } }
public override object Run(RunModes runMode, object input, bool Logging) { Primes.InitPrimes(); int i = 9; while (true) { bool foundOddComposite = false; if (Primes.IsPrime(i)) { i += 2; continue; } long sqrt = (long)Math.Sqrt(i); for (int j = 1; j < sqrt; j++) { long diff = i - 2 * j * j; if (Primes.IsPrime(diff)) { foundOddComposite = true; break; } } if (!foundOddComposite) { return(i); } i += 2; } }
private void LoadSpecific(string grammar) { mode = RunModes.SpecifiedManifest; grammarSource = grammar; prompt = grammar.Split(Path.DirectorySeparatorChar).Last() + " >"; Reload(); }
public EventWeak(Action arg) { targetObject = new WeakReference(arg.Target); methodInfo = arg.Method; methodParmCount = 0; RunMode = RunModes.Sync; }
private void Animate() { runmode = RunModes.run; toolbarMode(); cpuview.Lock(); rundelay.Enabled = true; rundelay.Start(); }
public EventWeak(Func <Task> arg) { targetObject = new WeakReference(arg.Target); methodInfo = arg.Method; methodParmCount = 0; RunMode = RunModes.Async; }
/// <summary> /// Creates an instance of the rule that applies /// to a specfic property. /// </summary> /// <param name="primaryProperty">Primary property for this rule.</param> protected BusinessRuleBase(Csla.Core.IPropertyInfo primaryProperty) { AffectedProperties = new List <Core.IPropertyInfo>(); InputProperties = new List <Core.IPropertyInfo>(); PrimaryProperty = primaryProperty; this.RuleUri = new RuleUri(this, primaryProperty); RunMode = RunModes.Default; }
public override object Run(RunModes runMode, object input, bool Logging) { if (Logging) { ((IntegerTree)input).PrintTree(); } return(((IntegerTree)input).FindMaxSum(Logging)); }
public EventWeak(Action <T> arg, T parm) { targetObject = new WeakReference(arg.Target); methodInfo = arg.Method; methodParmCount = 1; methodParm = parm; RunMode = RunModes.Sync; }
private void Stop() { btAnimate.Pushed = false; runmode = RunModes.stopped; toolbarMode(); cpuview.Unlock(); rundelay.Stop(); rundelay.Enabled = false; machine.stopped = true; }
public EventWeak(Func <T, S, Task> arg, T parm1, S parm2) { targetObject = new WeakReference(arg.Target); methodInfo = arg.Method; methodParmCount = 2; methodParm1 = parm1; methodParm2 = parm2; RunMode = RunModes.Async; }
public override object Run(RunModes runMode, object input, bool Logging) { int triangleIndex = 1; var numberOfDivisors = (int) input; while (!HasAtLeastNumberOfDivisors(numberOfDivisors, GenerateTriangle(triangleIndex))) { triangleIndex++; } return GenerateTriangle(triangleIndex); }
public override object Run(RunModes runMode, object input, bool Logging) { return(FindIndex(1) * FindIndex(10) * FindIndex(100) * FindIndex(1000) * FindIndex(10000) * FindIndex(100000) * FindIndex(1000000)); }
public EventWeak(Func <T, Task> arg) { targetObject = new WeakReference(arg.Target); methodInfo = arg.Method; methodParmCount = 0; RunMode = RunModes.Async; taginfo = arg.Target.GetType().FullName + "---" + arg.Target.ToString(); }
public override object Run(RunModes runMode, object input, bool Logging) { var sum = 0; for(int i = 0;i<1000000;i++){ if( Palindrome.IsPalindrome(i.ToString())) if(Palindrome.IsPalindrome(ConvertToBase(i,2))) sum+=i; } return sum; }
public override object Run(RunModes runMode, object input, bool Logging) { int triangleIndex = 1; var numberOfDivisors = (int)input; while (!HasAtLeastNumberOfDivisors(numberOfDivisors, GenerateTriangle(triangleIndex))) { triangleIndex++; } return(GenerateTriangle(triangleIndex)); }
public override object Run(RunModes runMode, object input, bool Logging) { int pandigitalCheckAmount = (int)input; for (int i = 1; i < 98; i++) { for (int j = 123; j < 9876; j++) { var check = new Pandigital.PandigitalWrapper(i, j, i * j, 9); if (check.IsPandigital() && !Pandigitals.Contains(check.Product)) Pandigitals.Add(check.Product); } } return Pandigitals.Sum(); }
public override object Run(RunModes runMode, object input, bool Logging) { int upperLimit = (int) input; BigInt.MaxIndex = 9; BigInt sumSquares = new BigInt(""); for (int i = 1; i <= upperLimit; i++) { BigInt prod = BigInt.Exp(i, i); sumSquares = sumSquares.SumBigIntNumbers(new List<BigInt>{sumSquares, prod}); } return sumSquares.Value; }
private static void Main(string[] args) { RunModes mode = RunModes.Gui; if (args == null || args.Length > 0) { if (System.IO.File.Exists(args[0])) { mode = RunModes.Unattended; } else { Console.WriteLine( "The path to a script file '" + args[0] + "' is not valid."); } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (mode == RunModes.Unattended) { var runnerForm = new UiaRunnerForm(); TestRunner.InitScript(); TestData.TmxNewTestResultClosed += new TmxStructureChangedEventHandler( TestRunner.NewTestResultClosed); Runner.PSErrorThrown += runnerForm.PSStateErrorThrown; Runner.PSOutputArrived += runnerForm.PSOutputArrived; TestRunner.RunScript(args[0], true); /* * TestRunner.InitScript(); * TestData.TmxNewTestResultClosed += * new Tmx.TmxStructureChangedEventHandler( * PSTestRunner.TestRunner.NewTestResultClosed); * Runner.PSErrorThrown += * new PSRunner.PSStateChangedEventHandler( * runnerForm.PSStateErrorThrown); * Runner.PSOutputArrived += * new PSRunner.PSDataArrivedEventHandler( * runnerForm.PSOutputArrived); * TestRunner.RunScript(args[0], true); */ } else { Application.Run(new UiaRunnerForm()); } }
public override object Run(RunModes runMode, object input, bool Logging) { int total = (int)input; int combinations = 0; foreach (BritishCurrency bc in currencies) { combinations += GetCombinations(total, bc, Logging); } return(combinations); }
public override object Run(RunModes runMode, object input, bool Logging) { long sigmaX = 1; long sigma_XSquared = 1; var limit = (int)input; for (int i = 2; i <= limit; i++) { sigma_XSquared += (long)Math.Pow(i, 2); sigmaX += i; } return(((long)Math.Pow(sigmaX, 2)) - sigma_XSquared); }
private void Start() { machine.stopped = false; runmode = RunModes.start; toolbarMode(); while (runmode == RunModes.start && machine.stopped == false) { machine.stepcpu(); Application.DoEvents(); } Stop(); updateForms(); }
public override object Run(RunModes runMode, object input, bool Logging) { var signs = new List <int> { 1, -1 }; var max = (int)input; Primes.InitPrimes(max); var bPrimes = Primes.AllPrimes; var maxIndex = 0; var maxProduct = new QuadraticCoefficients(0, 0); Primes.InitPrimes(80 * 80 + 80 * 1000 + 1000); var SquareHash = new Dictionary <int, long>(); for (int i = 0; i <= max; i++) { SquareHash.Add(i, (long)Math.Pow(i, 2)); } for (int a = -1 * max + 1; a < max; a += 2) { foreach (var prime in bPrimes) { foreach (var sign in signs) { var b = prime * sign; bool isPrime; var tempIndex = 0; do { var quad = SquareHash[tempIndex] + tempIndex * a + b; tempIndex++; isPrime = Primes.IsPrime(quad); } while (isPrime); if (tempIndex > maxIndex) { maxIndex = tempIndex; maxProduct = new QuadraticCoefficients(a, (int)b); } } } } if (Logging) { Console.WriteLine(String.Format("{0}:{1}", maxProduct.A, maxProduct.B)); } return(maxProduct.A * maxProduct.B); }
public override object Run(RunModes runMode, object input, bool Logging) { var upperLimit = (int) input; var distinctExponentials = new List<BigInt>(); for (int a = 2; a <= upperLimit; a++) { var bigIntA = new BigInt(a.ToString()); for (int b = 2; b <= upperLimit; b++) { bigIntA = bigIntA.Product(a); distinctExponentials.Add(bigIntA); } } return distinctExponentials.Distinct().Count(); }
public override object Run(RunModes runMode, object input, bool Logging) { var fibUpperLimit = new BigInt("9", (int)input); var fibSequence = Fibonacci.Sequence(fibUpperLimit).ToList(); if (Logging) { foreach (var i in fibSequence) { Console.WriteLine(i); } } return(fibSequence.IndexOf(fibSequence.First(item => item.Value.Length == (int)input)) + 1); }
public override object Run(RunModes runMode, object input, bool Logging) { int minIndex = (int)input + 1; while (true) { long tri = Triangle.Generate(minIndex); if (Pentagonal.IsPentagonal(tri) && Hexagonal.IsHexagonal(tri)) { return(tri); } minIndex++; } }
public override object Run(RunModes runMode, object input, bool Logging) { var eulerProblem053Input = (EulerProblem053Input)input; var upperLimit = eulerProblem053Input.UpperLimit; var retValue = 0; for (int i = 1; i <= upperLimit; i++) { for (int j = 1; j <= i; j++) { if (Combinations.CombinationsAreGreater(i, j, eulerProblem053Input.Threshold)) retValue++; } } return retValue; }
public override object Run(RunModes runMode, object input, bool Logging) { double percentage = (double)input; long primeCount = 0; long diagonalCount = 1; int layer = 0; do { layer++; AddLayer(ref primeCount, ref diagonalCount, layer, Logging); } while ((double) primeCount/(double) diagonalCount*100.0 >= percentage); return layer*2 + 1; }
public override object Run(RunModes runMode, object input, bool Logging) { var sum = 0; var upperLimit = (int) input; for (int j = 1; j <= upperLimit; j++) { var temp = GetNumberWordLength(j, Logging); if (Logging) { Console.Write(":{0}", temp); Console.WriteLine(); } sum += temp; } return sum; }
public override object Run(RunModes runMode, object input, bool Logging) { int maxIndex=(int)input; for(int i = 1; i < maxIndex; i++) { for(int j = 1; j < i-1 ; j++) { var pentI = Pentagonal.Generate(i); var pentJ = Pentagonal.Generate(j); if(i>j && Pentagonal.IsPentagonal(pentI - pentJ)) if( Pentagonal.IsPentagonal( pentI + pentJ)) { return pentI-pentJ; } } } return 0; }
public void Boot(RunModes runMode) { _runMode = runMode; switch(runMode) { case RunModes.Maint: _serial.Write(StaticMessages.MaintainenceModeBootMessage); break; case RunModes.DebugAccounts: new DebugAccounts(this).Launch(); break; default: _serial.Write(StaticMessages.NormalBootMessage); break; } Prompt(); }
public override object Run(RunModes runMode, object input, bool Logging) { var currentSeed = 345; while (true) { var nextSeed = SeedCubes(currentSeed); if (Logging) { Console.WriteLine(string.Format("Starting Seed:{0}...\n", currentSeed)); } foreach (var kvp in CubesPermutationDictionary[currentSeed]) { if (kvp.Value.Count == 5) return kvp.Value.Min(); } if (Logging) { Console.WriteLine(string.Format("Ending Seed:{0}\nNext Seed{1}...\n", currentSeed, nextSeed)); Console.ReadLine(); } currentSeed = nextSeed; } }
public override object Run(RunModes runMode, object input, bool Logging) { Primes.InitPrimes((long)Math.Sqrt(987654321)); List<long> permutations = Permutations.Generate(123456789).OrderByDescending(item=>item).ToList(); foreach (long permutation in permutations) if (Primes.AllPrimes.All(item=> (permutation!=item && permutation%item!=0) || permutation==item)) return permutation; permutations = Permutations.Generate(12345678).OrderByDescending(item => item).ToList(); foreach (long permutation in permutations) if (Primes.AllPrimes.All(item => (permutation != item && permutation % item != 0) || permutation == item)) return permutation; permutations = Permutations.Generate(1234567).OrderByDescending(item => item).ToList(); foreach (long permutation in permutations) if (Primes.AllPrimes.All(item => (permutation != item && permutation % item != 0) || permutation == item)) return permutation; return 1; }
public override object Run(RunModes runMode, object input, bool Logging) { Primes.InitPrimes(); int i = 9; while(true) { bool foundOddComposite = false; if (Primes.IsPrime(i)) { i += 2; continue; } long sqrt = (long)Math.Sqrt(i); for (int j = 1; j < sqrt; j++) { long diff = i - 2*j*j; if( Primes.IsPrime(diff)) { foundOddComposite = true; break; } } if (!foundOddComposite) return i; i += 2; } }
public void Run(Problem problemToSolve, RunModes runMode, BatchModes batchMode = BatchModes.None) { problemToSolve.RunMode = runMode; problemToSolve.Logging = Logging; Thread problemThread = new Thread(problemToSolve.Run); DateTime start = DateTime.Now; problemThread.Start(); bool useTimer = batchMode != BatchModes.None; bool tooSlow = false; Timer EulerTimer = new Timer( (obj) => { if (useTimer) { if (problemThread.ThreadState == ThreadState.Running) { useTimer = false; tooSlow = true; Console.WriteLine(String.Format("{0} - {1}", problemToSolve.GetType(), SlowString)); var stat = new Statistics(problemToSolve.GetType(), SlowString, new TimeSpan(0, 1, 0), false); StatisticsWriter.Add(stat); problemThread.Abort(); } } }, null, Minute, Minute); problemThread.Join(); if (!tooSlow) { useTimer = false; RunResponse response = problemToSolve.RunResponse; var elapsed = DateTime.Now - start; var correct = response.Response != null && response.Solution != null && response.Response.Equals(response.Solution); var stat = new Statistics(problemToSolve.GetType(), response.Response, elapsed, correct); StatisticsWriter.Add(stat); //if (!batchMode) { Console.WriteLine(stat); //} } }
public override object Run(RunModes runMode, object input, bool Logging) { var currentSeed = 345; while (true) { var nextSeed = SeedCubes(currentSeed); var foundPermsMaster = CubesDictionary[currentSeed].ToList(); foreach (var cube in CubesDictionary[currentSeed]) { var count = 0; var foundPerms = new List<long>(); foreach (var cube2 in foundPermsMaster) { if (Permutations.IsPermutations(cube, cube2) && !foundPerms.Contains(cube)) { count++; foundPerms.Add(cube); } if (count == 5) return cube; } foundPermsMaster.RemoveAll(foundPerms.Contains); } currentSeed = nextSeed; } }
static void LoadSpecific(string grammar) { mode = RunModes.SpecifiedManifest; grammarSource = grammar; prompt = grammar.Split(Path.DirectorySeparatorChar).Last() + " >"; Reload(); }
//public RunResponse Run(RunModes runMode, bool logging) { // object input = (runMode == RunModes.Solution) ? SolutionInput : TestInput; // object response = Run(runMode, input, logging); // object solution = (runMode == RunModes.Solution) ? SolutionResponse : TestResponse; // Console.WriteLine(String.Format("{0}", response)); // return new RunResponse(input, response, solution); //} public abstract object Run(RunModes runMode, object input, bool Logging);
public override object Run(RunModes runMode, object input, bool Logging) { var eulerProblem13Input = (EulerProblem13Input) input; return (new BigInt("").SumBigIntNumbers(eulerProblem13Input.Numbers.Select(s=>new BigInt(s)).ToList())).Value.Substring(0, eulerProblem13Input.SubStringCount); }
/// <summary> /// Creates an instance of the rule that applies /// to a specfic property. /// </summary> /// <param name="primaryProperty">Primary property for this rule.</param> protected BusinessRule(Csla.Core.IPropertyInfo primaryProperty) { AffectedProperties = new List<Core.IPropertyInfo>(); InputProperties = new List<Core.IPropertyInfo>(); PrimaryProperty = primaryProperty; this.RuleUri = new RuleUri(this, primaryProperty); RunMode = RunModes.Default; }
public override object Run(RunModes runMode, object input, bool Logging) { if(Logging) ((IntegerTree)input).PrintTree(); return ((IntegerTree)input).FindMaxSum(Logging); }
public override object Run(RunModes runMode, object input, bool Logging) { return CountCenturySundaysOnFirstOfMonth(Logging); }
public override object Run(RunModes runMode, object input, bool Logging) { return SumThreeAndFiveMultiplesBelow1000((int)input); }
public override object Run(RunModes runMode, object input, bool Logging) { Primes.InitPrimes(1000000); return Primes.PrimeAtIndex((int) input - 1); }
public override object Run(RunModes runMode, object input, bool Logging) { return ParseNameList(); }
static void LoadConfigured() { mode = RunModes.ConfiguredManifest; prompt = ">"; Reload(); }
public override object Run(RunModes runMode, object input, bool Logging) { return LeastCommonMultiple.FromFirstXIntegers((int)input); }