Saturday, October 11, 2014

how to check if a number is divisible by


Divisibility rules:

How to check if a number is divisible by 2:
the number must ends with an even digit or zero.
For ex: 856,450,968


How to check if a number is divisible by 3:
the sum of digits must by a multiple of 3.
For ex: 5412789
sum of digits =  5 + 4 + 1 + 2 + 7 + 8 + 9 = 36 which is a multiple of 3. Hence 5412789 is divisible by 3.

How to check if a number is divisible by 4:
the last two digits must by divisible by 4
For ex: 57845763424
last two digits 24 is divided by 4. Hency 57845763424 is divisibly by 4.

How to check if a number is divisible by 5:
The last digit must by 0 or 5.
For ex: 5485, 50240 etc.

How to check if a number is divisible by 6:
Number must be even and divisible by 3.
For ex: 36, 222

How to check if a number is divisible by 7:
Subtract the double of last digit from the remaining number. the result must be divisibly by 7.
if the result comes out to be too large to identify that it is divisible by 7. then perform the above operation again on that number. refer the below example.

For ex: 367409
step 1: double of last digit: 9 X 2 = 18
remaining number: 36740
result = 36740-18 = 36722
since the result too is large perform the same operation on 36722. i.e; 3672-4 = 3668 => 366-16 = 350 = > 35 - 0 = 35.
Since 35 is divisible by 7. 367409 is divisible by 7.

How to check if a number is divisible by 8:
the last three digits must by divisible by 8
For ex: 12345120

last three digits 120 is divided by 8. Hence 12345120 is divisibly by 8.

How to check if a number is divisible by 9:
the sum of digits must by a multiple of 9.
For ex: 621124857
sum of digits =  6 + 2 + 1 + 1 + 2 + 4 + 8 + 5 + 7 + 9 = 45 which is a multiple of 9. Hence 621124857 is divisible by 9.

How to check if a number is divisible by 10:
the last digit must be 0.
For ex: 100,240 etc

How to check if a number is divisible by 11:
subtract the sum of even digits from sum of odd digits. the result must be divisible by 11.
For ex: 8162.
sum of odd digits - sum of even digits = divisible by 11

=> 14-3=11 is divisible by 11. Hence 8162 is divisible by 11.

How to check if a number is divisible by 12:
The number must be divisible by both 3 and 4.
For ex: 144, 6984

How to check if a number is divisible by 13:

Add the four times of last digit to the remaining number. the result must be divisibly by 13.
if the result comes out to be too large to identify that it is divisible by 13. then perform the above operation over and over again as required. refer the below example.

For ex: 329732
step 1: four times of the last digit: 2 X 4 = 8
remaining number: 32973
result = 32973 + 8 = 32981
since the result too is large, perform the same operation on 32981. i.e; 3298 + 4 = 3302 => 330  + 8 = 338 = > 33 + 32 = 65 => 6 + 20 = 26.
Since 26 is divisible by 13. 329732 is divisible by 13.

How to check if a number is divisible by 14:
The number must be divisible by both 2 and 7.
For ex: 35602

How to check if a number is divisible by 15:
The number must be divisible by both 3 and 5.
For ex:7860

How to check if a number is divisible by 16:
the last four digits must by divisible by 16
For ex: 20064

last four digits 0064 is divided by 16. Hence 20064 is divisibly by 16.

How to check if a number is divisible by 17:
Subtract the five time of last digit from the remaining number. the result must be divisibly by 17.
if the result comes out to be too large to identify that it is divisible by 17. then perform the above operation over and over again as required. refer the below example.

For ex: 89216
step 1: five times of last digit: 6 X 5 = 30
remaining number: 8921
result = 8921-30 = 8891
since the result too is large, perform the same operation on 8891. i.e; 889-5 = 884 => 88-20 = 68

Since 68 is divisible by 17. 89216 is divisible by 17.

How to check if a number is divisible by 18:
The number must be divisible by both 2 and 9.
For ex: 104112

How to check if a number is divisible by 19:
Add the two times of last digit to the remaining number. the result must be divisibly by 19.
if the result comes out to be too large to identify that it is divisible by 19. then perform the above operation over and over again as required. refer the below example.

