0% found this document useful (0 votes)
100 views

Aptitude Simplified

This document discusses various computer programs including programs to check if a number is even or odd, calculate the sum, sum of squares and sum of cubes of natural numbers, arithmetic and geometric progressions, simple and compound interest. It provides code snippets in Python for these programs and examples of running the code and output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views

Aptitude Simplified

This document discusses various computer programs including programs to check if a number is even or odd, calculate the sum, sum of squares and sum of cubes of natural numbers, arithmetic and geometric progressions, simple and compound interest. It provides code snippets in Python for these programs and examples of running the code and output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 155

Aptitude and Reasoning

with Computer Programs


by
Prof. Kota Srinivasu
Principal, NRI Institute of Technology, Guntur
(Former Principal of PVP Siddhartha Institute of Technology,
Bapatla Engineering College and RVR & JC College of
Engineering)
n = int(input("Enter the number n: "))
sum=0
while n>0:
r =n%10
n=n//10
n = int(input("Enter the number n:"))
sum=sum+r
sum=0
print('Sum of the digits=',sum)
while n>0:
n = int(input("Enter the number n: ")) r =n%10
sum=1 n=n//10
while n>0: sum=sum*10+r
r =n%10 print(‘Reverse of the number=',sum)
n=n//10
sum=sum*r
print(‘Product of the digits=',sum)
Enter any number:678
1st Cycle: 2nd Cycle: 3rd Cycle:
n=678 n=67 n=6
Sum=0 Sum=8 Sum=87
678%10=8 67%10=7 6%10=6
r=8 r=7 r=6
n=678//10=67 67//10=6 6//10=0
n=67 n=6 n=0
sum=sum*10+r sum=sum*10+r sum=sum*10+r
sum=0*10+8 sum=8*10+7 sum=87*10+6
sum=8 sum=87 sum=876

As n=0, execution in while loop is not valid


3
n = int(input("Enter the number n: ")) n = int(input("Enter n: "))
sum=0 Enter the number n: 153 sum=0
temp=n 153 temp=n
while n>0: 153 is an Armstrong Number while temp >0:
r =n%10 r = temp %10
n=n//10 temp= temp //10
sum=sum+r*r*r sum=sum+r*r*r
print(sum) print(sum)
if(temp==sum): if(n==sum):
print(temp,"is an Armstrong Number") print(n,"is an Armstrong ")
else: else:
print(temp,"is not an Armstrong print(n,"not Armstrong ")
Number")
n = int(input("Enter the number n: "))
sum=0
temp=n if(temp==sum):
if(n==0): print(temp,"is a strong Number")
sum=1 else:
while n>0: print(temp,"is not a strong Number")
r =n%10
n=n//10 145, 375, 100, 2, 10, 40585, 0
145, 5166, 3, 2, 2, 40585, 1 4!= 24
fact=1
0!= 1
i=1
5!= 120
while(i<=r):
fact=fact*i 40585 is not a strong Number 8!= 40320
5!= 120
i=i+1
40585
sum=sum+fact
divisor)dividend(quotient Enter dividend: 100
Enter divisor: 13
----
Quotient = 7
remainder Remainder = 9

dividend=divisor × quotient + remainder


𝑎 𝑑𝑖𝑣𝑖𝑑𝑒𝑛𝑑
13)100(7 13)10(0 10)5(0 =
b divisor
91 0 0 𝑑𝑖𝑣𝑖𝑑𝑒𝑛𝑑 remainder
= quotient
---------- ---------- --------- divisor
100 9
divisor
= =7
9 10 5 13 13
3)47 (15 81)67(0 b)a(q
3 0
----- ----- bxq
17 67 -----
15
-------- a/b=67/81 r
2 Quotient =0
a/b=47/3 Remainder=67
Quotient =15 dividend=divisor × quotient
Remainder=2 + remainder
𝑎 5 4 7 100
<1 <1 <1 <1 >1
𝑏 7 10 19 18

a<b a<b a<b a<b a<b


Quotient=0 Quotient=0 Quotient=0 Quotient=0 Quotient=5
Remainder=a Remainder=5 Remainder=4 Remainder=7 Remainder=10
𝑎
>1
𝑏
𝑎 𝑟 𝑏𝑞+𝑟 𝑑𝑖𝑣𝑖𝑑𝑒𝑛𝑑 remainder
=q = = quotient
𝑏 𝑏 𝑏 divisor divisor

a=dividend =divisor x quotient + remainder


The sum of n natural numbers is n(n+1)/2
The sum of squares of n natural numbers
=n(n+1)(2n+1)/6

The sum of cubes of n natural numbers


=(n(n+1)/2)2 =n*n*(n+1)*(n+1)/4
List of Computer Programs

1.Check the given number is even or odd. Sum,


sum of squares, sum of cubes of n natural
numbers
2.Arithmetic Progression
3.Geometric Progression
4. Compound Interest
5.Polygon: Interior and Exterior angles, Number
of diagonals
# Check the given number is even or odd
# Sum, sum of squares, sum of cubes of n natural numbers
n=int(input('Enter n value: ')) Enter n value: 2
The Given Number 2 is even
if n%2==0:
The Given Sum of 2 natural numbers is
print('The Given Number',n,'is even') 3.0
else: The Given Sum of 2 squares of natural
print('The Given Number',n,'is odd') numbers is 5.0
# Sum of natural numbers The Given Sum of 2 cubes of natural
sum_n=n*(n+1)/2 numbers is 9.0
print('The Given Sum of ',n,'natural numbers is',sum_n)
# Sum of squares of n natural numbers
sum_n_sq=n*(n+1)*(2*n+1)/6
print('The Given Sum of ',n,'squares of natural numbers is',sum_n_sq)
# Sum of cubes of n natural numbers
sum_n_cu=n*n*(n+1)*(n+1)/4
print('The Given Sum of ',n,'cubes of natural numbers is',sum_n_cu)
Arithmetic Progression: Problems on Numbers
The nth term of A.P. is given by
Tn = a + (n – 1)d;
Sum of n terms of A.P
Sn n
a  L  na  L  na  a  ( n  1) d  n2a  ( n  1) d 
  
2 2 2 2
a = 1st term, n = number of term, d= difference, Tn = nth term

Geometrical Progression:
n – 1 Sn 

a r 1 n

Tn = ar r 1
# Arithmetic Progression
# Take input of 'a','d' and 'n'
a = float(input("Enter the value of a: ")) Enter the value of a: 1
d = float(input("Enter the value of d: ")) Enter the value of d: 2
Enter the value of n: 5
n = int(input("Enter the value of n: ")) Terms in Arithmetic Progression
print(" Terms in Arithmetic Progression“) 13579
for i in range(1,n+1): nth term in AP : 9
t_n = a + (i-1)*d Sum of first n terms: 25.0
print(t_n)
print("nth term in AP : ", t_n)
#Sum of first n terms in Arithmetic Progression
S_n = n*(2*a + (n-1)*d) /2
print("Sum of first n terms: ", S_n)
# Geometic Progression Enter the value of a: 2
# Take input of 'a','d' and 'n' Enter the value of r: 2
a = int(input("Enter the value of a: ")) Enter the value of n: 3
r = int(input("Enter the value of r: ")) Terms in Geometic Progression
n = int(input("Enter the value of n: ")) 2
print(" Terms in Geometic Progression“) 4
for i in range(1,n+1): 8
nth term in GP: 8
t_n = a *r**(i-1) Sum of first n terms: 14.0
print(t_n)
print("nth term in GP: ", t_n)
#Sum of first n terms in Geometic Progression
S_n = a*(pow(r,n)-1)/(r-1)
print("Sum of first n terms: ", S_n) S_n = a*(r**n-1)/(r-1)
Simple / Compound Interest

Simple Interest = PtR / 100


Amount A = P+PnR/100=P(1+tR/100)
When Interest is Compound annually:
Amount = P (1 + R / 100)t

Compound Interest = A - P
# A: Final Amount CI=A-P
# P: Initial Principal print('Compound Interest=%8.2f'%CI)
# r: Annual Interest Rate %
# n: Number of compounding periods per year
# t: Number of years-Time period Enter the value of P: 5000
P = float(input("Enter the value of P: ")) Enter the value of r: 8
r =float(input("Enter the value of r: ")) Enter the value of n: 4
n = float(input("Enter the value of n: ")) Enter the value of t: 5
Amount 7429.736979891774
t = float(input("Enter the value of t: "))
Compound Interest= 2429.74
r=r/100
A=P*pow(1+r/n, n*t)
A=P*pow((n+r)/n, n*t) A=P*(1+r/n)**(n*t)
print('Amount=',A)
A=P*((n+r)/n)**(n*t)
Simple / Compound Interest
• Half-yearly C.I.:
Amount = P (1+(R/2)/100)2t = P (1+R/200)2t
• Quarterly C.I. :
Amount = P (1+(R/4)/100)4t = P (1+R/400)4t
Monthly C.I. :
Amount = P (1+(R/12)/100)12t = P (1+R/1200)12t
P = float(input("Enter the value of P: "))
Enter the value of P: 5000
r =float(input("Enter the value of r: "))
Enter the value of r: 8
n = float(input("Enter the value of n: "))
Enter the value of n: 4
t = float(input("Enter the value of t: "))
Enter the value of t: 5
r=r/100
Amount= 7429.74 7429.74
A1=P*pow(1+r/n, n*t)
7429.74 7429.74
A2=P*pow((n+r)/n, n*t)
Compound Interest= 2429.74
A3=P*(1+r/n)**(n*t)
A4=P*((n+r)/n)**(n*t)
print('Amount=%8.2f%8.2f%8.2f%8.2f'%(A1,A2,A3,A4))
CI=A1-P
print('Compound Interest=%8.2f'%CI)
from math import tan, pi
# Polygon Properties
n=int(input('Number of sides of Polygon n:'))
a = float(input("Enter the Length of a Side a: "))
sum_ext=360
ang_ext=360/n Number of sides of Polygon n:6
sum_int=180*n-360 Enter the Length of a Side a: 6
ang_int=sum_int/n 360.00 60.00 720.00 120.00 4 9 93.53
n_tri=n-2
n_diag=n*(n-3)/2
area = n * a**2 / (4 * tan(pi/n))
print('%8.2f%8.2f%8.2f%8.2f%8.2f%8.2f %8.2f '%(sum_ext,ang_ext,
sum_int,ang_int, n_tri,n_diag,area))
10)4796(479 100)4796(47 1000)4796(4
40 400 4000
----- ----- -----
79 796 796
70 700
-------- ------ Quotient =4
96 96 Remainder=796
90 first_n1 = number // pow(10,n-n1);
------ last_n2 = number%pow(10,n2);
Quotient =47
6
Remainder=96
Quotient =479
Remainder=6
First 4 digits = 9492940860//10(10-4)=9492
1000000)9492940860(9452
Last 5 digits = 9492940860%105 = 40860 9452000000
(8-5)
57849384 //10 =57849 ----------------
4
940860
57849384%10 =9384
100000)9492940860(94529
1000) 57849384(57849 9452900000
57849000 ----------------
---------------- 40860
384 10000) 57849384(5784
57840000
----------------
9384
number=int( input("Enter given number: "))
nd=len(str(number)) Enter given number:12345678987654321
n1=int(input('Enter n1: ')) Enter n1:10
n2= int(input('Enter n2: ‘)) Enter n2 :8
a=int(input('Enter a: ')) Enter a: 5
b= int(input('Enter b:')) Enter b:10
# Computes first n1 digits First 10 digits = 1234567898
first_n1 = number//pow(10,nd-n1) Last 8 digits = 87654321
# Computes last n2 digits
From 5 to 10 digits = 567898 and 567898
last_n2 = number % pow(10,n2) a-1 b-(a-1)=b-a+1 nd-b
digit_a_nd=number % 10**(nd-a+1) b-(a-1)=b-a+1 nd-b
digit_a_b=digit_a_nd//10**(nd-b) b-(a-1)=b-a+1
digit_1_b=number//10**(nd-b) a-1 b-(a-1)=b-a+1
digit_a_b1=digit_1_b%10**(b-a+1)
b-(a-1)=b-a+1
print("\nFirst {0} digits = {1}".format(n1, first_n1))
digit_1_b=number//10**(nd-b)
print(" \nLast {0} digits = {1}" .format( n2,last_n2)) digit_a_b1=digit_1_b%10**(b-a+1)
print(" \nFrom {0} to {1} digits = {2} and {3}" .format( a,b,digit_a_b,digit_a_b1))
#number of different characters of same size strings
def diff(a, b):
return [i for i in range(len(a)) if a[i] != b[i]]
a = input("Enter string1: ")
Enter string1: abcde
b = input("Enter string2: ")
Enter string2: pqrst
print(diff(a, b)) [0, 1, 2, 3, 4]
Enter string1: abcde
Enter string2: pqcse
[0, 1, 3]
n1=int(input('Enter ist number: '))
n2=int(input('Enter 2nd number: '))
sum1=sum2=0
n11=n1//2+1 Enter ist number: 220
n22=n2//2+1 Enter 2nd number: 284
for i in range(1,n11): 220 and 284 are Amicable numbers
if n1%i==0:
sum1+=i Factors of 220 are 1, 2, 4, 5, 10, 11, 20, 22,
for j in range(1,n22): 44, 55, 110 Sum=284
if n2%j==0: Factors of 284 are 1, 2, 4, 71, 142 Sum=220
sum2+=j
if(sum1==n2 and sum2==n1):
print(n1,' and ',n2,'are Amicable numbers')
else:
print(n1,' and ',n2,'are not Amicable numbers')
def factorial(n): 4!= 24
if n == 0 or n == 1: 0!= 1
return 1 5!= 120
else: 8!= 40320
return n * factorial(n - 1) 5!= 120
lst = [145, 375, 100, 2, 10, 40585, 0] 40585
strong_nums = list(filter(lambda num: sum(factorial(int(digit))
for digit in str(num)) == num, lst))
print("Strong numbers in the given list are:", strong_nums)
Strong numbers in the given list are:
[145, 2, 40585]
1!+4!+5!=1+24+120=145
2!=2
# factors of a given number Enter a number: 324
def print_factors(x): The factors of 324 are:
print("The factors of", x, "are:") 1 27
for i in range(1, x+1): 2 36
if x % i == 0: 3 54
print(i) 4 81
num = int(input("Enter a number: ")) 6 108
print_factors(num) 9 162
# sorting true or false 12 324
def is_sorted(lst, key=lambda x: x): 18
for i, el in enumerate(lst[1:]):
if key(el) < key(lst[i]): # i is the index of the previous element
return False True
return True
print(is_sorted([5, 9, 11, 67, 70]))
#nth root of x
def root():
x = int(input("Enter x value: "))
n = int(input("Enter n value: "))
if n == 0:
n=2
r = float(pow(x, 1 / n))
return r
Enter x value: 91
print(root()) Enter n value: 2
Enter x value: 10 9.539392014169456
Enter n value: 15
1.1659144011798317
How many trailing zeroes would be found in 4617!,
upon expansion? 10=2 x 5
4617 4617 4617 4617 4617 4617
 2
 3
 4
 5
 6
5 5 5 5 5 5
 923.4  184.68  36.936  7.3872  1.47744  0.295488
 923  184  36  7  1  0  1151
Then 4617! has 923 + 184 + 36 + 7 + 1
= 1151 trailing zeroes
Units digit of sum of 1 to n factorial numbers
1!+2!+3!+4!+5!+6!+…..+n!=1+2+6+4+0+0…=13
Unit digit is 3 30 30
Enter Factorial n:4617
Number of trailing Zeros
= 1151
n=int(input('Enter Factorial n:'))
nz=0;
while(n>0): 4617//5 923//5 184//5 36//5 7//5 1//5
n=n//5 923 184 36 7 1 0
nz=nz+n 923 1107 1143 1150 1151 1151
print(nz) 923+184+36+7+1=1151
print("Number of trailing Zeros = %d"%nz)
print("Enter nth power a prime number as factor of a factorial:");
n=int(input('Enter Factorial n:'))
n1=int(input('Enter Base n1:'))
nthpower=0; Enter Factorial n:168
while(n>0): Enter Base n1:13
n=n//n1 Power of given number n1 as factor of n = 12
nthpower=nthpower+n
print("Power of given number n1 as factor of n = %d"%nthpower)
Enter nth power a prime number as factor of a factorial:
Enter Factorial n:169 12 is the factor of 168!
Enter Base n1:13
13
Power of given number n1 as factor of n = 14
1314 is the factor of 169!
Irrational number is a number that cannot
be written as a ratio of two integers (or
A+iB
cannot be expressed as a fraction). A A+iB
Fractions that are greater than 0
but less than 1 are called proper
fractions. Ex:2/3, 7/9
Fractions that are greater
than 1 are improper
fractions. Ex:5/3, 8/7
Problems on Numbers SI and CI
Problems on Ages Average
Permutation and Combination
Ratio and Proportion
Percentage
Alligation or Mixture Boats and Streams
Chain Rule Time and Distance (Trains)
Partnership Data Sufficiency
Venn Diagram Profit and Loss
Calendar
Area and Volume
Clocks
Probability Data Interpretation
Time and Work (Pipes) Cubes
If the sum of the factors other than that number or proper divisors of a number
is 𝒆𝒒𝒖𝒂l to the number itself, then the number is called Perfect number. Ex; 6,
28, 496, and 8,128. Proper divisors of 6 are 1,2,3 Sum is 6=6
If the sum of the factors other than that number or proper divisors of a number
is greater than the number itself, then the number is called Abundant or
excessive.
Ex: 12, 18, 20, 24, and 30. proper divisors of 12 are 1,2,3,4,6, Sum is 16>12
If the sum of the factors other than that number or proper divisors of a number
is less than the number itself, then the number is called Deficient number.
Ex: 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 21, 22, and 23
proper divisors of 4 are 1,2 Sum is 3<4
Amicable numbers: Sum of the proper divisors of each number equals the
other number in the pair. The first pair of amicable numbers is 220 and 284.
The sum of the proper divisors of 220 is 1 + 2 + 4 + 5 + 10 + 11 + 20 + 22 + 44
+ 55 + 110 = 284, whereas the sum of the proper divisors of 284 is 1 + 2 + 4 +
71 + 142 = 220.
Strong number is a special number whose sum of factorial of digits is equal to
the original number. For example: 145 is strong number. Since, 1! + 4! + 5!
=1+24+120=145
Armstrong number is a number that is equal to the sum of cubes of its digits.
For example 0, 1, 153, 370, 371 and 407 are the Armstrong numbers.
153=1*1*1 + 5*5*5 + 3*3*3 = 1+125+27=153
An integer is a palindrome when it reads the same backward as forward.
Example 1: Input: 121
Highest Common Factors (HCF)& Lowest
common Multiples (LCM)
Multiples
What is a multiple?
A number that may be divided by another number with no remainder:
2, 4, 6, 8, 10 and 12 are multiples of 2.
i.e. Multiples of 3 are all those numbers which appear in the 3 times
table
What are common multiples?
A common multiple of two or more numbers contains each of them a
number of times exactly, so, 12, 24 are common multiples of 3 and 4. i.e.
A number which appears in the times tables of all the numbers you are
considering
Finding Lowest common multiples
Example:
Find the lowest common multiple of 3 and 7..
First few multiples of 3: 3 6 9 12 15 18 21
First few multiples of 7: 7 14 21
The lowest common multiple of 3 and 7 is: 21
LOWEST COMMON MULTIPLES
Find the lowest common multiples for the following sets of
numbers:
5 and 7 LCM = 35
6 and 10 LCM = 30
4, 6, and 12 LCM = 12

LCM is greater than the given numbers


or
equal to the maximum given number
Finding Highest Common Factors
Example
Find the highest common factor of 12 and 15.
The factors of 12 are: 1, 2, 3, 4, 6, and 12
The factors of 15 are: 1, 3, 5, 15
So the highest common factor of 12 and 15 is 3
Highest common factors
Find the highest common factors of the following sets of
numbers.
HCF is less than the given
20 and 30 numbers
HCF = 10
14 and 12
or
HCF = 2 equal to the minimum
24, 36, and 42 HCF = 6 given number
40, 45 and 50 HCF = 5
Prime Factors

Sometimes we want to find just the prime factors of two


numbers.

What is a prime number?

A prime number only has 2 factors and those 2 factors must


be 1 and the number itself.

The first 5 prime numbers are: 2, 3, 5, 7, and 11


LOWEST COMMON MULTIPLES

Find the lowest common multiples for the following sets of


numbers:

5 and 7
LCM = 35
6 and 10
LCM = 30
4, 6, and 12

LCM = 12
Finding Highest Common Factors
Find the HCF of 12 and 15.
The factors of 12 are:
1, 2, 3, 4, 6, and 12
The factors of 15 are:
1, 3, 5, 15
So the HCF of 12 and 15 is
3
HCF x LCM = product of numbers=
First number x Second number
The HCF of two numbers is 12 and
their LCM is 72.
If one of the numbers is 24, find the other.
Solution: Let the required number be x. then,
12 x 72 = 24 * x
X=12 x 72/24=36
Thus the other number is 36.
12 x 72 = 24 x 36 = 3624
def compute_HCF(x, y):
# choose the greater number
if x > y:
min = y Enter num1: 32
else: Enter num2: 48
min = x
while(True):
The HCF is 16
if x % min== 0 and y % min == 0:
hcf = min
break
min -= 1
return hcf
num1 = int(input('Enter num1: '))
num2 = int(input('Enter num2: '))
print("The HCF is", compute_HCF(num1, num2))
a = int(input("1stnumber:"))
a = int(input("1stnumber:"))
b = int(input("2ndnumber:"))
b = int(input("2ndnumber:"))
HCF = 1 Enter the first number: 28
HCF = 1 1stnumber:54
if a>b: Enter the second number: 35
if a>b: 2ndnumber:81
min=b First Number is: 28
min=b First Number is: 54
else: Second Number is: 35
else: Second Number is: 81
min=a HCF of the numbers is: 7
min=a HCF is: 27
for i in range(2,min+1):
while(a%min!=0 or b%min!=0):
if(a%i==0 and b%i==0):
min=min-1
HCF = i
HCF = min
print("First Number is: ",a)
print("First Number is: ",a)
print("Second Number is: ",b)
print("Second Number is: ",b)
print("HCF of the numbers is: ",HCF)
print("HCF is: ",HCF)
# Python Program to find the L.C.M. of two input number
def compute_lcm(x, y):
# choose the greater number
if x > y:
num1 = int(input('Enter num1: '))
max = x
num2 = int(input('Enter num2: '))
else:
print("The L.C.M. is", compute_lcm(num1, num2))
max = y
while(True):
if((max % x == 0) and (max % y == 0)):
lcm = max
Enter num1: 12
break
Enter num2: 18
max += 1
The L.C.M. is 36
return lcm
# Python Program to find the L.C.M. of two input number
def compute_lcm(x, y):
# choose the greater number
if x > y:
max = x Enter num1: 54
else: Enter num2: 81
max = y The L.C.M. is 162
for i in range(max,x*y+1):
if i% x == 0 and i % y == 0: Enter num1: 13
lcm = i Enter num2: 23
return lcm The L.C.M. is 299
num1 = int(input('Enter num1: '))
num2 = int(input('Enter num2: '))
print("The L.C.M. is", compute_lcm(num1, num2))
Problems on Ages
• A father is 30 years older than his son, however he will be
only thrice as old as his son after 5 years what is father’s
present age?
F  S  30
F  5  3(S  5)  F  3S  10
3S  10  S  30  2S  20  S  10
F  S  30  10  30  40 53
Ratio and Proportion
If Rs. 1260 is divided among A, B, C in the ratio
2 : 3 : 4 what is C’s share?
2 x  3 x  4 x  9 x  1260
x  140
C’s share =4x=4x140= Rs. 560
4
or  1260  560
23 4 54
Chain Rule

Direct Proportion :
MDH
A B x
 Const  Const
A B y W
Indirect Proportion:
A B
pq  Const
A B

M 2 D2 H 2 M 1D1H1

W2 W1
55
m1 = int(input("Enter the value of m1: ")) Enter the value of m1: 12
d1 = float(input("Enter the value of d1: ")) Enter the value of d1: 8
h1 = float(input("Enter the value of h1: ")) Enter the value of h1: 6
w1 = float(input("Enter the value of w1: ")) Enter the value of w1: 1
value = input("Enter m2 or d2 or h2 or w2:") Enter m2 or d2 or h2 or w2:m2
match value: Enter the value of d2: 8
case "m2": Enter the value of h2: 8
d2 = float(input("Enter the value of d2: ")) Enter the value of w2: 1
h2 = float(input("Enter the value of h2: ")) Persons Required M2= 9
w2 = float(input("Enter the value of w2: "))
m2=m1*d1*h1*w2/(w1*d2*h2)
print('Persons Required M2=',m2)
case "d2":
m2 = float(input("Enter the value of d2: "))
h2 = float(input("Enter the value of h2: "))
w2 = float(input("Enter the value of w2: "))
d2=m1*d1*h1*w2/(w1*m2*h2)
print('Days Required D2=',d2)
case "h2":
m2 = int(input("Enter the value of m2: "))
d2 = (input("Enter the value of d2: "))
w2 = float(input("Enter the value of w2: "))
h2=m1*d1*h1*w2/(w1*m2*d2)
print('hours per Day h2=',h2)
case "w2":
m2 = int(input("Enter the value of m2: "))
d2 = float(input("Enter the value of d2: "))
h2 = float(input("Enter the value of h2: "))
w2=m2*d2*h2*w1/(m1*d1*h1)
print('howork done/items w2=',w2)
Chain Rule
20 men complete one - third of a piece of work in 20 days. How many more

men should be employed to finish the rest of the work in 25 more days?

Men days work


20 20 1/3 work done = 1/3
x 25 2/3 remaining = 1-1/3=2/3
M 2 D2 M 1D1 3  25 x 3  20  20
    x  32
W2 W1 2 1
12 More people needed to finish the job 58
Partnership
A starts business with Rs.3500 and 5 months after B joins A as his partner.
After a year the profits are divided in the ratio of 2:3. How much did B
contribute ?

A :B =3500*12 : 7X
42000 : 7X = 2: 3
7X * 2 = 42000 *3 #Product of means=product of extremes
X = 42000 * 3/14 or 7X/42000=3/2
X = 9000
B’s contribution is Rs.9000
59
Time and Work
A work done by two people in 24 minutes. One of them can
do this work alone in 40 minutes. How much time is
required to do the same work by the second person?
1/Totaltime= 1/Atime + 1/Btime
A and B together  1/24; A  1/40; B  ?
1 1 5-3 1
B  A and B - A  –  
24 40 120 60
The second person will complete in 60 minutes
60
Time and Work (Pipes)
A cistern has two taps which fill it in 12 minutes and 15 minutes respectively.
There is also a waste pipe in the cistern. When all the pipes are opened, the
empty cistern is filled in 20 minutes. How long will a waste(empty) pipe take
to empty a full cistern ?
1/Tf= 1/t1f + 1/t2f-1/t3e
All=1/20= 1/12 + 1/15 - 1/w
1/w= 1/12 + 1/15 - 1/20= 5/60 + 4/60 – 3/60
1/t3e=1/w = 6/60 = 1/10
The waste pipe can empty the cistern in 10 minutes.

61
Cost of Cheaper Cost of costlier
c d

Cost of Mixture
m

d-m m-c

(Cheaper quantity) : (Costlier quantity) =


(d – m) : (m – c)
62
Alligation or Mixture
A merchant has 100 kg of salt, part of which he sells at 7% profit and
the rest at 17% profit. He gains 10% on the whole. Find the quantity
sold at 17% profit?

7 17

10

(17-10) : (10-7)
7 : 3
The ratio is 7:3
The quantity of 2nd kind = 3/10 of 100kg = 30kg 63
costly=int(input('Enter Costly: ')) Costly or More
cheap=int(input('Enter Cheap: ')) Cheap or less
mean=int(input('Enter Mean: '))
x=mean-cheap x is Costly quantity ratio
Y=costly-mean y is Cheap quantity ratio
xbyy=(mean-cheap)/(costly-mean) x1 quantity of costly items
total=int(input('Enter total: ')) y1 quantity of cheap items
#mean*(x+y)=costly*x+cheap*y
x1=x/(x+y)*total
y1=y/(x+y)*total
mean=(costly*x1+cheap*y1)/(x1+y1)
y1=(costly-mean)*x1/(mean-cheap)
x1=(mean-cheap)*y1/(costly-mean)
costly=(mean*(x1+y1)-cheap*y1)/x1
cheap=(mean*(x1+y1)-costly*x1)/y1
sumxy=(costly*x1+cheap*y1)/mean
print('x/y=%2f x1=%d y1=%d sumxy=%d '%(xbyy,x1,y1,x1+y1))
Alligation or Mixture
In an examination out of 480 students 85% of the girls and 70% of the boys
passed. How many boys appeared in the examination if total pass percentage
was 75%

70 85
Number of Boys
75 = 480 * 10/15= 320
(85-75) : (75-70)
10 : 5

65
Simple / Compound Interest

Simple Interest = PnR / 100


Amount A = P+PnR/100=P(1+nR/100)
When Interest is Compound annually:
Amount = P (1 + R / 100)n

Compound Interest = A - P
66
Simple / Compound Interest
A sum of money doubles itself at C.I. in 15 years.
In how many years will it become eight times?

A  P(1  R/100)15

2P  P(1  R/100)  2  (1  R/100)


15 15

If A  8P  8P  P(1  R/100)  8  (1  R/100)


n n

8  2  ((1  R/100) )  (1  R/100)  (1  R/100)


3 15 3 45 n

It will take a period of 45 years


67
Average
The average of age of 30 students is 9 years. If the
age of their teacher included, it becomes 10 years.
Find the age of the teacher?

Total age of 30 students = 30*9 = 270

Including the teacher’s age = 31*10 = 310

Difference is = 310-270 = 40 years


68
Permutations and Combinations
A foot race will be held on Saturday. How many different arrangements of
medal winners are possible if medals will be for first, second and third place,
if there are 10 runners in the race …

n  10 r 3
n! 10! 10!
n
Pr   
(n - r)! (10 - 3)! 7!
 8  9 10  720
Number of ways is 720 69
Percentage
After having spent 35% of the money on machinery, 40% on raw material,
10% on staff, a person is left with Rs.60,000. What is the total amount of
money spent on machinery and the raw materials?

Let total amount =100% is X


Spending:
Machinery+Raw material+staff =35+40+10= 85%
Remaining percentage = 100 %– 85% = 15%
15 % of X = 60000=0.15 X=15/100*X 140000
X = 4,00,000 160000
In this 4,00,000
75% for machinery and raw material 40000
= 4,00,000* 75/100 = 3, 00,000 60000 70
Boats and streams
A man can row Upstream at 12 kmph and Downstream at 16
kmph. Find the man’s rate in still water and rate of the current?

(a  b) (16  12)
Rate in still water u    14 kmph
2 2
(a  b) (16  12)
Rate of Current v    2 kmph
2 2
71
Time and Distance
From height of 8 m a ball fell down and each time
it bounces half the distance back. What will be the
distance traveled? Sn 

a 1 r n
 a
1 r 1 r
= 8 + 4 + 4+2+2+1+1+0.5+0.5 +….etc.
The total distance traveled is 24 m
=8+2x4/(1-0.5)=8+16=24 m
72
Profit and Loss
A shopkeeper loses 7% by selling a cricket ball for Rs 31.
for how much should he sell the ball so as to gain 5%
First case S.P = Rs. 31 and Loss% = 7%
SP=CP(1–loss%/100)=CP(100–loss%)/100
CP=100*SP/(100–loss%) =(100*31)/(100-7)= 100/3
Second case, C.P = Rs 100/3 and gain% = 5%
S.P = CP(100+gain 5%)/100
= 100/3*(100+5 )/100 or 1.05*100/3
= Rs. 35 73
Cubes
• A cube of side 5 cm is divided into 125 cubes of equal size. It is painted on
all 6 sides.
1. How many cubes are coloured on only one side?
2. How many cubes are coloured on only two side?
3. How many cubes are coloured on only three side?
4. How many cubes are not coloured?
n5
1. 54 6(n  2)  6(5  2)  54
2 2

2. 36 12(n  2)  36
3. 8 8
4. 27 (n  2)  27
3
74
Probability formula
Number of favorable outcomes

Total number of possible outcomes n!
Arrangement order  pr 
n

n  r !
n!
Selection group   Cr 
n

r!n  r !
n(A  B  C)  n(A)  n(B)  n(C)
- n(A  B) - n(B  C )  n(A  C )  n(A  B  C )
n(A  B  C)  x  y  z  p  q  r  s
n(A)  n(B)  n(C)  x  y  z  2(p  q  r)  3s
Exactly one  x  y  z   Exactly two  p  q  r  
at least one       at least two    
All three  s   At most one  w  
At most two  w     Total  w       75
Venn Diagram
• In a group of 1000 people, there are 750 people who can
speak Hindi and 400 who can speak English. How many can
Speak Hindi only? a+b+c=1000
a+c=750; b=250
n( H U E) = 1000, n (H) = 750, n (E) = 400,
b+c=400;c=150
n( H ∪ E) + n( H ∩ E) = n (H) + n (E)
a=600
n ( H ∩ E) = 750 +400 – 1000
E
n ( H  E) = 1150 – 100 = 150 H
a= c= b=
No. of people can speak Hindi only=(a+c)-c 600 150 250
= n ( H) – n( H ∩ E)
= 750 – 150 = 600
speak english only = n ( E) – n( H ∩ E)=b+c-c=b
= 400 – 150 = 250 76
Venn Diagram
• In a class of 100 students, the number of students passed in English is 46, in
maths is 46, in commerce is 58. the number who passes in English and Maths
is 16, Maths and commerce is 24 and English and commerce is 26, and the
number who passed in all the subject is 7. find the number of the students
who failed in all the subjects.

Students who passed in one or more subjects E 19 15


11 C
= 11+ 9 + 13 + 17 + 15 + 19 + 7 = 91
7
No of students who failed in all the subjects 9 17
= 100 -91 = 9 M 13 9
77
Venn Diagram
• In a class of 100 students, the number of students passed in English is 46, in
maths is 46, in commerce is 58. the number who passes in English and Maths
is 16, Maths and commerce is 24 and English and commerce is 26, and the
number who passed in all the subject is 7. find the number of the students
who failed in all the subjects.

n(E ∪ M ∪ C) = n(E) + n(M) + n(C)


−n(E ∩ M)−n(M ∩ 𝐶) − n(E ∩ 𝐶) + n(E ∩ 𝑀 ∩ 𝐶)
E 19 15
11 C
=46+46+58-16-24-26+7= 91 7
9 17
No of students who failed in all the M 13 9
subjects = 100 -91 = 9 78
365 1
Number of odd days in 1 non - leap year   52  1odd days
7 7
366 2
Number of odd days in 1 leap year   52  2 odd days
7 7
Number of odd days in 4 years  3  2  5 odd days
100th ,200th and 300th years are non - leap years
400th year is a leap year
 100  124 5
Number of odd days in 100 years    5  1  124   17  5 odd days
 4  7 7
10 3
Number of odd days in 200 years  2  5   1  3 odd days
7 7
15 1
Number of odd days in 300 years  3  5   2  1odd days
7 7
21 0
Number of odd days in 400 years  4  5  1   3  0 odd days
7 7 79
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
0 1 2 3 4 5 6

Month Jan Feb Mar Apr May June July Aug Sept Oct Nov Dec
Days 31 28/29 (LY) 31 3 0 31 3 0 31 31 3 0 31 3 0 31
Odd Days 3 0/1(LY) 3 2 3 2 3 3 2 3 2 3
Day on 15th August 1947 : Odd Days upto 1946
Day on 15th August 1947  Odd Days upto 1946(1600  300  46)
1600 years  0 odd days; 300 years  1 odd day 35x1+11x2=57
346  300  46  leap years in 46 years  46  11  57 / 7   1odd day
Month Jan Feb Mar April May June July Aug
Days 31 28 31 30 31 30 31 15
Odd Days 3 0 3 2 3 2 3 1
Odd days in 1947 upto 15th Aug 3+0+3+2+3+2+3+1=17=3 odd days
Odd days upto 15th Aug 1947 are 1+1+3 = 5 odd days (Friday)
80
Years odd days
Odd days: Odd days are
Ordinary year 365%7 1 different from odd numbers.
Leap year 366%7 2 They are the number of days
more than the complete
4 years 5
number of weeks in a given
1+1+1+2=5
period.
100 years
100th, 200th, 300th years are
(100/4*5-1)%7= 5
non-leap years.
124%7=5
400th year is a leap year.
200 years(10%7) 3
300 years(15%7) 1
400 years(20+1)%7 0
81
Month Jan Feb Mar Apr May June July Aug Sept Oct Nov Dec
Days 31 28/29 (LY) 31 3 0 31 3 0 31 31 3 0 31 3 0 31
Odd Days 3 0/1(LY) 3 2 3 2 3 3 2 3 2 3

odd_days
Elements 0 1 2 3 4 5 6 7 8 9 10 11 12
NLY 0 3 3 6 1 4 6 2 5 0 3 5 1

LY 0 3 4 0 2 5 0 3 6 1 4 6 2
odd 0 1 2 3 4 5 6
day_names = ['Sunday', 'Monday', 'Tuesday’, 'Wednesday', 'Thursday', 'Friday', 'Saturday']
To be a leap year, the year number
must be divisible by four. (2024 is a
leap year)

100th, 200th, 300th years are non-leap


years. (1700,1800,1900,2100 are NLYs)
(year%400=100 or 200 or 300-NLY)

400th year is a leap year. (year%400=0)


(1600, 2000, 2400
1-36543798875
are LYs)
year%4 == 0 year%100!=0 4. Year=1994
year%400==0

3. Year=2024

2. Year=2100

1. Year=2400
date=int(input('Enter Date:'))
month=int(input('Enter Month:'))
year = int(input("Enter year(yyyy):"))
if year%4 == 0 and year%100!=0 or year%400==0:
odd_days=[0,3,4,0,2,5,0,3,6,1,4,6,2]
else: Enter Date:21
odd_days=[0,3,3,6,1,4,6,2,5,0,3,5,1] Enter Month:8
year1=year-1 Enter year(yyyy):2023
year2=year1%400 1
if year2>300: Monday
odd1=1
year3=year2%300
elif year2>200:
odd1=3
year3=year2%200 Enter Date:15
elif year2>100: Enter Month:8
odd1=5 Enter year(yyyy):1947
year3=year2%100 1
else: 1
year3=year2 3
odd1=0 5
odd2=(year3+year3//4)%7 Friday
odd3=(date+odd_days[month-1])%7
odd=(odd1+odd2+odd3)%7
print(odd)
day_names = ['Sunday', 'Monday', 'Tuesday',
'Wednesday', 'Thursday', 'Friday', 'Saturday']
print(day_names[odd])
1) If January 1, 1996, was Monday, what day of the week was January 1,
1997?
A. Thursday B. Wednesday C. Friday D. Sunday
2) The first republic day of India was celebrated on January 26, 1950.
What day of the week was it?
A. Wednesday B. Friday C. Thursday D. Tuesday
3) On February 5, 1998, it was Thursday. The day of the week on
February 5, 1997, was
A. Wednesday B. Monday C. Friday D. Sunday
4) Today is Wednesday, after 68 days, it will be
A. Friday B. Sunday C. Monday D. Thursday
5) What was the day of the week on June 17, 1991?
A. Tuesday B. Wednesday C. Friday D. Monday
Answers: 1. B 2. C 3. A 4. C 5. D 87
h=[0,1,2,3,4,5,6,7,8,9,10,11]
angle=30
for i in range(0,12):
m1=(30*h[i]-angle)/5.5
if(m1<0):
m1=(30*h[i]+360-angle)/5.5
m2=(30*h[i]+angle)/5.5
if m2>60:
m2=(30*h[i]-angle)/5.5
print(h[i],' h m1= ', m1, 'm m2=',m2, 'm')
angle=30
0 h m1= 60.0 m m2= 5.454545454545454 m
1 h m1= 0.0 m m2= 10.909090909090908 m
2 h m1= 5.454545454545454 m m2= 16.363636363636363 m
3 h m1= 10.909090909090908 m m2= 21.818181818181817 m
4 h m1= 16.363636363636363 m m2= 27.272727272727273 m
5 h m1= 21.818181818181817 m m2= 32.72727272727273 m
6 h m1= 27.272727272727273 m m2= 38.18181818181818 m
7 h m1= 32.72727272727273 m m2= 43.63636363636363 m
8 h m1= 38.18181818181818 m m2= 49.09090909090909 m
9 h m1= 43.63636363636363 m m2= 54.54545454545455 m
10 h m1= 49.09090909090909 m m2= 60.0 m
11 h m1= 54.54545454545455 m m2= 54.54545454545455 m
The correct option is (C)
Explanation:
⇒ 1600 years are divisible by 400, so the year 1600 has 0 odd days.
⇒ 300 years have 1 odd day.
⇒ 49 years = (12 leap years + 37 years)
= (12*2, odd days + 37*1, odd days)= 24 + 37 = 61 odd days
On dividing 61 by 7, we get remainder 5, so 49 years have 5 odd
days.
⇒From January 26, 1950, to January 26, 1950, we have 26 days.
26 days = 3 weeks + 5 odd days
So, total number of odd days = 1 + 5 + 5 = 11 days
⇒11 days = 1 week + 4 odd days
4 odd days represent Thursday, so it was Thursday on January 26,
1950. 90
Explanation:
June 17, 1991 =(1990 years+period from 01.01.1991 to 17.06.91)
⇒Odd days in 1600 years = 0
⇒Odd days in the next 300 years = 15 odd days (2 week + 1 odd
day) = 1 odd day
90 years have 22 leap years + 68 ordinary years.
⇒Number of odd days in 90 years = 22*2 + 68*1 = 112 odd days
(16 weeks + 0 odd day) = 0 odd day
Number of odd days from 01.01.91 to 17.06.91= Jan. (31) + Feb.
(28) + March (31) + April (30) + May (31) + June (17) = 168 days
⇒168 days = 24 weeks + 0 odd days
Total number of odd days = 0 + 1 + 0+ 0 = 1 odd day
1 odd day represents Monday, so the given day was Monday.
91
6) Which of the following years is not a leap year?
A. 800 B. 700 C. 1600 D. 2000
7) How many days are there in y weeks y days?
A. 8y B. 8y2 C. 16y D. 21y
8) The day on 5th April of a year will be the same day on 5th of which month
of the same year?
A. 5th July B. 5th August C. 5th June D. 5th October
9) It was Saturday on January 1, 2005. Find the day of the week on January
1, 2010.
A. Tuesday B. Friday C. Wednesday D. Sunday
10) If it was Wednesday on March 1, 2006, which day was it on March 1,
2002?
A. Tuesday B. Friday C. Monday D. Sunday
Answers: 1. B 2. A 3. A 4. B 5. B
92
12 divisions in the clock: Angle at a point is 3600
0 0
30 x  0.5 y  6 y
Angle between any two divisions =360 /12=30
Angle made by hours hand in 1 hour= 300
Angle made by hours hand in 1 minute= 30/60 = 0.50
Angle made by minutes hand in 1 hour= 3600
Angle made by minutes hand in 1 minute= 360/60 = 60
Relative Angle between minutes and hours hand in 1 minute
= 60 - 0.50 =5.50 =(11/2)0
Angle between minutes and hours hand at 11
x hours and y minutes  30 x  5.5 y  30 x  y
2

