If you are a fan of the television series "The Big Bang Theory", then you know Sheldon often wears a shirt with 73 on it.
In the tenth episode of the fourth season of The Bing Bang Theory, aired December 9, 2010, https://www.imdb.com/title/tt1632225/characters/nm1433588 , Sheldon asks what everyone’s favorite number is.
Raj suggests 5318008. Flip this number upside-down to see what Raj has in mind.
Sheldon declares the best number is 73 because it satisfies the following two properties: a. the product property, and b. the mirror property:
- p=73 is the i = 21st prime number. The product of the digits of p, 7 and 3, equals i.
- The reverse of the digits of 73 (its mirror) is 37. 37 is the 12th prime number. 12 is the reverse of 21, and 21 is the product of the digits of 73.
Sheldon adds that 73 in base two, 1001001, is a palindrome number. However, many base two numbers are palindrome numbers; 5 in base two is 101.
This episode was the 73rd episode of Bing Bang. Actor Jim Parsons was born in 1973, and he was 37 years old when the episode aired. Coincidences?
The 73rd day of a non-leap year is March 14, also known as Pi Day.
73 is an emirp. An emirp (prime spelled backwards) is a prime number that results in a different prime when its digits are reversed.
Mathematicians Pomerance and Spicer prove that 73 is the only prime satisfying both the product property and mirror property. https://math.dartmouth.edu/~carlp/sheldon02132019.pdf . They also state that the only primes less than 10^10 satisfying the product property are p=17, i=7; p=73, i=21; and p=2475989, i=181440.
The following R code: a. verifies that 73 is the only Sheldon Prime within the first 10000 primes. b. verifies that 73 in base two, 1001001, is a palindrome number. c. flips Raj’s 5318008 number upside-down.
# a. 73 is the only Sheldon prime in first 10000 primes:
library(RcppAlgos)
# Function to calculate the product of digits
digit_product <- function(x) {
digits <- as.numeric(strsplit(as.character(x), NULL)[[1]])
digits <- digits[!is.na(digits)]
if (length(digits) == 0) return(NA)
prod(digits)
}
# Function to reverse digits of a number
reverse_digits <- function(x) {
as.numeric(paste(rev(strsplit(as.character(x), NULL)[[1]]), collapse = ""))
}
# Function to check if a number is prime
is_prime <- function(num) {
if (num <= 1) return(FALSE)
if (num == 2) return(TRUE)
if (num %% 2 == 0) return(FALSE)
for (i in 3:sqrt(num)) {
if (num %% i == 0) return(FALSE)
}
return(TRUE)
}
# Generate the first 10000 primes # stopped here for memory & speed issues
primes <- primeSieve(104730) # Generates first 10000 primes; the 10,000th prime is 104729
results <- list()
for (i in seq_along(primes)) {
if (digit_product(primes[i]) == i) { # product property
reversed_prime <- reverse_digits(primes[i])
if (is_prime(reversed_prime)) { # mirror property
reversed_index <- which(primes == reversed_prime)
if (reverse_digits(reversed_index) == digit_product(primes[i])){
results <- append(results, list(c(prime = primes[i], index = i, reversed_prime = reversed_prime, reversed_index = reversed_index)))
}
}
}
}
if (length(results) > 0) {
print(results)
} else {
print("No such prime found.")
}
# b. verify that 73 in base two, 1001001, is a palindrome number.
x <- 73
v <- baseOf(x, base = 2)
w <- rev(v)
if (all(v == w)) {
cat(v, "is a palindrome number")
} else {
cat(v, " is not a palindrome number")
}
# c. flips Raj’s 5318008 number upside-down.
flip_string <- function(x) {
flip <- c('0' = '0', '1' = 'I', '2' = '2', '3' = 'E', '4' = '4', '5' = 'S', '6' = '9', '7' = '7', '8' = 'B', '9' = '6')
paste(rev(sapply(unlist(strsplit(as.character(x), NULL)), function(ch) flip[ch])), collapse = "")
}
Raj <- '5318008'
flipped_Raj <- flip_string(Raj)
flipped_Raj
# End