For ex: 99655
step 1: two times of the last digit: 5 X 2 = 10
remaining number: 9965
result = 9965 + 10 = 9975
since the result too is large, perform the same operation on 9975. i.e; 997 + 10 = 1007 => 100 + 14 = 114 = > 11 + 8 = 19
Since 19 is divisible by 19. 99655 is divisible by 19.

How to check if a number is divisible by 20:
the last two digits must by divisible by 20
For ex: 1080

last two digits 80 is divided by 20. Hence 1080 is divisibly by 20.

That's it for now. Please leave your suggestions, feedback or tricks in the comments section below.


Hope it helps
Thanks

Friday, October 10, 2014

How to calculate cube root of a number

How to Calculate Cube root of a number between 11 and 100 in your mind.

Cube root of a number can be a very difficult task specially when it lies in the range of 11 and 100. How would you like if you can do it in your head in two seconds in a competitive exam. It will give you an edge over others.

Now, without taking much of your time. Below is the trick.

Things to remember:
A) Cube of numbers from 1 to 10 i.e

1   = 1
2   = 8
3   = 27
4   = 64
5   = 125
6   = 216
7   = 343
8   = 512
9   = 729
10 = 1000

Notice that cube of every number ends with itself except(2,3,7,8).

B) Cube of 2 ends with 8 and vice versa. Cube of 3 ends with 7 and vice versa.

 Main Method():


Lets discuss this with an example.

To find out the cube root of  421875

Solution: Let cube root of this number be AB.

we will first find the B with the help of last three digits

B will be the same as the last digit of the question(here 421875) with an exception that
if last digit is 2, B will be 8
if last digit is 8, B will be 2
if last digit is 3, B will be 7
if last digit is 7, B will be 3

Also, last three digits are ignored as soon as we find B.


here, last digit is 5. so, B is 5.

Now to find A, we are left with only 421.

now, 421 lies between 7(cube 343) and 8(cube 512). so, the minimum of these two will be the A(i.e. 3)


Hence answer is 75.

Another example when last digit is either 2,3,7 or 8.

To find out the cube root of  50653.

To find B, Take last three digits. 653
B will be 7 as the last digit is 3.

To find A, Take remaining digits. 50
50 lies between 3(cube 9) and 4(cube 64). SO, the minimum of these two will be A(i.e. 3)

Hence, the answer is 37.


Thank you,
Hope it helps.

Wednesday, June 13, 2012

FIND THE DAY ON A PARTICULAR DATE


Most of the times,  you will be finding the day in 19th ,20th or 21st century.

So, remember, 19th century started with a sunday(january 1, 1800 was a sunday), 20th century with first working day i.e. monday(january 1, 1900 was a monday).

so if the concerned date is in 19th century. take 1 jan, 1800(sunday) as a reference. else if it is after 19th century, take 1 jan, 1900(monday)as a reference.

the scale i used is 0-6(i.e. if friday is 0 then saturday will be 1, sunday will be 2 and so on till thursday will be 6).

Main Method():

lets discuss this method with a date say (3 april 1990)

Take the reference as described above.

1. now you know first day of the century. so now you can find the first day of any year lies within that century.

in our example. 1 january 1990 can be calculated as:

* remember the word LID or DIL(hindi for Heart) whatever suites you.

L: leap years between the year concerned(not included) and reference year(included).
I: I symbolises 1
D: difference between the year concerned and reference year.

add these and divide by 7. the remainder is the day of the year with respect to the reference year.

(here, there are 21 leap years between 1990 and 1900   +   1   +   the difference is 90).
it comes out to be 112
divide this number by 7 that is 112/7 = 0 is the remainder.



So, 1 january 1990 is monday(1 january 1900)+0(remainder)= monday.

2. now to calculate first day of the concerned month of the concerned year.
remember a number series, i.e.

358-0-358-1-368

as 1 January of the year concerned is known, the day at any date of the January can be calculated easily(no need to tell). so , the series above starts with the month February.

one more thing, the number in the series represents the following number from February to December respectively.
3 - 3
5 - 5
8 - 8
0- 10
3- 13
5- 15
8- 18
1- 21
3- 23
6- 26
8- 28
(because, it is easy to learn single digits than double digits, obviously).