Angle between minutes and hours hand is


zero or coincide between x and x+1 hours
x 60 x
x hours or x hours minutes 93
11 11 93
# Python program to find angle between hour and minute hands
# Function to Calculate angle b/w hour hand and minute hand
def calcAngle(h,m):
# validate the input
if (h < 0 or m < 0 or h > 24 or m > 60):
print('Wrong input-Solution for the given data is as follows:')
if h == 12:
h=0
if m >=60:
h=h+m//60
m=m%60
if(h>12):
h = h%12;
# Calculate the angles moved by hour and minute hands
Enter hours: 9
print('h=',h) Enter minutes: 30
print('m=',m) Angle 105.0
hour_angle = 0.5 * (h * 60 + m)
minute_angle = 6 * m
# Find the difference between two angles hour_angle = abs(30* h + 0.5*m)
angle = abs(hour_angle - minute_angle)
# Return the smaller angle of two
# possible angles Enter hours: 9
angle = min(360 - angle, angle) Enter minutes: 80
return angle Wrong input-Solution for the given
h =int(input('Enter hours: ')) data is as follows:
m =int(input('Enter minutes: ')) h=10
print('Angle ', calcAngle(h,m)) m1=(30*h-angle)/5.5
m=20
m2=(30*h+angle)/5.5
Angle 170.0
Angle between hours hand and Minutes hand
at x hours and y Minutes
11
 30 x  5.5 y  30 x  y 
