How can I mathematically split up a 3 digit number?











up vote
10
down vote

favorite
3












For example, if I have 456, How can I split this and then let each column value be a separate number? The only way I can think of doing this would be to subtract '100' n times until that column is '0' and storing the number of subtractions, leaving '4' then repeating for the other columns. Is there a quicker way?










share|cite|improve this question


















  • 1




    Why not divide by $100?$
    – saulspatz
    Nov 4 at 14:36






  • 3




    What you describe is pretty much the normal straightforward way one would go about this, only its description (and implementation if you are going to program it) can be abbreviated using the notions of division with and without remainder and modulo, as described in the anwers. If the number happens to be in base 2 and you are doing it on a computer then there are also even faster shift operations.
    – Nobody
    Nov 4 at 20:27















up vote
10
down vote

favorite
3












For example, if I have 456, How can I split this and then let each column value be a separate number? The only way I can think of doing this would be to subtract '100' n times until that column is '0' and storing the number of subtractions, leaving '4' then repeating for the other columns. Is there a quicker way?










share|cite|improve this question


















  • 1




    Why not divide by $100?$
    – saulspatz
    Nov 4 at 14:36






  • 3




    What you describe is pretty much the normal straightforward way one would go about this, only its description (and implementation if you are going to program it) can be abbreviated using the notions of division with and without remainder and modulo, as described in the anwers. If the number happens to be in base 2 and you are doing it on a computer then there are also even faster shift operations.
    – Nobody
    Nov 4 at 20:27













up vote
10
down vote

favorite
3









up vote
10
down vote

favorite
3






3





For example, if I have 456, How can I split this and then let each column value be a separate number? The only way I can think of doing this would be to subtract '100' n times until that column is '0' and storing the number of subtractions, leaving '4' then repeating for the other columns. Is there a quicker way?










share|cite|improve this question













For example, if I have 456, How can I split this and then let each column value be a separate number? The only way I can think of doing this would be to subtract '100' n times until that column is '0' and storing the number of subtractions, leaving '4' then repeating for the other columns. Is there a quicker way?







real-numbers






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Nov 4 at 14:34









Ben Beaumont

615




615








  • 1




    Why not divide by $100?$
    – saulspatz
    Nov 4 at 14:36






  • 3




    What you describe is pretty much the normal straightforward way one would go about this, only its description (and implementation if you are going to program it) can be abbreviated using the notions of division with and without remainder and modulo, as described in the anwers. If the number happens to be in base 2 and you are doing it on a computer then there are also even faster shift operations.
    – Nobody
    Nov 4 at 20:27














  • 1




    Why not divide by $100?$
    – saulspatz
    Nov 4 at 14:36






  • 3




    What you describe is pretty much the normal straightforward way one would go about this, only its description (and implementation if you are going to program it) can be abbreviated using the notions of division with and without remainder and modulo, as described in the anwers. If the number happens to be in base 2 and you are doing it on a computer then there are also even faster shift operations.
    – Nobody
    Nov 4 at 20:27








1




1




Why not divide by $100?$
– saulspatz
Nov 4 at 14:36




Why not divide by $100?$
– saulspatz
Nov 4 at 14:36




3




3




What you describe is pretty much the normal straightforward way one would go about this, only its description (and implementation if you are going to program it) can be abbreviated using the notions of division with and without remainder and modulo, as described in the anwers. If the number happens to be in base 2 and you are doing it on a computer then there are also even faster shift operations.
– Nobody
Nov 4 at 20:27




What you describe is pretty much the normal straightforward way one would go about this, only its description (and implementation if you are going to program it) can be abbreviated using the notions of division with and without remainder and modulo, as described in the anwers. If the number happens to be in base 2 and you are doing it on a computer then there are also even faster shift operations.
– Nobody
Nov 4 at 20:27










2 Answers
2






active

oldest

votes

















up vote
21
down vote



accepted










You can use the operation "modulo". It calculates the remainder after you have divided by a number.




  1. So 456 modulo 10 is 6, now you have the first digit.

  2. Then you can divide 456 with 10 without remainder, you get 45.

  3. Now 45 modulo 10 gives 5, now you have second digit.

  4. Then you can divide 45 with 10 without remainder, you get 4.

  5. Now 4 modulo 10 gives 4, now you have last digit.






