Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8029987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:36:59+00:00 2026-06-05T00:36:59+00:00

Is there any general method or particular methods for different numbers through which we

  • 0

Is there any general method or particular methods for different numbers through which we can get to know that a given number n in its binary representation is divisible by another number m?

For example:

n=23 (00010111)
m=3

The number is divisible by 3 if the difference between the count of bits set at even and odd positions is divisible by 3.

  • bits set to 1 at even position = 1
  • bits set to 1 at odd position = 3

So 3 - 1 = 2 is not divisible by 3, and therefore 23 is not divisible by 3.

I want to ask if there are other methods to find if a number is divisible by 2, 4, 5, 6, 7, etc..?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:37:00+00:00Added an answer on June 5, 2026 at 12:37 am

    You can’t find a simple rule for all of them. Here is the idea of how such rules are created.

    Let’s first talk about base 10. Imagine the number abcdefg. This number is in fact:

    g + 10*f + 10^2*e + 10^3*d + 10^4*c + 10^5*b + 10^6*a
    

    As we know, (a+b)%c is equal to (a%c+b%c)%c and (a*b)%c is equal to ((a%c)*(b%c))%c(you can learn better about these properties having known congruence)

    So, let’s see the remainder of our number by:

    • 2

      (g + 10*f + 10^2*e + 10^3*d + 10^4*c + 10^5*b + 10^6*a)%2 =
      (g%2 + 0 + 0 + 0 + 0 + 0 + 0)%2 =
      g%2
      

      therefore, a number is divisible by 2, if its last digit is divisible by 2

    • 3

      (g + 10*f + 10^2*e + 10^3*d + 10^4*c + 10^5*b + 10^6*a)%3 =
      (g%3 + f%3 + e%3 + d%3 + c%3 + b%3 + a%3)%3 =
      ... repeat operation for this number
      

      therefore, a number is divisible by 3, it the sum of its digits is divisible by 3

    • 4

      (g + 10*f + 10^2*e + 10^3*d + 10^4*c + 10^5*b + 10^6*a)%4 =
      (g%4 + 2*f%4 + 0 + 0 + 0 + 0 + 0)%4 =
      ... repeat if bigger than 4
      

      therefore, a number is divisible by 4, if its last digit plus two times its one before last digist is divisible by 4

    • 5

      (g + 10*f + 10^2*e + 10^3*d + 10^4*c + 10^5*b + 10^6*a)%5 =
      (g%5 + 0 + 0 + 0 + 0 + 0 + 0)%5 =
      g%5
      

      therefore, a number is divisible by 5, if its last digit is either 0 or 5

    • …

    • 11

      (g + 10*f + 10^2*e + 10^3*d + 10^4*c + 10^5*b + 10^6*a)%11 =
      (g%11 - f%11 + e%11 - d%11 + c%11 - b%11 + a%11)%11 =
      (g - f + e - d + c - b + a)%11 =
      ... repeat operation for this number
      

      (Note that 10%11 could be seen as -1 (they are congruent))

    • and so on!

    As you can see, in base 10, remainder by 11 gave you the same formula as remainder by 3 in base 2. This is not a coincidence.

    Now let’s assume our number is in base 2. Therefore abcdefg evaluates to:

    g + 2*f + 2^2*e + 2^3*d + 2^4*c + 2^5*b + 2^6*a
    

    The method to find the formulae is exactly as above. The only thing that makes it simpler here is that if the divisor is bigger than 1, then remainder of all digits with the divisor is the digit itself (because the digit is only 0 or 1), so all the digit%divisors become simply digit. That doesn’t change the methodology at all.

    Let’s see the remainder of our number by

    • 2

      (g + 2*f + 2^2*e + 2^3*d + 2^4*c + 2^5*b + 2^6*a)%2 =
      (g + 0 + 0 + 0 + 0 + 0 + 0)%2 =
      g
      

      therefore, a number is divisible by 2, if its last digit is 0

    • 3

      (g + 2*f + 2^2*e + 2^3*d + 2^4*c + 2^5*b + 2^6*a)%3 =
      (g - f + e - d + c - b + a)%3 =
      ... repeat operation for this number
      
    • 4

      (g + 2*f + 2^2*e + 2^3*d + 2^4*c + 2^5*b + 2^6*a)%4 =
      (g + 2*f + 0 + 0 + 0 + 0 + 0)%4 =
      

      therefore, a number is divisible by 4, if its last digit plus two times its one before last digist is divisible by 4

    • 5

      (g + 2*f + 2^2*e + 2^3*d + 2^4*c + 2^5*b + 2^6*a)%5 =
      (g + 2*f - e - 2*d + c + 2*b - a)%5 =
      ... repeat operation for this number
      
    • and so on

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hiii. Is there any way to uniquely identify a particular exception from the general
How do I generate random numbers in a microcontroller efficiently? Are there any general
I was wondering is there any tutorial out there that can teach you how
Are there any general rules I can use for evaluating whether a modern compiler
Is there any speed/space/general performance gains in using array based implementation of a binary
Is there any way I can run class files (i.e. with main as the
I was wondering how to define a pointcut in aspecJ that captures any method
Put simply, is there a way to receive a general notification when any property
Is there any extension method available for resolving cross thread exception in windows forms
There is a general rule of OO design that you should model is-a relationships

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.