2
11 When   0
 30 x  y   and
2 hours hand and Minutes hand will coincide
11 11 11 60 x
30 x  y   30 x  y  0  y  30 x  y 
2 2 11
2 60 x
Hours hand and Minutes hand will coincide at x Hours and Minutes
x 11
or x hours
11 96
6 hours to 12 hours 0 hours to 5 hours
11 11
 30 x  y  180 30 x  y  180
2 2
11
11
y  30 x  180  y  30 x  180 
2 2
60 x  360 60 x  360
y Minutes y Minutes
11 11
x6 x6
or Hours or Hours
11 11
97
10.10 11.40

4.45

5.00 6.45
Angle between minutes and hours hand is
zero or coincide between x and x+1 hours
x 60 x
x hours or x hours minutes
11 11
Angle between minutes and hours hand is
zero or coincide between x and x+1 hours
1 2 3 4 5 6 7 8 9 10 11
0,1 , 2 ,3 ,4 ,5 , 6 ,7 ,8 ,9 ,10 ,11 or 12 or 0  11times in 12 hours
11 11 11 11 11 11 11 11 11 11 11
Angle between minutes and hours hand is 1800 between x and
x+1 hours x6
x
6 7 8 9 10 11 1 2 3 4 5
11
0 ,1 , 2 ,3 ,4 ,5 or 6 , 7 ,8 ,9 ,10 ,11  11times in 12 hours
11 11 11 11 11 11 11 11 11 11 11
22 times 00 and 1800in 24 hours
11 times in 12 hours 44 times any angle in 24 hours99
Time duration Hours hand and Minutes x Hours hand and Minutes x  6
hand Coincide at
x hand make 180 at x
11 11
In hours In hours and In hours In hours and
minutes minutes
12 to 1 0 6 360 8
0 or 0 or 12 0 or 12 h or m 12 hrs 32 min
0 to 1 11 11 11 11
1 to 2 1 1 h
60
m  1h 5
5
m 7 2
1 11 11 1 1hrs 38 min
11 11 11
2to 3 2 10 8 7
2 2h10 m 2 2hrs 43 min
11 11 11 11
3 to 4 3 4
3
9 1
3 3h16
11
m
11 3hrs 49 min
11 11
4 to 5 4 9
4
10
4 4h 21
11
m
11
6
4hrs 54 100 min
11 11
Time duration Hours hand and Minutes x Hours hand and Minutes x  6
hand Coincide at
x hand make 180 at x
11 11
In hours In hours and In hours In hours and
minutes minutes
5 to 6 5 5h 27
3
m 5
11
or 6 6 hrs 0 min
5 11 11
11
6 to 7 6 8 66
6 6h 32 m 6 or 6 6 hrs 0 min
11 11 11
7to 8 7 2 1 60 5
m  7h5 m
7 7hrs 38 min 7 7h
11 11
11 11 11
8 to 9 8 7 8
2 10
8 8hrs 43 min
11
8h 10
11
m
11 11
9 to 10 9 1 9
3 4
9 9hrs 49 min
11 9h 16 m
11 11 11
101
Time duration Hours hand and Minutes x Hours hand and Minutes x  6
x x
hand Coincide at 11 hand make 180 at 11
In hours In hours and In hours In hours and
minutes minutes
10 to 11 10 6
10h54 m 10
4 9
10 11 11
10h 21
11
m
11
11 to 12 11 0h 0m 5 3
11  0 or 12 12h 0m
11 11h 27 m
11
11 11

102
11 11
 30 x  y  45  30 x  y  45
2 2
11 11
y  30 x  45  y  30 x  45 
2 2
60 x  90 60 x  90
y Minutes y Minutes
11 11
Angle is 45 between 5 hrs and 6 hrs i.e., at 5hrs y minutes
60 x  90 300  90 210 60 x  90 300  90 390 5
y    19
1 y    35
11 11 11 11 11 11 11 11
o 1 5
Angle is 45 at 5 hrs 19 minutes & 5 hrs 35 minutes
11 11 103
1
At 5 hrs 19 11
minutes angle is 45
5
At 5 hrs 35 minutes angle is 45
11

450 450

104
2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89 and 97 (25)

1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50
51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70
71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100
Prime numbers between 1 - 100
50 equals 2 * 25.0 75 equals 3 * 25.0
import math 51 equals 3 * 17.0 76 equals 2 * 38.0
52 equals 2 * 26.0 77 equals 7 * 11.0
a=int(input(a=)) 53 is prime 78 equals 2 * 39.0
a=int(input(b=)) 54 equals 2 * 27.0
55 equals 5 * 11.0
79 is prime
80 equals 2 * 40.0
for n in range(a,b): 56 equals 2 * 28.0 81 equals 3 * 27.0
57 equals 3 * 19.0 82 equals 2 * 41.0
n1=int(math.sqrt(n)) 58 equals 2 * 29.0 83 is prime
59 is prime 84 equals 2 * 42.0
#print(n1) 60 equals 2 * 30.0 85 equals 5 * 17.0
61 is prime 86 equals 2 * 43.0
for i in range(2,n1+1): 62 equals 2 * 31.0 87 equals 3 * 29.0
if n % i == 0: 63 equals 3 * 21.0
64 equals 2 * 32.0
88 equals 2 * 44.0
89 is prime
print(n,'equals', i, '*', n/i) 65 equals 5 * 13.0 90 equals 2 * 45.0
66 equals 2 * 33.0 91 equals 7 * 13.0
break 67 is prime 92 equals 2 * 46.0
68 equals 2 * 34.0 93 equals 3 * 31.0
else: 69 equals 3 * 23.0 94 equals 2 * 47.0
# loop fell through without finding a factor 70 equals 2 * 35.0
71 is prime
95 equals 5 * 19.0
96 equals 2 * 48.0
print (n, 'is prime') 72 equals 2 * 36.0 97 is prime
73 is prime 98 equals 2 * 49.0
74 equals 2 * 37.0 99 equals 3 * 33.0
a=int(input("Enter Lower Number a:"))
b=int(input("Enter Lower Number b:"))
print("Prime numbers:",end=' ')
n1=0
for n in range(a,b+1):
if n==1:
continue
for i in range(2,int(n**0.5)+1):
if(n%i==0): Enter Lower Number a:1
break Enter Lower Number b:100
else: Prime numbers: 2 3 5 7 11 13 17 19 23 29 31 37 41
print(n,end=' ') 43 47 53 59 61 67 71 73 79 83 89 97
n1=n1+1 Prime numbers between 1 and 100 are: 25
print('\nPrime numbers between',a,'and',b, 'are: ', n1)
num = int(input("Enter a number: ")) num = int(input("Enter a number: "))
n1 = 0 n1 = 0
n=2 n=2
l=[]
print("First", num, "prime numbers are: ") print("First", num, "prime numbers
while n1 < num: are: ")
for i in range(2, int(n**0.5) + 1): while n1< num:
if (n % i) == 0: for i in range(2, int(n**0.5) + 1):
break if (n % i) == 0:
else: break
else:
print(n, end =" ") l.append(n)
n1 = n1 + 1 n1 = n1 + 1
n=n+1 n=n+1
print(l)
Enter a number: 5 Enter a number: 25
First 5 prime numbers are: First 25 prime numbers are: [2, 3, 5, 7, 11, 13, 17, 19, 23,
2 3 5 7 11 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
Last two digits of Powers of numbers ending with 1,3,7,9
(41)786=last two digits= (4x6) 1=41; (31)2789= 71;(51)876*61397=06*21 = 26
(81)56747=-61;(19)266=(192)133 = (361)133=81
(33)288=(334)72=(1089 * 1089)72=2172=41
(87)474=87472 * 872 = (874)118= (69*69)118 * 69 = (-61)118*69 = 81*69 = 89
Last two digits of Powers of numbers ending with 2,4,6,8
(24)2n-1= ….24; (24)2n=…..76; 210=1024; 2543=(210)54* 23 = 76*8 = 08
(62)586=(2*31)586=2586 * 3586 = (210)58 * 26 * 31586 = 76*64*81 = 84
(54)380=(2*33)380 = (210)38*(34)385 = 76*81285 = 76*01 = 76
(56)283 = (23 * 7)283 = (210)84 * 29 * (74)76 * 73 = 76 * 12 * 01 70 * 43 = 16 =
(78)379 = (2 * 49)379 = 2379 * 39379 = (210)37 * 29 * (392)189 * 39 = 24*12*81*39 = 92

109
Number of factors is odd for a perfect square
A  182  324  1,2,3,4,6,9,12,18,27,36,54,81,96,162,324(15)
324  2 2  34 Total factors N  (2  1)(4  1)  15
Odd factors  4  1  5; Even factors  15  5  10;
2 21  1 35  1
Sum of factors   7 121  847
2 1 3 1 Product of factors  A N / 2  32415 / 2  1815
Units, tens,hundreds,thousands,ten thousands, lakhs105,ten lakhs,Crores107
Units, tens,hundreds,thousands,ten thousands, hundred thousands,
millions 106,ten millions , hundred millions , Billions 109
Divisibility rules: 7*2 (-), 11*1(-),13*4(+), 17*5(-), 19*2(+), 21*2(-),
23*7(+), 29*3(+), 31*3 (-), 37*11 (-), 41*4 (-), 43*13 (+), 47*14 (-)
Divisibility of 6846 by 7 6846; 684-12=672; 67-4=63 Divisible by 7
How many trailing zeroes would be found in 4617!, upon expansion?
4617 4617 4617 4617 4617 4617
 2  3  4  5  6
5 5 5 5 5 5
 923.4  184.68  36.936  7.3872  1.47744  0.295488
 923  184  36  7  1  0  1151
Then 4617! has 923 + 184 + 36 + 7 + 1 = 1151 trailing zeroes
110
(an -bn ) is always divisible by (a-b)
if n is even or odd
(an -bn ) is divisible by (a+b) if n is even
(an +bn ) is always divisible
by (a+b) if n is odd

111
Mensuration
Square 1 P  4 a; A  a 2 Diagonals are equal and Perpendicular bisectors
Rhombus 2 P  4 a; A  ah Diagonals are Perpendicular bisectors
Rectangle2 P  2l  b ; A  lb Diagonals are equal and bisector
Parallelogram3 P  2 l  b ; A  lh Diagonals bisect each other
Exterior angle+ Interior angle at any vertex=180 0
Trapezium4
Sum of exterior angles +Interior angles=n x 1800
Quadrilateral 5 Sum of exterior angles=3600 Sum of Interior angles=nx1800-3600
Polygon Exterior angle of a regular polygon of n sides=360/n
Interior angle of a regular polygon of n sides=180-360/n
Number of diagonals  n(n  3) / 2
Rectangular Prism LSA  2( b h  l h); TSA  2(l b  b h  l h);V  l b h
Prism LSA  Perimeter of the base  height; TSA  LSA  2  base area ;
V  base area  height Cylinder LSA  2 rh; TSA  2 ( r  h);V   r h
2

Pramid LSA  Perimeter of the base  lateral height; TSA  LSA  base area ;
Cone LSA   rl TSA   r l  r  V  r h
1 2
V  base area  height / 3
1 2 3
TSA  SA = b + 2  b  lateral height;V  b h
2

3
b Sphere LSA  TSA  4 r ;V  4 / 3 r
2 3 112
Points of intersection of medians, perpendicular bisectors, angular bisectors and
d
altitudes give centroid (CG), circum centre(CC), in-centre(IC) and ortho-centre(OC)
respectively. All points lies inside in acute triangle. OC at right angle and CC at
centre point of hypotenuse in right angle triangle. OC at outside right angle and CC
at outside hypotenuse in obtuse triangle. P=a+b+c; s=(a+b+c)/2
1 Sum of interior angles in a triangle =1800
A  bh  s ( s  a)( s  b)( s  c)
2 Sum of exterior angles=360
Acute angle: One angle measures greater than 0 degrees and less than 900
Straight angle: A line that goes infinitely in both directions and measures 1800
Obtuse angle: One angle measures greater than 900 and less than 1800
Scalene triangle: A triangle that has no congruent (equal) sides
Isosceles triangle: A triangle with at least two congruent (equal) sides
Equilateral triangle: A triangle with three congruent (equal) sides and angles
113
1
4  900 2 2

2 3 2  
1 2 3 4
1
1  
5 7
P  2 r   d ; A r 2 6
1. Cyclic quadrilateral; Sum of oppositeb angles is supplementary
1  3  1800 and 2  4  1800
2. Angle made by chord with centre is twice the angle made with any point on the circumference

3. Angle in a semi circle is right angle (900 ) or


Angle made by diameter with any point on the circumference of the circle is 900

4. 1 is minor sector and 2 is major sector; Area of the minor sector=  / 360 r
2

2
sin 
5. 1 is minor segment and 2 is major segment; Area of the minor sector=  / 360 r 2 
r
2

6 & 7. The angle made by a chord with tangent is equal to the angle made by the chord with
any point on the circumference of other segment
114
115
’BODMAS’Rule: This rule depicts the correct sequence in which the operations are to be executed,so as
to find out the value of a given expression.
Here, ‘B’ stands for ’bracket’ ,’O’for ‘orders’ , ‘D’ for’ division’ and ‘M’ for ‘multiplication’, ‘A’ for
‘addition’ and ‘S’ for ‘subtraction’.
Modulus of a real number : Modulus of a real number a is defined as
|a| ={a, if a>0 and =-a, if a<0 Thus, |5|=5 and |-5|=-(-5)=5.
III. Virnaculum (or bar): When an expression contains Virnaculum, before
applying ‘BODMAS’ rule, we simplify
the expression under the Virnaculum.
Orders: Do anything involving a power or a square root

78 - [24 - {16 - (5 – 4 - 1)}]


= 78 - [24 - {16 - (5 - 3)}]= 78 -[24 - {16 - 2}]= = 78 - [24 – 14]=68
Blood Relations:
1)Grand Parents: Grand father, Grand mother, Grand uncle, Grand aunt
2) Parents and In-Laws: Father, Mother, Uncle, Aunt, Father-in-law, Mother-in-law 3) Siblings,
Spouse & in-Laws: Brother, Sister, Cousin, Wife, Husband, Brother in-law, Sister in-law
4) Children & In-Laws: Son,Daughter,Niece, Nephew, Sister, Cousin, Son in-law, Daughter in-Law
5) Grand Children: Grandson, Granddaughter 116
Percentage
1. Concept of Percentage : By a certain percent ,we mean that many hundredths. Thus x
percent means x hundredths, written as x%.
To express x% as a fraction : We have , x% = x/100. Thus, 20% =20/100 =1/5; 48% =48/100
=12/25, etc.
To express a/b as a percent : We have, a/b =((a/b)*100)%.
Thus, ¼ =[(1/4)*100] = 25%; 0.6 =6/10 =3/5 =[(3/5)*100]% =60%.
2. If the price of a commodity increases by R%, then the reduction in consumption so asnot to
increase the expenditure is [R/(100+R))*100]%.
If the price of the commodity decreases by R%,then the increase in consumption so as to
decrease the expenditure is [(R/(100-R)*100]%.
3. Results on Population : Let the population of the town be P now and suppose it increases
at the rate of R% per annum, then :
1. Population after nyeras = P [1+(R/100)]^n.
2. Population n years ago = P /[1+(R/100)]^n.
4. Results on Depreciation : Let the present value of a machine be P. Suppose it depreciates
at the rate R% per annum. Then,
1. Value of the machine after n years = P[1-(R/100)]n.
117
2. Value of the machine n years ago = P/[1-(R/100)]n.
Profit and Loss
Cost price: the price at which article is purchased CP
Selling price: the price at which article is sold SP and Marked price MP
Profit, Loss and discount:
Profit=Selling price-Cost price; Loss=Cost price-Selling price;
Percentage profit=Profit/CPX100; Percentage Loss =Loss/CPX100
if the article is sold at a gain of say 35%, then sp =135% of cp=1.35 cp
Item is sold at a loss of 35%,then SP=65%of CP =(1-.35)CP=0.65CP
when a person make marked priceat a gain of x% and offer discount of x%.then the seller
always incures a loss.
{loss%=(common loss and gain ) 2}/10.=(x/10)2 = x2/100
If the trader professes to sell his goods at cp but uses false weights,then gain=[error/(true value)-
(error)*100]% New value  Original value
Percentage change  100
Original Value

MP  CP (1  p1 / 100) SP  MP (1  d / 100) SP  CP (1  p / 100)


Profit % p  p1- d - p1 d/100
118
RATIO and PROPORTION:

I. RATIO: The ratio of two quantities a and b in the same units, is the fraction a/b and we write it as a:b. In
the ratio a:b, we call a as the first term or antecedent and b, the second term or consequent.
Ex. The ratio 5: 9 represents 5/9 with antecedent = 5, consequent = 9.
Rule: The multiplication or division of each term of a ratio by the same non-zero number does not affect
the ratio. Ex. 4: 5 = 8: 10 = 12: 15 etc. Also, 4: 6 = 2: 3.
2. PROPORTION: The equality of two ratios is called proportion.
If a: b = c: d, we write, a: b:: c : d and we say that a, b, c, d are in proportion . Here a and d are called
extremes, while b and c are called mean terms.
Product of means = Product of extremes. Thus, a: b:: c : d <=> (b x c) = (a x d).
3. (i) Fourth Proportional: If a : b = c: d, then d is called the fourth proportional to a, b, c. (ii) Third
Proportional: If a: b = b: c, then c is called the third proportional to a and b. (iii) Mean Proportional: Mean
proportional between a and b is square root of ab

4. (i) COMPARISON OF RATIOS:


We say that (a: b) > (c: d) <=> (a/b)>(c /d). (ii) COMPOUNDED RATIO:
The compounded ratio of the ratios (a: b), (c: d), (e : f) is (ace: bdf)
5. (i) Duplicate ratio of (a : b) is (a2 : b2).
(ii) Sub-duplicate ratio of (a : b) is (√a : √b) (iii)Triplicate ratio of (a:b) is (a3:b3) iv) Sub-triplicate ratio of (a
: b) is (a ⅓ : b ⅓ ).
(v) If (a/b)=(c/d), then((a+b)/(a-b))=((c+d)/(c-d))(Componendo and dividendo) 119
PARTNERSHIP
1.Partnership: When two or more than two persons run a business jointly, they are called partners and
the deal is known as partnership.
2.2. Ratio of Division of Gains:
i) When investments of all the partners are for the same time, the gain or loss is distributed a among
the partners in the ratio of their investments.
Suppose A and B invest Rs. x and Rs. y respectively for a year in a business, then at the end of the
year:
(A’s share of profit) : (B's share of profit) = x : y.
ii) When investments are for different time periods, then equivalent capitals are calculated for a
unit of time by taking (capital x number of units of time). Now, gain or loss is divided in the ratio of these
capitals.
Suppose A invests Rs. x for p months and B invests Rs. y for q months, then
(A’s share of profit) : (B's share of profit) = xp : yq.
3. Working and Sleeping Partners: A partner who manages the business is known . as a working
partner and the one who simply invests the money is a sleeping partner.

32=9=4+5 52=32+42
52=25=12+13 132=52+122 Pythagorean triple:
72=49=24+25 252=72+242
92=81=40+41 412=92+402 120
PIPES AND CISTERNS
(i) If a pipe can fill a tank in x hours, then part filled in 1 hour = 1/x
(ii) If a pipe can empty a full tank in y hours, then part emptied in 1 hour = 1/y
(iii) If a pipe can fill a tank in x hours and another pipe can empty the full tank in y
hours (where y> x), then on opening both the pipes, the net part filled in 1 hour = (1/x)-
(1/y)
(iv) If a pipe can fill a tank in x hours and another pipe can empty the full tank in y
hours (where x > y), then on opening both the pipes, the net part emptied in 1 hour =
(1/y)-(1/x) TIME AND DISTANCE
Distance  Speed  Time; Speed  Distance/Time; Time  Distance/Speed
If the ratio of the speeds of A and B is a:b , then the ratio of the times
taken by them to cover the same distance is b:a.
Suppose a man covers a certain distance at x km/ hr and an equal
distance at y km / hr . Then, the average speed during the whole journey is
2xy/(x+y) km/ hr. Total Distance  di  v i t i  v iti  di
Average Speed     
Total time t i t i d / v
i i d / v
i i
BOATS AND STREAMS: 1.In water ,the direction along the stream is called downstream
and ,the direction against the stream is called upstream.
2.If the speed of a boat in still water is u km/hr and the speed of the stream is v km/hr,then:
speed downstream=(u+v)km/hr. speed upstream=(u-v)km/hr.
3.If the speed downstream is a km/hr and the speed upstream is b km/hr,then speed in still
121
water=1/2(a+b)km/hr rate of stream=1/2(a-b)km/hr
PROBLEMS ON TRAINS:1. a km/hr=a*5/18 m/s 2.a m/s= (a*18/5) km/hr.
3 Time taken by a train of length 1 metres to pass a pole or a standing man or a signal
post is equal to the time taken by the train to cover 1 metres.
4. Time taken by a train of length 1 metres to pass a stationary object of length b metres
is the time taken by the train to cover (1 + b) metres.
5. Suppose two trains or two bodies are moving in the same direction at u m / s and v
m/s, where u > v, then their relatives speed = (u - v) m / s.
6. Suppose two trains or two bodies are moving in opposite directions at u m / s and v
m/s, then their relative speed is = (u + v) m/s.
7. If two trains of length a metres and b metres are moving in opposite directions at u
m / s and v m/s, then time taken by the trains to cross each other = (a + b)/(u+v) sec.
8.If two trains of length a metres and b metres are moving in the same direction at u m /
s and v m / s, then the time taken by the faster train to cross the slower train
= (a+b)/(u-v) sec.
9. If two trains (or bodies) start at the same time from points A and B towards each
other and after crossing they take a and b sec in reaching B and A respectively, then
BOATS AND STREAMS
1.In water ,the direction along the stream is called downstream and ,the direction
against the stream is called upstream.
2.If the speed of a boat in still water is u km/hr and the speed of the stream is v
km/hr,then: speed downstream=(u+v)km/hr. speed upstream=(u-v)km/hr.
3.If the speed downstream is a km/hr and the speed upstream is b km/hr,then speed in 122
still water=1/2(a+b)km/hr rate of stream=1/2(a-b)km/hr
SIMPLE INTEREST
1. Principal: The money borrowed or lent out for a certain period is called the
principal or the sum.
2. Interest: Extra money paid for using other's money is called interest.
3. Simple Interest (S.I.) : If the interest on a sum borrowed for a certain period is
reckoned uniformly, then it is called simple interest.
Let Principal = P, Rate = R% per annum (p.a.) and Time = T years. Then,
S.I. = (P*T*R )/100 Amount A=P+SI
Compound Interest: Sometimes it so happens that the borrower and the lender agree
to fix up a certain unit of time, say yearly or half-yearly or quarterly to settle the
previous account.
In such cases, the amount after first unit of time becomes the principal for the second
unit, the amount after second unit becomes the principal for the third unit and so on.
After a specified period, the difference between the amount and the money
borrowed is called the Compound Interest (abbreviated as C.I.) for that period.
Amount = P(1+R/100)n Compound Interest CI=A-P =P(1+R/100)n -P
II. When interest is compounded Half-yearly: Amount = P[1+(R/2)/100]2n
III. When interest is compounded Quarterly: Amount = P[ 1+(R/4)/100]4n
IV. When interest is compounded AnnuaI1y but time is in fraction, say 3(2/5)
years. Amount = P(1+R/100)3 x (1+(2R/5)/100)
V. When Rates are different for different years, say Rl%, R2%, R3% for 1st, 2nd and 3rd
year respectively. Then, Amount = P(1+R1/100)(1+R2/100)(1+R3/100)
VI. Present worth of Rs.x due n years hence is given by : Present Worth = x/(1+(R/100))n 123
PERMUTATIONS AND COMBINATIONS
Factorial Notation: Let n be a positive integer. Then, factorial n, denoted by
n! is defined as: n! = n(n-1)(n-2)........3.2.1.
Examples: (i) 5! = (5x 4 x 3 x 2 x 1) = 120; (ii) 4! = (4x3x2x1) = 24 We
define, 0! = 1.
Permutations: The different arrangements of a given number of things by
taking some or all at a time, are called permutations.
Ex. 1.All permutations (or arrangements) made with the letters a, b, c by taking
two at a time are: (ab, ba, ac, bc, cb).
Ex. 2.All permutations made with the letters a,b,c, taking all at a time are:
(abc, acb, bca,bac,cab,cba)
Number of Permutations: Number of all permutations of n things, taken r at a
time, given by: nPr = n(n-1)(n-2).....(n-r+1) = n!/(n-r)!
Examples: (i) 6p2 = (6x5) = 30. (ii) 7p3 = (7x6x5) = 210.
Cor. Number of all permutations of n things, taken all at a time = n!
An Important Result: If there are n objects of which p1 are alike of one kind;
p2 are alike of another kind; p3 are alike of third kind and so on and pr are
alike of rth kind, such that (p1+p2+.......pr) = n.
Then, number of permutations of these n objects is: n! / ((p1!).p2!)......(pr!)) 124
Combinations: Each of the different groups or selections which can be formed
by taking some or all of a number of objects, is called a combination.
Ex. 1. Suppose we want to select two out of three boys A, B, C. Then, possible
selections are AB, BC and CA.
Note that AB and BA represent the same selection.
Ex. 2. All the combinations formed by a, b, c, taking two at a time are ab, bc,
ca.
Ex. 3. The only combination that can be formed of three letters a, b, c taken all
at a time is abc.
Ex. 4. Various groups of 2 out of four presons A, B, C, D are:
AB, AC, AD, BC, BD, CD.
Ex. 5. Note that ab and ba are two different permutations but they represent the
same combination.
Number of Combinations: The number of all combination of n things, taken r
at a time is:
nC = n! / (r!)(n-r)! = n(n-1)(n-2).....to r factors / r!
r
Note that: ncn = 1 and nC0 = 1. An Important Result: nCr = nC(n-r).
Example: (i) 11C4 = (11x10x9x8)/(4x3x2x1) = 330.
(ii) 16C13 = 16C(16-13) = 16x15x14/3! = 16x15x14/3x2x1 = 560.
125
PROBABILITY
1.Experiment :An operation which can produce some well-defined outcome is called an experiment
2.Random experiment: An experiment in which all possible outcome are known and the exact
out put cannot be predicted in advance is called an random experiment Eg of performing random
experiment: (i)rolling an unbiased dice (ii)tossing a fair coin (iii)drawing a card from a pack of well
shuffled card
(iv)picking up a ball of certain color from a bag containing ball of different colors
Details: (i)when we throw a coin. Then either a head(h) or a tail (t) appears.
(ii)a dice is a solid cube, having 6 faces ,marked 1,2,3,4,5,6 respectively when we throw a die , the
outcome is the number that appear on its top face .
(iii)a pack of cards has 52 cards it has 13 cards of each suit ,namely spades, clubs ,hearts and diamonds.
Cards of spades and clubs are black cards Cards of hearts and diamonds are red cards There are 4 honors
of each suit These are aces ,king ,queen and jack These are called face cards
3.Sample space :When we perform an experiment ,then the set S of all possible outcome is
called the sample space eg of sample space: (i)in tossing a coin ,s={h,t} (ii)if two coin are tossed ,then
s={hh,tt,ht,th}. (iii)in rolling a die we have,s={1,2,3,4,5,6} 4.event:Any subset of a sample space.
5.Probability of occurrence of an event. let S be the sample space and E be the event then, E  S.
P(E)=n(E)/n(S). 6.Results on Probability:
(i)P(S) = 1 (ii)0<P(E)<1 (iii)P(f)=0 (iv)For any event a and b, we have:
P(a b)=P(a)+P(b)-P(a
 b) (v)If A denotes (not-a),then P(A)=1-P(A). 126
