Determining if a number is divisible by 1000 [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












3















I have a number such as:



a = 875952;


And I want to find if it is divisible by 1000.



Is there a concise way of doing that?










share|improve this question















closed as off-topic by corey979, Michael E2, Daniel Lichtblau, Chris K, m_goldberg Jan 1 at 20:53


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – corey979, Michael E2, Daniel Lichtblau, Chris K, m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

















    3















    I have a number such as:



    a = 875952;


    And I want to find if it is divisible by 1000.



    Is there a concise way of doing that?










    share|improve this question















    closed as off-topic by corey979, Michael E2, Daniel Lichtblau, Chris K, m_goldberg Jan 1 at 20:53


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – corey979, Michael E2, Daniel Lichtblau, Chris K, m_goldberg
    If this question can be reworded to fit the rules in the help center, please edit the question.















      3












      3








      3








      I have a number such as:



      a = 875952;


      And I want to find if it is divisible by 1000.



      Is there a concise way of doing that?










      share|improve this question
















      I have a number such as:



      a = 875952;


      And I want to find if it is divisible by 1000.



      Is there a concise way of doing that?







      functions number-theory






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 1 at 14:28









      m_goldberg

      84.5k872196




      84.5k872196










      asked Dec 31 '18 at 17:32









      user61054user61054

      514




      514




      closed as off-topic by corey979, Michael E2, Daniel Lichtblau, Chris K, m_goldberg Jan 1 at 20:53


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – corey979, Michael E2, Daniel Lichtblau, Chris K, m_goldberg
      If this question can be reworded to fit the rules in the help center, please edit the question.




      closed as off-topic by corey979, Michael E2, Daniel Lichtblau, Chris K, m_goldberg Jan 1 at 20:53


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – corey979, Michael E2, Daniel Lichtblau, Chris K, m_goldberg
      If this question can be reworded to fit the rules in the help center, please edit the question.




















          2 Answers
          2






          active

          oldest

          votes


















          17














          Use Divisible:



          Divisible[a, 1000]



          False







          share|improve this answer
































            9














            It depends whether you want a three-digit number, in which case try using Mod, as in:



            Mod[a, 1000]


            If you want a List of the digits, then the other solutions above work fine.



            If your goal is instead to see whether a is (evenly) divisible by 1000, then:



            Mod[a,1000] == 0


            yields a True or False.



            Although I don't think this is quite what the OP requests, in response to @TheGreatDuck, here is (inefficient) code that gets the final three digits from any real number:



            a = 3454.983745; 
            Take[
            NestWhile[
            If[Last[#] == 0, Drop[#, -1]] &, RealDigits[a][[1]],
            Last[#] == 0 &], -3]





            share|improve this answer

























            • Actually I want to see whether a is divisable by 1000, my ways is to judge the last number of a. But it seems complex. Do you have other ways? thanks.

              – user61054
              Dec 31 '18 at 17:49






            • 8





              A recommendation: Always ask your actual question, rather than an intermediate question. You're more likely to get better answers.

              – David G. Stork
              Dec 31 '18 at 17:52











            • @DavidG.Stork but what if by last 3 digits we mean last 3 digits of even decimal fractions such as 13.535 returning 535 or the list 5,3,5 or any other equivalent representation? Right now your formula gives the last three whole number place values along with the decimal fraction. (And yes, I can see the askers usage/intention was something very different but it would be interesting to see a more precise answer to the original question.)

              – The Great Duck
              Dec 31 '18 at 20:16












            • @TheGreatDuck: The OP is rather confused about what is desired: "Actually I want to see whether $a$ is divisable by 1000." I tried to answer his actual question. If the OP wants something different, I'm happy to address that.

              – David G. Stork
              Dec 31 '18 at 20:18






            • 3





              @TheGreatDuck look up what an x y question is. In this case the best approach would be to edit the original question as it is not the question that the OP wants to be answered.

              – Fogmeister
              Jan 1 at 10:24

















            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            17














            Use Divisible:



            Divisible[a, 1000]



            False







            share|improve this answer





























              17














              Use Divisible:



              Divisible[a, 1000]



              False







              share|improve this answer



























                17












                17








                17







                Use Divisible:



                Divisible[a, 1000]



                False







                share|improve this answer















                Use Divisible:



                Divisible[a, 1000]



                False








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 1 at 16:34

























                answered Dec 31 '18 at 17:36









                kglrkglr

                178k9198409




                178k9198409





















                    9














                    It depends whether you want a three-digit number, in which case try using Mod, as in:



                    Mod[a, 1000]


                    If you want a List of the digits, then the other solutions above work fine.



                    If your goal is instead to see whether a is (evenly) divisible by 1000, then:



                    Mod[a,1000] == 0


                    yields a True or False.



                    Although I don't think this is quite what the OP requests, in response to @TheGreatDuck, here is (inefficient) code that gets the final three digits from any real number:



                    a = 3454.983745; 
                    Take[
                    NestWhile[
                    If[Last[#] == 0, Drop[#, -1]] &, RealDigits[a][[1]],
                    Last[#] == 0 &], -3]





                    share|improve this answer

























                    • Actually I want to see whether a is divisable by 1000, my ways is to judge the last number of a. But it seems complex. Do you have other ways? thanks.

                      – user61054
                      Dec 31 '18 at 17:49






                    • 8





                      A recommendation: Always ask your actual question, rather than an intermediate question. You're more likely to get better answers.

                      – David G. Stork
                      Dec 31 '18 at 17:52











                    • @DavidG.Stork but what if by last 3 digits we mean last 3 digits of even decimal fractions such as 13.535 returning 535 or the list 5,3,5 or any other equivalent representation? Right now your formula gives the last three whole number place values along with the decimal fraction. (And yes, I can see the askers usage/intention was something very different but it would be interesting to see a more precise answer to the original question.)

                      – The Great Duck
                      Dec 31 '18 at 20:16












                    • @TheGreatDuck: The OP is rather confused about what is desired: "Actually I want to see whether $a$ is divisable by 1000." I tried to answer his actual question. If the OP wants something different, I'm happy to address that.

                      – David G. Stork
                      Dec 31 '18 at 20:18






                    • 3





                      @TheGreatDuck look up what an x y question is. In this case the best approach would be to edit the original question as it is not the question that the OP wants to be answered.

                      – Fogmeister
                      Jan 1 at 10:24















                    9














                    It depends whether you want a three-digit number, in which case try using Mod, as in:



                    Mod[a, 1000]


                    If you want a List of the digits, then the other solutions above work fine.



                    If your goal is instead to see whether a is (evenly) divisible by 1000, then:



                    Mod[a,1000] == 0


                    yields a True or False.



                    Although I don't think this is quite what the OP requests, in response to @TheGreatDuck, here is (inefficient) code that gets the final three digits from any real number:



                    a = 3454.983745; 
                    Take[
                    NestWhile[
                    If[Last[#] == 0, Drop[#, -1]] &, RealDigits[a][[1]],
                    Last[#] == 0 &], -3]





                    share|improve this answer

























                    • Actually I want to see whether a is divisable by 1000, my ways is to judge the last number of a. But it seems complex. Do you have other ways? thanks.

                      – user61054
                      Dec 31 '18 at 17:49






                    • 8





                      A recommendation: Always ask your actual question, rather than an intermediate question. You're more likely to get better answers.

                      – David G. Stork
                      Dec 31 '18 at 17:52











                    • @DavidG.Stork but what if by last 3 digits we mean last 3 digits of even decimal fractions such as 13.535 returning 535 or the list 5,3,5 or any other equivalent representation? Right now your formula gives the last three whole number place values along with the decimal fraction. (And yes, I can see the askers usage/intention was something very different but it would be interesting to see a more precise answer to the original question.)

                      – The Great Duck
                      Dec 31 '18 at 20:16












                    • @TheGreatDuck: The OP is rather confused about what is desired: "Actually I want to see whether $a$ is divisable by 1000." I tried to answer his actual question. If the OP wants something different, I'm happy to address that.

                      – David G. Stork
                      Dec 31 '18 at 20:18






                    • 3





                      @TheGreatDuck look up what an x y question is. In this case the best approach would be to edit the original question as it is not the question that the OP wants to be answered.

                      – Fogmeister
                      Jan 1 at 10:24













                    9












                    9








                    9







                    It depends whether you want a three-digit number, in which case try using Mod, as in:



                    Mod[a, 1000]


                    If you want a List of the digits, then the other solutions above work fine.



                    If your goal is instead to see whether a is (evenly) divisible by 1000, then:



                    Mod[a,1000] == 0


                    yields a True or False.



                    Although I don't think this is quite what the OP requests, in response to @TheGreatDuck, here is (inefficient) code that gets the final three digits from any real number:



                    a = 3454.983745; 
                    Take[
                    NestWhile[
                    If[Last[#] == 0, Drop[#, -1]] &, RealDigits[a][[1]],
                    Last[#] == 0 &], -3]





                    share|improve this answer















                    It depends whether you want a three-digit number, in which case try using Mod, as in:



                    Mod[a, 1000]


                    If you want a List of the digits, then the other solutions above work fine.



                    If your goal is instead to see whether a is (evenly) divisible by 1000, then:



                    Mod[a,1000] == 0


                    yields a True or False.



                    Although I don't think this is quite what the OP requests, in response to @TheGreatDuck, here is (inefficient) code that gets the final three digits from any real number:



                    a = 3454.983745; 
                    Take[
                    NestWhile[
                    If[Last[#] == 0, Drop[#, -1]] &, RealDigits[a][[1]],
                    Last[#] == 0 &], -3]






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Dec 31 '18 at 21:09

























                    answered Dec 31 '18 at 17:36









                    David G. StorkDavid G. Stork

                    23.8k22051




                    23.8k22051












                    • Actually I want to see whether a is divisable by 1000, my ways is to judge the last number of a. But it seems complex. Do you have other ways? thanks.

                      – user61054
                      Dec 31 '18 at 17:49






                    • 8





                      A recommendation: Always ask your actual question, rather than an intermediate question. You're more likely to get better answers.

                      – David G. Stork
                      Dec 31 '18 at 17:52











                    • @DavidG.Stork but what if by last 3 digits we mean last 3 digits of even decimal fractions such as 13.535 returning 535 or the list 5,3,5 or any other equivalent representation? Right now your formula gives the last three whole number place values along with the decimal fraction. (And yes, I can see the askers usage/intention was something very different but it would be interesting to see a more precise answer to the original question.)

                      – The Great Duck
                      Dec 31 '18 at 20:16












                    • @TheGreatDuck: The OP is rather confused about what is desired: "Actually I want to see whether $a$ is divisable by 1000." I tried to answer his actual question. If the OP wants something different, I'm happy to address that.

                      – David G. Stork
                      Dec 31 '18 at 20:18






                    • 3





                      @TheGreatDuck look up what an x y question is. In this case the best approach would be to edit the original question as it is not the question that the OP wants to be answered.

                      – Fogmeister
                      Jan 1 at 10:24

















                    • Actually I want to see whether a is divisable by 1000, my ways is to judge the last number of a. But it seems complex. Do you have other ways? thanks.

                      – user61054
                      Dec 31 '18 at 17:49






                    • 8





                      A recommendation: Always ask your actual question, rather than an intermediate question. You're more likely to get better answers.

                      – David G. Stork
                      Dec 31 '18 at 17:52











                    • @DavidG.Stork but what if by last 3 digits we mean last 3 digits of even decimal fractions such as 13.535 returning 535 or the list 5,3,5 or any other equivalent representation? Right now your formula gives the last three whole number place values along with the decimal fraction. (And yes, I can see the askers usage/intention was something very different but it would be interesting to see a more precise answer to the original question.)

                      – The Great Duck
                      Dec 31 '18 at 20:16












                    • @TheGreatDuck: The OP is rather confused about what is desired: "Actually I want to see whether $a$ is divisable by 1000." I tried to answer his actual question. If the OP wants something different, I'm happy to address that.

                      – David G. Stork
                      Dec 31 '18 at 20:18






                    • 3





                      @TheGreatDuck look up what an x y question is. In this case the best approach would be to edit the original question as it is not the question that the OP wants to be answered.

                      – Fogmeister
                      Jan 1 at 10:24
















                    Actually I want to see whether a is divisable by 1000, my ways is to judge the last number of a. But it seems complex. Do you have other ways? thanks.

                    – user61054
                    Dec 31 '18 at 17:49





                    Actually I want to see whether a is divisable by 1000, my ways is to judge the last number of a. But it seems complex. Do you have other ways? thanks.

                    – user61054
                    Dec 31 '18 at 17:49




                    8




                    8





                    A recommendation: Always ask your actual question, rather than an intermediate question. You're more likely to get better answers.

                    – David G. Stork
                    Dec 31 '18 at 17:52





                    A recommendation: Always ask your actual question, rather than an intermediate question. You're more likely to get better answers.

                    – David G. Stork
                    Dec 31 '18 at 17:52













                    @DavidG.Stork but what if by last 3 digits we mean last 3 digits of even decimal fractions such as 13.535 returning 535 or the list 5,3,5 or any other equivalent representation? Right now your formula gives the last three whole number place values along with the decimal fraction. (And yes, I can see the askers usage/intention was something very different but it would be interesting to see a more precise answer to the original question.)

                    – The Great Duck
                    Dec 31 '18 at 20:16






                    @DavidG.Stork but what if by last 3 digits we mean last 3 digits of even decimal fractions such as 13.535 returning 535 or the list 5,3,5 or any other equivalent representation? Right now your formula gives the last three whole number place values along with the decimal fraction. (And yes, I can see the askers usage/intention was something very different but it would be interesting to see a more precise answer to the original question.)

                    – The Great Duck
                    Dec 31 '18 at 20:16














                    @TheGreatDuck: The OP is rather confused about what is desired: "Actually I want to see whether $a$ is divisable by 1000." I tried to answer his actual question. If the OP wants something different, I'm happy to address that.

                    – David G. Stork
                    Dec 31 '18 at 20:18





                    @TheGreatDuck: The OP is rather confused about what is desired: "Actually I want to see whether $a$ is divisable by 1000." I tried to answer his actual question. If the OP wants something different, I'm happy to address that.

                    – David G. Stork
                    Dec 31 '18 at 20:18




                    3




                    3





                    @TheGreatDuck look up what an x y question is. In this case the best approach would be to edit the original question as it is not the question that the OP wants to be answered.

                    – Fogmeister
                    Jan 1 at 10:24





                    @TheGreatDuck look up what an x y question is. In this case the best approach would be to edit the original question as it is not the question that the OP wants to be answered.

                    – Fogmeister
                    Jan 1 at 10:24


                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay