CSCE 411 Lecture 1
« previous | Monday, August 27, 2012 | next »
Course Introduction
Quizzes, Homework, very important.
2 Exams: Midterm (Oct 8), Final (Dec 12 10:30–12:30)
Culture Reports
Motivation
{ first 10-digit prime found in consecutive digits of }.com
Recall:
Simple Algorithm:
int* = // compute digits of e
int i = 0;
while(true) {
int p = // extract 10-digit number at position i
if (is_prime(p)) {
return p;
}
i++;
}
2 questions to solve:
- How do we find digits of ?
- How do we determine if a number is prime?
Digits of
First approach: Use the fact that
Too much work and requires arithmetic with large rational numbers.
Assuming that has been computed perfectly, we can extract one digit at a time with
d[0] = floor(e);
e1 = 10*(e-d[0]);
d[1] = floor(e1);
e2 = 10*(e1-d[1]);
d[2] = floor(e2);
is a transcendental number, so there is no pattern to number sin base 10
Use a mixed-radix representation that leads to a more regular pattern of the digits.
The digits are nonnegative integers, and by regularity, the th digit is supposed to be or less.
- e.g. in base 10, each is in range 0–9, and each digits' place value is 10 × previous place.
Mixed radix representation of is (2; 1, 1, 1, 1, 1, …)
Multiplying the number by 10 is , but this breaks the regularity.
Revisiting the Question
Could we get away with doing something lazily? (do we even need the 10,000,000th digit?) Sure, just check how probable a number is to be prime.
Probability to be prime
Let
The probability of a number with 10 digits is prime is
The probability that none of the first 10-digit numbers in are prime is roughly ; quickly falls to 0
No need to recalculate , we just need the first few hundred digits.
Calculate primes using Sieve of Eratosthenes (knock out all multiples of integers 0 to )
What was that all about?
The billboard was an ad paid for by Google, the website 7427466391.com contained another challenge and asked people to submit their résumé. This is not surprising since Google is obsessed with