7 10 11
27 27
2 2
6 9 25
6 8 25 12
5 5 4
8 13
5 9 21 21
4 4 6
7 14
10 15 15
4 5
3 3 6 3 Dices 15
3 2 Dices/Cubes 11
10
4
10
2 2 5 16
2
6 Probability of 6
Probability of 1 12 3 17
1 4 getting sum as 9 or 12 is
getting sum as 6 or 8 is 3 3
3 2 25/63 18
5/62 1 1

4 clubs: 13x4=52 cards; 4 honors(A,K,Q,J) spades (♠),


hearts (♥),
diamonds (♦)
and clubs (♣)

127
Important Formulas - Time and Work
If A can do a piece of work in n days, work done by A in 1 day = 1/n
If A does 1/n work in a day, A can finish the work in n days
If M1 men can do W1 work in D1 days working H1 hours per day and M2 men can do W2 work in D2 days
working H2 hours per day (where all men work at the same rate), then M1 D1 H1 / W1 = M2 D2 H2 / W2
If A can do a piece of work in p days and B can do the same in q days, A and B together can finish it in pq /
(p+q) days
If A is thrice as good as B in work, then Ratio of work done by A and B = 3 : 1 .
Ratio of time taken to finish a work by A and B = 1 : 3
A and B can complete the work separately in 18 days and 9 days
Work done by A in 1 day = 1/18; Work done by B in 1 day = 1/9
Work done by A and B in 1 day = 1/18 + 1/9 = 1/6;
A and B can complete in 6 days
Overall look of Alphabets
AZ BY CX ….DW 1 26 2 25 3 24 4 23
AN BC GM EF ;Na, Cb, Mg, Fe Cb is not an element
E-5 U, O, _, E, A Vowels in reverse order
J-10, 0-15
Application: Applying Number Series:
T-20 Add, Delete, Square, Cubes, Prime Numbers,
Fibonacci, Sum of factors, Square a ; Cubes a 128
129
There are many more different-sized squares on the chessboard. Therefore, there are
actually  m 2   82  204 squares on a chessboard!
m(m  1)(2m  1) 8(8  1)(16  1)
m  2