share|cite|improve this answer



















  • 7




    Note that the 'ten' comes from decimal. This works in other number systems and you'll use the base-number of that number system instead of 'ten'.
    – Jochem Kuijpers
    Nov 5 at 1:28








  • 1




    "Divide without remainder" is also known as "divide and floor".
    – Nayuki
    Nov 5 at 6:53






  • 2




    and 'divide by the base' is also known as 'shift right'.
    – amI
    Nov 5 at 7:30


















up vote
6
down vote













Divide $456$ with $100$ without remainder, you get $4$ - the first digit



Now $456 - 4cdot100 = 56$ - subtract $100$ times the first digit



Now divide $56$ with $10$ without remainder to get 5 - the second digit



Now do $56 - 5cdot10 = 6$ - last digit



You can use $mod{}$ to get them another way, from last (or first if you call it that way) to first digit






share|cite|improve this answer

















  • 1




    The "last (or first if you call it that way)" ambiguity is resolved by using "most significant" and "least significant".
    – Ben Voigt
    Nov 5 at 4:52











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2984282%2fhow-can-i-mathematically-split-up-a-3-digit-number%23new-answer', 'question_page');
}
);

Post as a guest
































2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
21
down vote



accepted










You can use the operation "modulo". It calculates the remainder after you have divided by a number.




  1. So 456 modulo 10 is 6, now you have the first digit.

  2. Then you can divide 456 with 10 without remainder, you get 45.

  3. Now 45 modulo 10 gives 5, now you have second digit.

  4. Then you can divide 45 with 10 without remainder, you get 4.

  5. Now 4 modulo 10 gives 4, now you have last digit.






share|cite|improve this answer



















  • 7




    Note that the 'ten' comes from decimal. This works in other number systems and you'll use the base-number of that number system instead of 'ten'.
    – Jochem Kuijpers
    Nov 5 at 1:28








  • 1




    "Divide without remainder" is also known as "divide and floor".
    – Nayuki
    Nov 5 at 6:53






  • 2




    and 'divide by the base' is also known as 'shift right'.
    – amI
    Nov 5 at 7:30















up vote
21
down vote



accepted










You can use the operation "modulo". It calculates the remainder after you have divided by a number.




  1. So 456 modulo 10 is 6, now you have the first digit.

  2. Then you can divide 456 with 10 without remainder, you get 45.

  3. Now 45 modulo 10 gives 5, now you have second digit.

  4. Then you can divide 45 with 10 without remainder, you get 4.

  5. Now 4 modulo 10 gives 4, now you have last digit.






share|cite|improve this answer



















  • 7




    Note that the 'ten' comes from decimal. This works in other number systems and you'll use the base-number of that number system instead of 'ten'.
    – Jochem Kuijpers
    Nov 5 at 1:28








  • 1




    "Divide without remainder" is also known as "divide and floor".
    – Nayuki
    Nov 5 at 6:53






  • 2




    and 'divide by the base' is also known as 'shift right'.
    – amI
    Nov 5 at 7:30













up vote
21
down vote



accepted







up vote
21
down vote



accepted






You can use the operation "modulo". It calculates the remainder after you have divided by a number.




  1. So 456 modulo 10 is 6, now you have the first digit.

  2. Then you can divide 456 with 10 without remainder, you get 45.

  3. Now 45 modulo 10 gives 5, now you have second digit.

  4. Then you can divide 45 with 10 without remainder, you get 4.

  5. Now 4 modulo 10 gives 4, now you have last digit.






share|cite|improve this answer














You can use the operation "modulo". It calculates the remainder after you have divided by a number.




  1. So 456 modulo 10 is 6, now you have the first digit.

  2. Then you can divide 456 with 10 without remainder, you get 45.

  3. Now 45 modulo 10 gives 5, now you have second digit.

  4. Then you can divide 45 with 10 without remainder, you get 4.

  5. Now 4 modulo 10 gives 4, now you have last digit.







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Nov 5 at 0:07









NickA

1032




1032










answered Nov 4 at 14:38









mathreadler

14.5k72160




14.5k72160








  • 7




    Note that the 'ten' comes from decimal. This works in other number systems and you'll use the base-number of that number system instead of 'ten'.
    – Jochem Kuijpers
    Nov 5 at 1:28








  • 1




    "Divide without remainder" is also known as "divide and floor".
    – Nayuki
    Nov 5 at 6:53






  • 2




    and 'divide by the base' is also known as 'shift right'.
    – amI
    Nov 5 at 7:30














  • 7




    Note that the 'ten' comes from decimal. This works in other number systems and you'll use the base-number of that number system instead of 'ten'.
    – Jochem Kuijpers
    Nov 5 at 1:28








  • 1




    "Divide without remainder" is also known as "divide and floor".
    – Nayuki
    Nov 5 at 6:53






  • 2




    and 'divide by the base' is also known as 'shift right'.
    – amI
    Nov 5 at 7:30








7




7




Note that the 'ten' comes from decimal. This works in other number systems and you'll use the base-number of that number system instead of 'ten'.
– Jochem Kuijpers
Nov 5 at 1:28






Note that the 'ten' comes from decimal. This works in other number systems and you'll use the base-number of that number system instead of 'ten'.
– Jochem Kuijpers
Nov 5 at 1:28






1




1




"Divide without remainder" is also known as "divide and floor".
– Nayuki
Nov 5 at 6:53




"Divide without remainder" is also known as "divide and floor".
– Nayuki
Nov 5 at 6:53




2




2




and 'divide by the base' is also known as 'shift right'.
– amI
Nov 5 at 7:30




and 'divide by the base' is also known as 'shift right'.
– amI
Nov 5 at 7:30










up vote
6
down vote













Divide $456$ with $100$ without remainder, you get $4$ - the first digit



Now $456 - 4cdot100 = 56$ - subtract $100$ times the first digit



Now divide $56$ with $10$ without remainder to get 5 - the second digit



Now do $56 - 5cdot10 = 6$ - last digit



You can use $mod{}$ to get them another way, from last (or first if you call it that way) to first digit






share|cite|improve this answer

















  • 1




    The "last (or first if you call it that way)" ambiguity is resolved by using "most significant" and "least significant".
    – Ben Voigt
    Nov 5 at 4:52















up vote
6
down vote













Divide $456$ with $100$ without remainder, you get $4$ - the first digit



Now $456 - 4cdot100 = 56$ - subtract $100$ times the first digit



Now divide $56$ with $10$ without remainder to get 5 - the second digit



Now do $56 - 5cdot10 = 6$ - last digit



You can use $mod{}$ to get them another way, from last (or first if you call it that way) to first digit






share|cite|improve this answer

















  • 1




    The "last (or first if you call it that way)" ambiguity is resolved by using "most significant" and "least significant".
    – Ben Voigt
    Nov 5 at 4:52













up vote
6
down vote










up vote
6
down vote









Divide $456$ with $100$ without remainder, you get $4$ - the first digit



Now $456 - 4cdot100 = 56$ - subtract $100$ times the first digit



Now divide $56$ with $10$ without remainder to get 5 - the second digit



Now do $56 - 5cdot10 = 6$ - last digit



You can use $mod{}$ to get them another way, from last (or first if you call it that way) to first digit






share|cite|improve this answer












Divide $456$ with $100$ without remainder, you get $4$ - the first digit



Now $456 - 4cdot100 = 56$ - subtract $100$ times the first digit



Now divide $56$ with $10$ without remainder to get 5 - the second digit



Now do $56 - 5cdot10 = 6$ - last digit



You can use $mod{}$ to get them another way, from last (or first if you call it that way) to first digit







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Nov 4 at 14:45









Aleksa

27512




27512








  • 1




    The "last (or first if you call it that way)" ambiguity is resolved by using "most significant" and "least significant".
    – Ben Voigt
    Nov 5 at 4:52














  • 1




    The "last (or first if you call it that way)" ambiguity is resolved by using "most significant" and "least significant".
    – Ben Voigt
    Nov 5 at 4:52








1




1




The "last (or first if you call it that way)" ambiguity is resolved by using "most significant" and "least significant".
– Ben Voigt
Nov 5 at 4:52




The "last (or first if you call it that way)" ambiguity is resolved by using "most significant" and "least significant".
– Ben Voigt
Nov 5 at 4:52


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2984282%2fhow-can-i-mathematically-split-up-a-3-digit-number%23new-answer', 'question_page');
}
);

Post as a guest




















































































這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()