Skip to main content

REMAINDER TRICKS


REMAINDER TRICKS



Before going into the remainder tricks, I would like to tell u about Euler number.
What is Euler number and how to find out the Euler number of any other number?
          Answer of above question is very simple..
          
             Euler number is total number of numbers of co-prime that exist less then that number.
              For example    6 
                                      So 1 and 5 are the only co-prime which exists less then 6.
                                     So Euler number for 6=2.

         How to find Euler number of big numbers?

           First find out the total number of factors of that number and apply the following formula.
           Suppose we have a number p which has 3 factors q,r,s.
            Now to find the Euler number of p we will apply this formula :
                               
                                            Euler number= p * ((q-1)/q) * ((r-1)/r) * ((s-1)/s).

 For example Euler number of 21:
                           Factors of 21=3*7
                          So Euler number= 21 * ((3-1)/3) * ((7-1)/7)
                                                   =21* (2/3) * (6/7)
                                                   =2*6=12.

  Now we can easily calculate the Euler Number of any number.


             To apply these Euler number concept in finding remainder we will take a question i.e
                      *     Find out the remainder in 2^50/9 ?
                       Sol :      First calculate Euler number of 9 .
                                           Factor of 9=3*3
                                           Only one number i.e 3
                                           Now apply the formula i.e 9*((3-1)/3)
                                                                               =9*(2/3)
                                                                               =6.
                       So Euler number of 9 is 6.

                    Given problem was 2^50/9.
                     Now divide the power portion i.e 50 by Euler number i.e 6 = 50/6
                                                                                                                =remainder will be 2
                      Now replace the power by remainder
                                           
                                                  2^50/9
                                                =2^2/9
                                                =4/9
                                                = Remainder of it will be 4 answer
                                    



Popular posts from this blog

Java Program : Writing First Java Factorial Program with explanation

 NAMING CONVENTION IN JAVA : Java is an object oriented programming language , we can relate it to real life object like i mapped Java with human in my previous post JAVA OVERVIEW (SESSION 1)  and represent human properties like body parts as properties in Java and Human can dance , drive , walk , run these can be mapped as Behaviour in java.    Now To represent properties and behaviour in java , there are some standard naming conventions we should follow. Class name should always starts with Uppercase letter like class Student { //Code to be executed } Properties or any kind of variables should starts from lower case and afterwards every first letter of each next word should be in Upper case . like class Student { int studentId ; String studentName ; //Code to be executed } Methods name should also starts from lower case and afterwards every first letter of each next word should be in Upper case . like class Student { int studentId ; Str...

SECURITY IN SPRING BOOT : Authentication and Authorisation in Spring boot Application

SECURITY IN SPRING BOOT : Authentication and Authorisation in Spring boot Application In any application security is the most important aspect without this no application can be considered as standard application as it will have full exposure to hackers. Now to secure our application there are 2 important concept  Authentication and Authorisation  which we should know .     Authentication stands for authentication of the client from your request is coming and to do so we will receive unique username and password for that to validate the authenticity of client. If it passes through our authentication process and identified as valid client then we will proceed and allow to access our URI and resources.   Authorisation comes after authentication in which we will allow to access our resources based on type of client if client is an Admin then he will have full access , if client is Premium user then he will have access to all premium resources if client is...

OOPS Concept in Java : POLYMORPHISM

 POLYMORPHISM IN JAVA :  Polymorphism means mutiple forms of Single reference. And to understand in simple way just take an example from my previous post of OOPS CONCEPT IN JAVA : INHERITANCE  , I request you guys to go through this link before proceding here. So in this post I have created a method called sum() in PARENT class which has been used by CHILD class without writing same sum() method in CHILD class. This was possible becuase of INHERITANCE concept in java.  But what if CHILD class is not satisfied with PARENT sum() and CHILD class wants to improve it like by adding some message before the calculation. To do this we have another OOPS CONCEPT IN JAVA i.e POLYMORPHISM and by applying this logic we can make same sum() method behvae differently based on Object. As I mentioned earlier POLYMORPHISM means different forms and same has been achieved here by calling same sum() method but the output is different based on Object on which it has been called. If ...