6

6
 204
A rectangle is formed by two vertical and two horizontal lines. On an 8x8 chessboard,
you can choose two vertical lines in C(9, 2) = 9!/(2!*7!) = 36 different ways. Similarly you can
choose two horizontal lines in 36 different ways. So, the answer is  m3   83  36*36 = 1296

   m  4
2 2
3 m 2( m 1)
If m <= n If m=n m
Squares on a Rectangle=
=m(m+1)(2m+1)/6 + (n-m)*m(m+1)/2   ( n  m)  m
m 2

Total Rectangles = nm(1+n)(1+m)/4  m n

130
m  n 1
Cn 1

A B

131
CUBES:
Cubes with 3 faces colored or visible(8 corners)=1 x 8= 8
Cubes with 2 faces colored/visible(12 edges)=(n-2) x12= 12n-24
Cubes with 1 face colored/visible(6 faces)=(n-2)2 x6= 6n2-24n+24
Cubes not visible(n-2 cube)=(n-2)3 =n3-6n(n-2)-8 = n3-6n2+12n-8
Total number of cubes=8+ 12n-24+ 6n2-24n+24+n3-6n2+12n-8=n3

132
CUBES:
Cubes with 3 faces colored or visible(8 corners)=1 x 8= 8
Cubes with 2 faces colored or visible(12 edges)=(n-2) x12= 12n-24
Cubes with 1 face colored or visible(6 faces)=(n-2)2 x6= 6n2-24n+24
Cubes not visible(n-2 cube)=(n-2)3 = n3-6n2+12n-8
Total number of cubes=8+ 12n-24+ 6n2-24n+24+n3-6n2+12n-8=n3
n different things taken all at a time  pn  n! n

n different things taken r at a time, when a


particular thing always occur  r n 1pr 1  r n - 1!
n - r !
n different things taken r at a time, when a
particular thing never occur n 1
 pr  r
n - 1!
n - 1 - r !
NW N NE
Directions: W E
SW SE 134
a5 X b5, if both a and b are odd or even then the last two digits is 25
If any one is odd and other is even then the last two digits is 75
a5Xa5= a(a+1)25 Ex: 65X65=6(6+1)25=4225; 115X115=11(11+1)25=13225;
55x65=3575; 65x75=4875; a5xb5= (ab +(a+b)/2)x100 +25
Digital sum:34x57=1938(LHS:7x12=7x3=21=3:RHS 1+9+3+8=21=3)
18% of 1,50,600-15% of 1,25,500 (9X3-6X4=3) a) 8283(3) b) 8755 c) 8056 d)8575
(1111111)2 (7)=1234567654321; (11111)2 (5)=123454321; (11)2 (2)=121
(3333333)2 (7)=11111108888889; (33333)2 (5)=111108889; (33)2 (2)=1089
(6666666)2 (7)=44444435555556; (66666)2 (5)=4444355556; (66)2 (2)=4356
(9999999)2 (7)=99999980000001; (99999)2 (5)= 9999800001; (99)2 (2)=9801
A perfect square never ends with 2,3, 7 and 8 A(1+N/D) B(1-N/(D+N))=AB= A(1-N/D) B(1+N/(D-N))
[a b]2 =a2 2ab b2 ex: 812=64 16 1= 6561
a2=a2-b2+b2= (a+b)(a-b)+b2 ex: 982=(98+2)(98-2)+22=9604
a:b=p:q; b:c=r:s; c:d=t:u then a:b:c:d=prt:….:…..:qsu
Ex: a:b=1:2; b:c=3:4; c:d=5:6 then
a:b:c:d=1x3x5:…:…:2x4x6=15:30:….:48=15:30:40:48
If pa=qb=rc then a:b:c=qr:pr:pq Ex: 4a=5b=6c then
a:b:c=5x6:4x6:4x5=30:24:20=15:12:10
with u kmph---t1 hrs late, with v kmph---t2 hrs early, D=uv(t2+t1)/(v-u) 135
Number Series: Easy: 31,29,24,22,17,…15(Difference 2)
2,6,18,54,…162(Multiply with 3); 1000,200,40,…8(Divide with 5)
7,10,8,11,9,12,…10,13(7,8,9 odd, 10,11,12 even digits or +3, -2 )
Difficult:14,28,20,40,32,64,56,112,(56+48)104 (Double and substract 8 or
6,12,24…6x1,6x2,6x22,6x23) ; 3,5,8,13,21,…..34.. Fibonocci
3,8,15,24,35,…48 (5,7,9,11,13,15)
3,5,7,11,13,17, Prime 6,24,60,120,210 1x2x3,2x3x4,..6x7x8
1,4,27, 256 nn ; 4,8,28,80,244, ……..(3a +(-1)n+1)
1,6,15,28,45….(5,9,13,17,..21) 66 ; 2,5,9,19,37,….(2xa +(-1)n+1)
10000,11000,9900,10890,9801,…11781(10%,-10%)
0,6,24,60,120,210……(a3-a)
Incorrect: 5,10,17,24,37,50,65, 26 (5,7,9,11,13,15)
4,10,23,50,104,216,439,… 105 (2*a+n+1)
380,188,92,48,20,8,2,…. 44 (a/2-2)
10,14,28,32,64,68,132…136(a+4 ,2(a+4)…)
7,20,47,94,167, n3+(n+1)(n+2); 1,4,27,16,125(cubes, squares)
½,3/4,5/8,7/16…9/32;6,17,39,72 add a+(n-1)x11
325,259,204,160,127,105(-66,-55,…-11);5,6,9,15 (a+n(n+1)/2) 136
Overall look of Alphabets
AZ BY CX ….DW 1 26 2 25 3 24 4 23
E-5 AN BC GM EF ;Na, Cb, Mg, Fe Cb is not an element
J-10, 0-15 U, O, _, E, A Vowels in reverse order
T-20 Application: Applying Number Series:
Add, Delete, Square, Cubes, Prime Numbers,
Fibonacci, Sum of factors, Square a; Cubes a
JAK, KBL, LCM, MDN, . . . NEO
A, C, E, G, I, . . . K, M One word Gap
E J O T Y (5,10,15,20) AD GJ MP SV 1 4,7 10 ,13 16, 19 22
BDF JLN QSU 2 4 6, 10 12 14, 16 18
AZ CX FU . . . JQ 1 26, 3 24, 6 21, 10 17
QPO NML KJI HGF 17 16 15, 14 13 12, 11 10 9, 8 7 6
MN LO KP JQ IR 13 14,12 15, 11 16,10 17, 9 18
BY IQ NK QG RE2 25,9 17, 14 11,17 7, 18 5 (7,5,3,1..-8,-6,-4,-2 Alte)
CFL EIK GLJ IOI KRH 3 6 12, 5 9 11, 7 12 10, 9 15 9, 11 18 8
137
BCDB CDDEC DEEEFD EFFFFGE 2 3 4 2, 3 4 4 5 3, 4 5 5 5 6 4, 5 6 6 6 6 7 5
m1 = int(input("Enter the value of m1: ")) Enter the value of m1: 12
d1 = float(input("Enter the value of d1: ")) Enter the value of d1: 8
h1 = float(input("Enter the value of h1: ")) Enter the value of h1: 6
w1 = float(input("Enter the value of w1: ")) Enter the value of w1: 1
value = input("Enter m2 or d2 or h2 or w2:") Enter m2 or d2 or h2 or w2:m2
match value: Enter the value of d2: 16
case "m2": Enter the value of h2: 8
d2 = float(input("Enter the value of d2: ")) Enter the value of w2: 1
h2 = float(input("Enter the value of h2: ")) Persons Required M2= 4.5
w2 = float(input("Enter the value of w2: "))
m2=m1*d1*h1*w2/(w1*d2*h2)
print('Persons Required M2=',m2)
case "d2":
m2 = float(input("Enter the value of d2: "))
h2 = float(input("Enter the value of h2: "))
w2 = float(input("Enter the value of w2: "))
d2=m1*d1*h1*w2/(w1*m2*h2)
print('Days Required D2=',d2)
case "h2":
m2 = int(input("Enter the value of m2: "))
d2 = (input("Enter the value of d2: "))
w2 = float(input("Enter the value of w2: "))
h2=m1*d1*h1*w2/(w1*m2*d2)
print('hours per Day h2=',h2)
case "w2":
m2 = int(input("Enter the value of m2: "))
d2 = float(input("Enter the value of d2: "))
h2 = float(input("Enter the value of h2: "))
w2=m2*d2*h2*w1/(m1*d1*h1)
print('howork done/items w2=',w2)
Permutation
First import itertools package to implement the permutations method in
python. This method takes a list as an input and returns an object list of
tuples that contain all permutations in a list form.
n1 = int(input("Enter the value of n1: ")) Enter the value of n1: 1
n2 = int(input("Enter the value of n2: ")) Enter the value of n2: 2
n3 = int(input("Enter the value of n3: ")) Enter the value of n3: 3
perm = permutations([n1, n2, n3]) (1, 2, 3)
#perm = permutations([1, 2, 3]) (1, 3, 2)
# Print the obtained permutations (2, 1, 3)
n=0 (2, 3, 1)
for i in list(perm): (3, 1, 2) 3! / (3 - 3)!
print (i) (3, 2, 1)
n+=1 6
print (n)
from itertools import permutations (1, 2)
perm = permutations([1, 2, 3], 2) (1, 3)
# Print the obtained permutations
(2, 1)
n=0
for i in list(perm): (2, 3)
print (i) (3, 1)
n+=1 (3, 2)
print (n) 6