now to calculate concerned month
(deduct two from the month code above(if its not a leap year) else 1).
and divide the outcome by 7 and remainder is the first day of that month. with respect to 1 January of that year.
never deduct anything from February code as leap year does not affect first date of February (1 Feb. comes before 29 February).


in our example, April is the month so deduct 2 from 8(as 1990 is not a leap year) i.e. 6 and divide the 6 by 7  which gives the remainder 6.

hence first day of April is [Monday(1 January 1990) + 6(remainder)] = Sunday

which gives third April as Tuesday.

so two things to remeber are:

1. LID
2. 358-0358-1-368
--------------------------------------------------------------------------------------------------

lets discuss one more problem:

8 November 1992(leap year).
applying  LID to 1992:
21 +1 + 92 =114/7 = (16+2) = 2 is the remainder

so the first day of 1992 is Moday(1 January 1900) + 2 = Wednesday


now to find the first day of November of the year 1992.

apply the number series.
November's code is 26
so deduct 1 from 26 (as 1992 is a leap year) and divide the outcome by 7
so 25/7 = 4 is the remainder.
so first day of November is Wednesday + 4 = Sunday
so , 8th of November, 1992 is also Sunday.
---------------------------------------------------------------------------------------------------


believe me, it just looks like a long method, actually if you practice it few times, it just comes down to two or three things.


Thank you,

hope it helps,

leave your feedback in the comment. I would appreciate it.

Sunday, June 10, 2012

how to calculate log of a number without using log table

Sometimes, it is necessary to find the log(logarithm) of a number when there is no log table around.
so, the only thing you got is your mind.

below is a method which can be used to calculate the logarithm of a number if there is no log table to use.
this is also helpful if the number is too large to be calculated by a calculator. (the mind does n)

first of all, remember the following basic log values (its no harm to remember these even if you have log table).

log 2 = 0.301

log 3 = 0.477

log 5 = 0.699

log 7 = 0.845


these four values can be applied to calculate the log of any number (size does not matter).


and a formula:

log(a+b)=log a + ( b / (2.42*a) )

main method();

for example consider a small value:

log 737=?

=>log (737) = log (7.37 * 10^2)

=>log (7.37 ) + log (10^2)     [ log mn = log m + log n]

=>log (7.37) +2                     [ log 10^n = n]

=>log(7 + 0.37) + 2

now apply the formula:

=>log(7)+ 0.37/2.42*7 + 2

it comes out to be 2.867

which the log value for 737.

now this technique can be applied to any number.

Thank you,

hope it helps.

Saturday, June 9, 2012

how to learn complexities of sorting algorithms

The sorting algorithms we usually come across are:

Bubble , Insertion, Heap, Merge, Selection and Quick Sorting and it is very difficult to learn the complexities of all these algorithms. It becomes a more tedious task when it comes to three cases of complexities(Worst, Average, Best).

Below is a method to memorize all the complexities(including average, best and worst cases) of these six algorithms.

First letter of every sorting stands for that sorting. For ex.- B stands for Bubble sort, I stands for Insertion sort and so on....
there are only types cases of complexities:
  1. n
  2. n2(n square)
  3. nlogn
(dont worry about the complexity "n", it is not used frequently)

the trick to remember is as follows:

prepare a table in which first column contains all the algorithms names(in any order)
and first row contains all three cases(worst, average and best) as shown in figure in the specified order(i.e. increasing from worst to best).


Now, the words you have to remember are


  • BIn

B means bubble sort
I means insertion sort

both Bubble and insertion sort have same set of complexities but their best case is different than other. so remember "BIn": short for "Best Is n".


  • HtMl

H: Heap
M: Merge
t: just to remeber the whole word. it is of no use otherwise.
l means complexity "nlogn".

both Heap and Merge have same set of complexities and also all of them are nlong(l).


  • S stands for selection sort and "square". so all three of selection sort are n2.

  • Qsl(Queen of  scott-land): first column of quick sort is n2(as "s" in scott) and rest are nlong (as l in land).
Note: nlogn is used whenever it is specified otherwise use n2 as default
like: in BIn, use n2 in average and worst cases.
as I said earlier that complexity "n" is not much of use as it is used only twice that too can easily be memorize as "best is n".


Practice this two or three times and you will remember it as good as anything.







Thank you,

Please feel free to leave any comment or suggestion.