Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace bug_vcs {
- class Program {
- public static void Main(string[] args) {
- DateTime t0 = DateTime.Now;
- int maxNumber = 20;
- bool found = false;
- long start = maxNumber;
- while (!found) {
- found = true;
- int i = 2;
- while ((i < maxNumber + 1) && found) {
- if (start % i != 0) {
- found = false;
- }
- i++;
- }
- start++;
- }
- Console.WriteLine("{0:d}", start - 1);
- Console.WriteLine("time elapsed = {0:f} sec.", (DateTime.Now - t0).Seconds);
- Console.ReadLine();
- }
- }
- }
- from datetime import datetime
- t0 = datetime.now()
- max_number = 20
- found = False
- start = max_number
- while not found:
- found = True
- i = 2
- while ((i < max_number + 1) and found):
- if (start % i) != 0:
- found = False
- i += 1
- start += 1
- print("number {0:d}n".format(start - 1))
- print("time elapsed = {0:f} sec.n".format((datetime.now() - t0).seconds))
- from datetime import datetime
- start_time = datetime.now()
- max_number = 20
- x = max_number
- while True:
- i = 2
- while i <= max_number:
- if x % i: break
- i += 1
- else:
- # x was not divisible by 2...20
- break
- x += 1
- print('number: %d' % x)
- print('time elapsed: %d seconds' % (datetime.now() - start_time).seconds)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement