Tag Archives: prime

391. Prime-k factorial

For a prime p let S(p) = (∑(p-k)!) mod(p) for 1 ≤ k ≤ 5.

For example, if p=7,
(7-1)! + (7-2)! + (7-3)! + (7-4)! + (7-5)! = 6! + 5! + 4! + 3! + 2! = 720+120+24+6+2 = 872.
As 872 mod(7) = 4, S(7) = 4.

It can be verified that ∑S(p) = 480 for 5 ≤ p < 100.

Find ∑S(p) for 5 ≤ p < 108.

prime number of 5 ≤ p <100  = >  5, 7,  11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97.
Case 1, assume p = 97if (p-k)!,  96! + 95! + 94! + 93!  + 92!, if use brute force method, factorial’s are very big number (infinite), time wise can’t possible to find out 108primes.
Advertisement

386. Antichain

Let n be an integer and S(n) be the set of factors of n.

A subset A of S(n) is called an antichain of S(n) if A contains only one element or if none of the elements of A divides any of the other elements of A.

For example: S(30) = {1, 2, 3, 5, 6, 10, 15, 30} , {2, 5, 6} is not an antichain of S(30).  {2, 3, 5} is an antichain of S(30).

Let N(n) be the maximum length of an antichain of S(n).  Find ΣN(n) for 1 ≤ n ≤ 108

Read more of this post

387. Harshad/Niven Number

A Harshad or Niven number is a number that is divisible by the sum of its digits.  201 is a Harshad number because it is divisible by 3 (the sum of its digits.). When we truncate the last digit from 201, we get 20, which is a Harshad number.  When we truncate the last digit from 20, we get 2, which is also a Harshad number.  Let’s call a Harshad number that, while recursively truncating the last digit, always results in a Harshad number a right truncatable Harshad number.

Also:  201/3=67 which is prime.
Let’s call a Harshad number that, when divided by the sum of its digits, results in a prime a strong Harshad number.

Now take the number 2011 which is prime.  When we truncate the last digit from it we get 201, a strong Harshad number that is also right truncatable.  Let’s call such primes strong, right truncatable Harshad primes.

You are given that the sum of the strong, right truncatable Harshad primes less than 10000 is 90619.

Find the sum of the strong, right truncatable Harshad primes less than 1014. Read more of this post

10. Sum of Prime

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.  Find the sum of all the primes below two million.

A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.   A natural number greater than 1 that is not a prime number is called a composite number.   For example, 5 is prime, as only 1 and 5 divide it, whereas 6 is composite,   since it has the divisors 2 and 3 in addition to 1 and 6. Read more of this post

7.Prime Number

By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see  that the 6th prime is 13. What is the 10 001st prime number? Read more of this post

Smallest Positive Number

2520 is the smallest number that can be divided by each of the numbers  from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

N = divide by prime factor of N => take maximum power number of each prime
2= 2^1 = 2
3 =2^1 * 3^1 = 6
4 =2^1, 3^1, 2^2 = 2^2 * 3^1 = 12
5 =2^1, 3^1, 2^2,5^1 = 2^2 * 3^1 5^1 = 60
6 =2^1, 3^1, 2^2,5^1,(2^1*3^1) = 2^2 * 3^1 5^1 = 60
7 =2^1, 3^1, 2^2,5^1,(2^1*3^1),7^1 = 2^2 * 3^1 5^1 *7^1= 420
8 =2^1, 3^1, 2^2,5^1,(2^1*3^1),7^1,2^3 = 2^3 * 3^1 5^1 *7^1= 840
9 =2^1, 3^1, 2^2,5^1,(2^1*3^1),7^1,2^3,3^2 = 2^3 * 3^2 5^1 *7^1= 2520
10 =2^1, 3^1, 2^2,5^1,(2^1*3^1),7^1,2^3,3^2,(5^2*2^1) = 2^3 * 3^2 5^1 *7^1= 2520
11 =2^1, 3^1, 2^2,5^1,(2^1*3^1),7^1,2^3,3^2,(5^2*2^1),11^1 = 2^3 * 3^2 5^1 *7^1 * 11^1= 27720

maximum power of prime = > floor(log(N) / log(prime_value)) => floor(log(20)/log(2)) = 4;

Read more of this post

3.Largest Prime Factor

The prime factors of 13195 are 5, 7, 13 and 29.  What is the largest prime factor of the number 600851475143 ?

Read more of this post