Largest prime factor

Largest prime factor
Largest prime factor Problem The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ?   Algorithm Let the given number be n and let k = 2, 3, 4, 5, … . For each k, if it is a factor of n then we divide ...

What is the 10001st prime number

What is the 10001st prime number
10001st prime Problem 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 10001st prime number?   Algorithm We want to looking for the 10001st prime number. We have limit = 10001 and we knew 2 is only even ...

Find the largest palindrome made from the product of two 3-digit numbers

Find the largest palindrome made from the product of two 3-digit numbers
Largest palindrome product Problem A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 * 99. Find the largest palindrome made from the product of two 3-digit numbers.   If a and b are 3-digits long then they must lie between 100 and 999 ...

Sum square difference

Sum square difference
Sum square difference Problem The sum of the squares of the first ten natural numbers is, 12 + 22 + … + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + … + 10)2 = 552 = 3025 Hence the difference between the sum of the squares of the first ...

Smallest multiple

Smallest multiple
Smallest multiple Problem 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? Algorithm In this case, K = 20 Let N be the smallest number that ...

How to reverse a number or digits using c programming

How to reverse a number or digits using c programming
C All-in-One Desk Reference For Dummies Problem How to reverse a number or digits using c programming? Try it /** @Author: Tan Nguyen @Website: http://ngtan.com */ #include <stdio.h> int Reversed ( int number ) { int reversed_number = 0; while ( number ) { reversed_number = reversed_number * 10 + number % 10; number /= ...

Convert hexadecimal number to binary number

Convert hexadecimal number to binary number
Problem How to convert hexadecimal number to binary number using c programming? Hexadecimal  to binary table We want to convert hexadecimal number to binary number. We will replace each hexadecimal digit to binary values using the above table. Try it /** @Author: Tan Nguyen @Website: http://ngtan.com */ #include <stdio.h> #include <string.h> #define MAX 1000 void ...

[UIT - ACM] Vasya and Public Transport

[UIT - ACM] Vasya and Public Transport
Problem Vasya often uses public transport. The transport in the city is of two types: trolleys and buses. The city has n buses and m trolleys, the buses are numbered by integers from 1 to n, the trolleys are numbered by integers from 1 to m. Public transport is not free. There are 4 types ...

[UIT - ACM] Soroban – an abacus developed in Japan

[UIT - ACM] Soroban - an abacus developed in Japan
Problem Soroban You know that Japan is the country with almost the largest ‘electronic devices per person’ ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus developed in Japan. This phenomenon has its reasons, of course, but we are ...

Find the sum of the even valued terms in fibonacci sequence 1

Find the sum of the even valued terms in fibonacci sequence
Problem Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … By considering the terms in the Fibonacci sequence whose values do not exceed four million, find ...