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

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...

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...

Java Exception : Exception Handling in Java

Java Exception :  Exception in Java can be defined as abnormal activity due to unwanted execution of code which should be avoided. But as we know writing too many complex logics can lead to execution of unwanted code and it can disrupt our normal flow.    To avoid such scenarios we have an option option called EXCEPTION HANDLING, by using EXCEPTION HANDLING we can make our execution normal in case of any disruption.   There are 2 ways to handle the exception. If we want the doubtful code which can throw exception and interrupt our execution flow , in this case we can use try and catch block and can do the required things and log the message that this hasn't work and can print the exact failure message with the help of stack trace. Let's understand with an example : below code is without Exception handling which will through Arithmetic exception. package C4CAMPUS ; public class ExceptionExample { public static void main (String args[]){ int a = 10 ; ...