n! / (n - r)!
3! / (3 - 2)!
Combination
This method takes a list and an input r as an input and return an object list
of tuples which contain all possible combination of length r in a list form.

from itertools import combinations


# Get all combinations of [1, 2, 3] and length 2
comb = combinations([1, 2, 3], 2)
# Print the obtained combinations
n=0 (1, 2)
for i in list(comb): (1, 3)
print (i) (2, 3)
n+=1 3
print (n)
n! / (r! * (n - r)!)
# Combinations with an element-to-itself (1, 1)
from itertools import (1, 2)
combinations_with_replacement (1, 3)
# Get all combinations of [1, 2, 3] and length 2 (2, 2)
comb = combinations_with_replacement([1, 2, 3], 2) (2, 3)
n=0 (3, 3)
for i in list(comb): 6
print (i)
n+=1
print(n)
(n+r-1)! / (r! * (n - 1)!)
n = int(input("Enter the number n: ")) if sum==temp:
value = input("Enter sum_dig or rev_n or arm_strong or
strong:") print(sum, 'is an arm strong number')
sum=0 else:
rev=0 print(sum, 'is not an arm strong number')
fact=1
temp=n case "strong":
match value: while n>0:
case "sum_dig": i=1
while n>0:
r =n%10 fact=1
n=n//10 r=n%10
sum+=r while(i<=r):
print('Sum of the digits=',sum)
case "rev_n": fact=fact*i #factorial of each number145
while n>0: i=i+1
r =n%10 sum=sum+fact
n=n//10
rev=rev*10+r n=n//10
print('number reverse=',rev) if(sum==temp):
case "arm_strong": print(sum, 'is a strong number')
while n>0:
r =n%10 else:
n=n//10 print(sum, "is not a strong number")
sum+=r**3
n = int(input("Enter the number n: "))
value = input("Enter sum_dig or rev_n or arm_strong or strong:")
sum=0
rev=0
fact=1
match value:
case "sum_dig":
while n>0:
r =n%10
n=n//10
sum+=r
print('Sum of the digits=',sum)
case "rev_n":
while n>0:
r =n%10
n=n//10
rev=rev*10+r
print('number reverse=',rev)
case "arm_strong":
temp=n
while n>0:
r =n%10
n=n//10
sum+=r**3
if sum==temp:
print(sum, 'is an arm strong number')
else:
print(sum, 'is not an arm strong number')
case "strong":
temp=n
while n>0:
i=1
fact=1
r=n%10
while(i<=r):
fact=fact*i # Find factorial of each number-145
i=i+1
sum=sum+fact
n=n//10
if(sum==temp):
print(sum, 'is a strong number')
else:
print(sum, "is not a strong number")
#include <stdio.h> long find_ncr(int n, int r) {
long factorial(int); long result;
long find_ncr(int, int); result =
long find_npr(int, int); factorial(n)/(factorial(r)*factorial(n-r));
int main(){ return result;}
int n, r; long find_npr(int n, int r) {
long ncr, npr;printf("Enter the value of long result;
n and r"); result = factorial(n)/factorial(n-r);
scanf("%d%d",&n,&r); return result;}
ncr = find_ncr(n, r); long factorial(int n) {
npr = find_npr(n, r); int c;
printf("%dC%d = %ld\n", n, r, ncr); long fact = 1;
printf("%dP%d = %ld", n, r, npr); for (c = 1; c <= n; c++)
return 0; fact = fact *c;
} return fact;
}
#include <stdio.h> long factorial(int n) {
long factorial(int); int c;
int main(){ long fact = 1;
int n, r; for (c = 1; c <= n; c++)
long ncr, npr; fact = fact *c;
printf("Enter the values of n and r: "); return fact;
scanf("%d%d",&n,&r); }
ncr = factorial(n)/(factorial(r)*factorial(n-r));
npr = factorial(n)/factorial(n-r);
printf("%dC%d = %ld\n", n, r, ncr);
printf("%dP%d = %ld", n, r, npr);
return 0;
} Enter the values of n and r: 4 3
4C3 = 4
4P3 = 24
def find_ncr(n,r):
result =factorial(n)/(factorial(r)*factorial(n-r))
return result
def find_npr(n,r):
result = factorial(n)/factorial(n-r)
return result print("Enter the values of n and r")
def factorial(n): n=int(input("n value:"))
fact = 1 r=int(input("r value: "))
for i in range(1,n+1): ncr = find_ncr(n, r)
fact = fact *i npr = find_npr(n, r)
return fact print("%dC%d = %d\n"%(n, r, ncr))
print("%dP%d = %d"%(n, r, npr))
def factorial(n):
Enter the value of n and r
fact = 1
n value:5
for i in range(1,n+1):
r value: 3
fact = fact *i
5C3 = 10
return fact
5P3 = 60
print("Enter the value of n and r")
n=int(input("n value:"))
r=int(input("r value: "))
npr = factorial(n)/factorial(n-r)
ncr = factorial(n)/(factorial(r)*factorial(n-r))
print("%dC%d = %d"%(n, r, ncr))
print("%dP%d = %d"%(n, r, npr))
# Python Program to Calculate Profit or Loss and percentage
cost_price=float(input("cost_price:"))
selling_price = float(input("selling_price: "))
if(cost_price > selling_price):
loss = cost_price - selling_price
print("Total Loss = ", loss)
loss_perc=loss/cost_price*100
print("Loss Percentage=%.2f "% loss_perc)
elif(cost_price < selling_price):
profit = selling_price-cost_price
print("Total Profit = ",profit)
profit_perc=profit/cost_price*100
print("Profit Percentage=%.2f "% profit_perc)
else:
print("No Profit No Loss!!!")
CP=float(input('Cost Price :'))
p1=float(input('Profit Per on CP for MP = '))
d=float(input('Discount Per=')) Cost Price :1000
MP=CP*(1+p1/100) Profit Per on CP for MP = 40
SP=MP*(1-d/100) Discount Per=20
SP=CP*(1+p1/100)*(1-d/100) Cost Price=1000.00
profit=SP-CP Marked Price =1400.00
p=100*(SP-CP)/CP Selling Price =1120.00
Profit=120.00
P=profit/CP*100
ProfitPer=12.00
p=(p1-d-p1*d/100)
print('Cost Price=%.2f\nMarked Price =%.2f\nSelling Price
=%.2f\nProfit=%.2f\nProfitPer=%.2f'%(CP,MP,SP,profit,p))
#include<stdio.h>
void main() enter nA,nB 14 16
{int nAUB,nA,nB, nAintB; enter nAintB 8
printf("enter nA,nB "); 22
scanf("%d%d",&nA,&nB);
printf("enter nAintB ");
scanf("%d",&nAintB);
nAUB=nA+nB-nAintB;
printf("%d",nAUB);}
#include<stdio.h>
void main()
{int nAUBUC,nA,nB,nC,nAintB,nBintC;
int nCintA,nAiBiC; enter nA,nB,nC 14 16 18
printf("enter nA,nB,nC "); enter nAintB,nBintC 4 6
scanf("%d%d%d",&nA,&nB,&nC); enter nCintA,nAiBiC 8 7
nAUBUC=37
printf("enter nAintB,nBintC ");
scanf("%d%d",&nAintB,&nBintC);
printf("enter nCintA,nAiBiC ");
scanf("%d%d%",&nCintA,&nAiBiC);
nAUBUC=nA+nB+nC-nAintB-nBintC-nCintA+nAiBiC;
printf(" nAUBUC =%d",nAUBUC);}

You might also like