Rectangular Prisms

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











up vote
7
down vote

favorite
1












Eight corner bricks are taken out from a 5x5x5 block, which is something like below:



enter image description here




How many rectangular prisms of all sizes can be counted in this block?




Source: Oyun 2018 Final Exam Question







share|improve this question




















  • Does a cube count as a rectangular prism??
    – Kevin L
    Aug 17 at 12:48






  • 1




    we dont know if any group of prism creates a cube and since dimensions are not given, yes you will count cubes as prisms.
    – Oray
    Aug 17 at 12:50










  • ok gonna start counting :)
    – Kevin L
    Aug 17 at 12:51










  • and according to wyzant.com/resources/answers/4393/… cube is also rectangular prism.
    – Oray
    Aug 17 at 12:52










  • Since Gareth McCaugham has corrected his slight mistake you should credit him with the accepted answer, for anteriority and for the redaction effort that I just copied and pasted.
    – Evargalo
    Aug 17 at 20:57














up vote
7
down vote

favorite
1












Eight corner bricks are taken out from a 5x5x5 block, which is something like below:



enter image description here




How many rectangular prisms of all sizes can be counted in this block?




Source: Oyun 2018 Final Exam Question







share|improve this question




















  • Does a cube count as a rectangular prism??
    – Kevin L
    Aug 17 at 12:48






  • 1




    we dont know if any group of prism creates a cube and since dimensions are not given, yes you will count cubes as prisms.
    – Oray
    Aug 17 at 12:50










  • ok gonna start counting :)
    – Kevin L
    Aug 17 at 12:51










  • and according to wyzant.com/resources/answers/4393/… cube is also rectangular prism.
    – Oray
    Aug 17 at 12:52










  • Since Gareth McCaugham has corrected his slight mistake you should credit him with the accepted answer, for anteriority and for the redaction effort that I just copied and pasted.
    – Evargalo
    Aug 17 at 20:57












up vote
7
down vote

favorite
1









up vote
7
down vote

favorite
1






1





Eight corner bricks are taken out from a 5x5x5 block, which is something like below:



enter image description here




How many rectangular prisms of all sizes can be counted in this block?




Source: Oyun 2018 Final Exam Question







share|improve this question












Eight corner bricks are taken out from a 5x5x5 block, which is something like below:



enter image description here




How many rectangular prisms of all sizes can be counted in this block?




Source: Oyun 2018 Final Exam Question









share|improve this question











share|improve this question




share|improve this question










asked Aug 17 at 12:26









Oray

14.1k435139




14.1k435139











  • Does a cube count as a rectangular prism??
    – Kevin L
    Aug 17 at 12:48






  • 1




    we dont know if any group of prism creates a cube and since dimensions are not given, yes you will count cubes as prisms.
    – Oray
    Aug 17 at 12:50










  • ok gonna start counting :)
    – Kevin L
    Aug 17 at 12:51










  • and according to wyzant.com/resources/answers/4393/… cube is also rectangular prism.
    – Oray
    Aug 17 at 12:52










  • Since Gareth McCaugham has corrected his slight mistake you should credit him with the accepted answer, for anteriority and for the redaction effort that I just copied and pasted.
    – Evargalo
    Aug 17 at 20:57
















  • Does a cube count as a rectangular prism??
    – Kevin L
    Aug 17 at 12:48






  • 1




    we dont know if any group of prism creates a cube and since dimensions are not given, yes you will count cubes as prisms.
    – Oray
    Aug 17 at 12:50










  • ok gonna start counting :)
    – Kevin L
    Aug 17 at 12:51










  • and according to wyzant.com/resources/answers/4393/… cube is also rectangular prism.
    – Oray
    Aug 17 at 12:52










  • Since Gareth McCaugham has corrected his slight mistake you should credit him with the accepted answer, for anteriority and for the redaction effort that I just copied and pasted.
    – Evargalo
    Aug 17 at 20:57















Does a cube count as a rectangular prism??
– Kevin L
Aug 17 at 12:48




Does a cube count as a rectangular prism??
– Kevin L
Aug 17 at 12:48




1




1




we dont know if any group of prism creates a cube and since dimensions are not given, yes you will count cubes as prisms.
– Oray
Aug 17 at 12:50




we dont know if any group of prism creates a cube and since dimensions are not given, yes you will count cubes as prisms.
– Oray
Aug 17 at 12:50












ok gonna start counting :)
– Kevin L
Aug 17 at 12:51




ok gonna start counting :)
– Kevin L
Aug 17 at 12:51












and according to wyzant.com/resources/answers/4393/… cube is also rectangular prism.
– Oray
Aug 17 at 12:52




and according to wyzant.com/resources/answers/4393/… cube is also rectangular prism.
– Oray
Aug 17 at 12:52












Since Gareth McCaugham has corrected his slight mistake you should credit him with the accepted answer, for anteriority and for the redaction effort that I just copied and pasted.
– Evargalo
Aug 17 at 20:57




Since Gareth McCaugham has corrected his slight mistake you should credit him with the accepted answer, for anteriority and for the redaction effort that I just copied and pasted.
– Evargalo
Aug 17 at 20:57










3 Answers
3






active

oldest

votes

















up vote
6
down vote



accepted










Suppose we leave the corners there. Then




a rectangular prism (= cuboid) is defined by three pairs of planes, so there are $binom62^3=15^3=3375$ of these.




How many of these are excluded by having no corners?




A cuboid $[a,b]times[c,d]times[e,f]$ uses a corner iff ($a=0$ OR $b=5$) AND ($c=0$ OR $d=5$) AND ($e=0$ OR $f=5$). The number of ways to choose $(a,b)$ so that this happens is 11, so there are $11^3=1331$ of these.




[EDITED to add:]




Oops, turns out I meant 9 not 11. 01 02 03 04 05 15 25 35 45. So 729 rather than 1331, leading to a correspondingly larger final answer.




So the number of "good" cuboids is




3375 minus 1331 = 2044. [EDITED to add:] Nope, 3375-729 = 2646.







share|improve this answer






















  • you're counting a=b=0 etc.
    – JonMark Perry
    Aug 17 at 13:48










  • Yes, I am. There are six relevant planes for each axis, from x=0 to x=5 etc. Any way of picking two different ones on each axis yields a cuboid.
    – Gareth McCaughan♦
    Aug 17 at 15:40










  • Oh, sorry, you mean I'm counting (0,0) as well as (0,5) etc.? No, I wasn't. I did miscount, but it was a simple off-by-one error rather than anything that interesting.
    – Gareth McCaughan♦
    Aug 17 at 15:49










  • it looks like you counted [0,0]x[1,3]x[2,4] for example (in the second part)
    – JonMark Perry
    Aug 17 at 15:52











  • I don't think so. I think I just thought "01 02 ... 05 / 05 15 ... 45, one overlap, that'll be 11" when in fact it should have been 9. I'm not sure my thought process was even as conscious as that.
    – Gareth McCaughan♦
    Aug 17 at 16:45

















up vote
6
down vote













I think Gareth McCaughan has the right reasoning but a small calculation error. I'll copy his explanations here :



Suppose we leave the corners there. Then




Let's give coordinates to the cubes from 1 to 5 in length, width and height. A rectangular prism (= cuboïd) is defined by its smallest and biggest index (possibly equal) on each axis, so there are $(binom52+5)^3=15^3=3375$ of these.




How many of these are excluded by having no corners?




A cuboïd $[a,b]times[c,d]times[e,f]$ uses a corner iff ($a=1$ OR $b=5$) AND ($c=1$ OR $d=5$) AND ($e=1$ OR $f=5$). The number of ways to choose $(a,b)$ so that this happens is $9$, so there are $9^3=729$ of these.




Alternatively, by inclusion/exclusion:




There are $5 times 5 times 5=125$ cuboïds using the 'vanished' $(1,1,1)$ corner cube, and $8$ ways to pick a corner.

There are $5 times 5=25$ cuboïds using the 'vanished' $(1,1,1)$ and $(1,1,5)$ cubes, and $12$ ways to pick an edge.

There are $5$ cuboïds using the four 'vanished' $(1,1,1)$, $(1,5,1)$, $(1,5,5)$ and $(1,1,5)$ cubes on any given face, and $6$ ways to pick a face.

There is $1$ cuboïd using all eight 'vanished' corner cubes.

The number of 'wrong' cuboïds is then: $(125 times 8)-(25 times 12)+ (5 times 6) -1=729$




So the number of "good" cuboïds is




$3375 - 729 = mathbf2646$.







share|improve this answer






















  • Evargalo, I think you had it initially correct in your alternative explanation; your math no longer tallies in the final equation of your third paragraph.
    – El-Guest
    Aug 17 at 13:43










  • @El-Guest. Thanks, I've edited and I hope it is correct now.
    – Evargalo
    Aug 17 at 13:44










  • Looks much better. I can clean up some of the math formatting for you as well.
    – El-Guest
    Aug 17 at 13:46






  • 1




    Looks great! thanks again.
    – Evargalo
    Aug 17 at 13:49






  • 2




    This is slightly incorrect because it has "1 or 5" everywhere, where it should be "0 or 5". I confess myself slightly miffed that someone else is getting the coveted green checkmark for copying-and-pasting my answer, fixing a trivial error, and making another trivial error in turn, but never mind. I suppose there's the inclusion-exclusion bit. (I decided not to do it that way because the argument I actually gave was much easier to follow.)
    – Gareth McCaughan♦
    Aug 17 at 15:47

















up vote
3
down vote













A computer version in JavaScript:



<!doctype html>
<html>
<title>Cuboids</title>
<body>
<span id='out'></span><br>
<button onclick='go();'>go</button>
</body>

<script>

function go() c==14)) d++;
out.textContent=d;

d=0;
for (let a=0;a<5;a++)
for (let b=0;b<5;b++)
for (let c=0;c<5;c++)
d+=countCuboids(a,b,c);
out.textContent+=' :: '+d;


function countCuboids(a,b,c)
if (a%4==0 && b%4==0 && c%4==0) return 0;
if (a%4>0 && b%4==0 && c%4==0) return (4-a)*(5-b)*(5-c);
if (a%4==0 && b%4>0 && c%4==0) return (5-a)*(4-b)*(5-c);
if (a%4==0 && b%4==0 && c%4>0) return (5-a)*(5-b)*(4-c);
if (a%4>0 && b%4>0 && c%4==0) return (5-a)*(5-b)*(5-c)-(5-c);
if (a%4>0 && b%4==0 && c%4>0) return (5-a)*(5-b)*(5-c)-(5-b);
if (a%4==0 && b%4>0 && c%4>0) return (5-a)*(5-b)*(5-c)-(5-a);
if (a%4>0 && b%4>0 && c%4>0) return (5-a)*(5-b)*(5-c)-1;


</script>

</html>


The first version maps $0..14$ to $1,12,123,1234,12345,2,23,234,2345,3,34,345,4,45,5$ and counts anything that has a $1$ or a $5$ in all three loop variables.



Result: 729 (=$15^3-2646$)



The second uses an explicit function to calculate the number of right, up, back cuboids from a starting cube, and sums them.



Result: 2646






share|improve this answer




















    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: "559"
    ;
    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: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    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%2fpuzzling.stackexchange.com%2fquestions%2f69841%2frectangular-prisms%23new-answer', 'question_page');

    );

    Post as a guest






























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    6
    down vote



    accepted










    Suppose we leave the corners there. Then




    a rectangular prism (= cuboid) is defined by three pairs of planes, so there are $binom62^3=15^3=3375$ of these.




    How many of these are excluded by having no corners?




    A cuboid $[a,b]times[c,d]times[e,f]$ uses a corner iff ($a=0$ OR $b=5$) AND ($c=0$ OR $d=5$) AND ($e=0$ OR $f=5$). The number of ways to choose $(a,b)$ so that this happens is 11, so there are $11^3=1331$ of these.




    [EDITED to add:]




    Oops, turns out I meant 9 not 11. 01 02 03 04 05 15 25 35 45. So 729 rather than 1331, leading to a correspondingly larger final answer.




    So the number of "good" cuboids is




    3375 minus 1331 = 2044. [EDITED to add:] Nope, 3375-729 = 2646.







    share|improve this answer






















    • you're counting a=b=0 etc.
      – JonMark Perry
      Aug 17 at 13:48










    • Yes, I am. There are six relevant planes for each axis, from x=0 to x=5 etc. Any way of picking two different ones on each axis yields a cuboid.
      – Gareth McCaughan♦
      Aug 17 at 15:40










    • Oh, sorry, you mean I'm counting (0,0) as well as (0,5) etc.? No, I wasn't. I did miscount, but it was a simple off-by-one error rather than anything that interesting.
      – Gareth McCaughan♦
      Aug 17 at 15:49










    • it looks like you counted [0,0]x[1,3]x[2,4] for example (in the second part)
      – JonMark Perry
      Aug 17 at 15:52











    • I don't think so. I think I just thought "01 02 ... 05 / 05 15 ... 45, one overlap, that'll be 11" when in fact it should have been 9. I'm not sure my thought process was even as conscious as that.
      – Gareth McCaughan♦
      Aug 17 at 16:45














    up vote
    6
    down vote



    accepted










    Suppose we leave the corners there. Then




    a rectangular prism (= cuboid) is defined by three pairs of planes, so there are $binom62^3=15^3=3375$ of these.




    How many of these are excluded by having no corners?




    A cuboid $[a,b]times[c,d]times[e,f]$ uses a corner iff ($a=0$ OR $b=5$) AND ($c=0$ OR $d=5$) AND ($e=0$ OR $f=5$). The number of ways to choose $(a,b)$ so that this happens is 11, so there are $11^3=1331$ of these.




    [EDITED to add:]




    Oops, turns out I meant 9 not 11. 01 02 03 04 05 15 25 35 45. So 729 rather than 1331, leading to a correspondingly larger final answer.




    So the number of "good" cuboids is




    3375 minus 1331 = 2044. [EDITED to add:] Nope, 3375-729 = 2646.







    share|improve this answer






















    • you're counting a=b=0 etc.
      – JonMark Perry
      Aug 17 at 13:48










    • Yes, I am. There are six relevant planes for each axis, from x=0 to x=5 etc. Any way of picking two different ones on each axis yields a cuboid.
      – Gareth McCaughan♦
      Aug 17 at 15:40










    • Oh, sorry, you mean I'm counting (0,0) as well as (0,5) etc.? No, I wasn't. I did miscount, but it was a simple off-by-one error rather than anything that interesting.
      – Gareth McCaughan♦
      Aug 17 at 15:49










    • it looks like you counted [0,0]x[1,3]x[2,4] for example (in the second part)
      – JonMark Perry
      Aug 17 at 15:52











    • I don't think so. I think I just thought "01 02 ... 05 / 05 15 ... 45, one overlap, that'll be 11" when in fact it should have been 9. I'm not sure my thought process was even as conscious as that.
      – Gareth McCaughan♦
      Aug 17 at 16:45












    up vote
    6
    down vote



    accepted







    up vote
    6
    down vote



    accepted






    Suppose we leave the corners there. Then




    a rectangular prism (= cuboid) is defined by three pairs of planes, so there are $binom62^3=15^3=3375$ of these.




    How many of these are excluded by having no corners?




    A cuboid $[a,b]times[c,d]times[e,f]$ uses a corner iff ($a=0$ OR $b=5$) AND ($c=0$ OR $d=5$) AND ($e=0$ OR $f=5$). The number of ways to choose $(a,b)$ so that this happens is 11, so there are $11^3=1331$ of these.




    [EDITED to add:]




    Oops, turns out I meant 9 not 11. 01 02 03 04 05 15 25 35 45. So 729 rather than 1331, leading to a correspondingly larger final answer.




    So the number of "good" cuboids is




    3375 minus 1331 = 2044. [EDITED to add:] Nope, 3375-729 = 2646.







    share|improve this answer














    Suppose we leave the corners there. Then




    a rectangular prism (= cuboid) is defined by three pairs of planes, so there are $binom62^3=15^3=3375$ of these.




    How many of these are excluded by having no corners?




    A cuboid $[a,b]times[c,d]times[e,f]$ uses a corner iff ($a=0$ OR $b=5$) AND ($c=0$ OR $d=5$) AND ($e=0$ OR $f=5$). The number of ways to choose $(a,b)$ so that this happens is 11, so there are $11^3=1331$ of these.




    [EDITED to add:]




    Oops, turns out I meant 9 not 11. 01 02 03 04 05 15 25 35 45. So 729 rather than 1331, leading to a correspondingly larger final answer.




    So the number of "good" cuboids is




    3375 minus 1331 = 2044. [EDITED to add:] Nope, 3375-729 = 2646.








    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Aug 17 at 15:49

























    answered Aug 17 at 13:06









    Gareth McCaughan♦

    54.8k3136213




    54.8k3136213











    • you're counting a=b=0 etc.
      – JonMark Perry
      Aug 17 at 13:48










    • Yes, I am. There are six relevant planes for each axis, from x=0 to x=5 etc. Any way of picking two different ones on each axis yields a cuboid.
      – Gareth McCaughan♦
      Aug 17 at 15:40










    • Oh, sorry, you mean I'm counting (0,0) as well as (0,5) etc.? No, I wasn't. I did miscount, but it was a simple off-by-one error rather than anything that interesting.
      – Gareth McCaughan♦
      Aug 17 at 15:49










    • it looks like you counted [0,0]x[1,3]x[2,4] for example (in the second part)
      – JonMark Perry
      Aug 17 at 15:52











    • I don't think so. I think I just thought "01 02 ... 05 / 05 15 ... 45, one overlap, that'll be 11" when in fact it should have been 9. I'm not sure my thought process was even as conscious as that.
      – Gareth McCaughan♦
      Aug 17 at 16:45
















    • you're counting a=b=0 etc.
      – JonMark Perry
      Aug 17 at 13:48










    • Yes, I am. There are six relevant planes for each axis, from x=0 to x=5 etc. Any way of picking two different ones on each axis yields a cuboid.
      – Gareth McCaughan♦
      Aug 17 at 15:40










    • Oh, sorry, you mean I'm counting (0,0) as well as (0,5) etc.? No, I wasn't. I did miscount, but it was a simple off-by-one error rather than anything that interesting.
      – Gareth McCaughan♦
      Aug 17 at 15:49










    • it looks like you counted [0,0]x[1,3]x[2,4] for example (in the second part)
      – JonMark Perry
      Aug 17 at 15:52











    • I don't think so. I think I just thought "01 02 ... 05 / 05 15 ... 45, one overlap, that'll be 11" when in fact it should have been 9. I'm not sure my thought process was even as conscious as that.
      – Gareth McCaughan♦
      Aug 17 at 16:45















    you're counting a=b=0 etc.
    – JonMark Perry
    Aug 17 at 13:48




    you're counting a=b=0 etc.
    – JonMark Perry
    Aug 17 at 13:48












    Yes, I am. There are six relevant planes for each axis, from x=0 to x=5 etc. Any way of picking two different ones on each axis yields a cuboid.
    – Gareth McCaughan♦
    Aug 17 at 15:40




    Yes, I am. There are six relevant planes for each axis, from x=0 to x=5 etc. Any way of picking two different ones on each axis yields a cuboid.
    – Gareth McCaughan♦
    Aug 17 at 15:40












    Oh, sorry, you mean I'm counting (0,0) as well as (0,5) etc.? No, I wasn't. I did miscount, but it was a simple off-by-one error rather than anything that interesting.
    – Gareth McCaughan♦
    Aug 17 at 15:49




    Oh, sorry, you mean I'm counting (0,0) as well as (0,5) etc.? No, I wasn't. I did miscount, but it was a simple off-by-one error rather than anything that interesting.
    – Gareth McCaughan♦
    Aug 17 at 15:49












    it looks like you counted [0,0]x[1,3]x[2,4] for example (in the second part)
    – JonMark Perry
    Aug 17 at 15:52





    it looks like you counted [0,0]x[1,3]x[2,4] for example (in the second part)
    – JonMark Perry
    Aug 17 at 15:52













    I don't think so. I think I just thought "01 02 ... 05 / 05 15 ... 45, one overlap, that'll be 11" when in fact it should have been 9. I'm not sure my thought process was even as conscious as that.
    – Gareth McCaughan♦
    Aug 17 at 16:45




    I don't think so. I think I just thought "01 02 ... 05 / 05 15 ... 45, one overlap, that'll be 11" when in fact it should have been 9. I'm not sure my thought process was even as conscious as that.
    – Gareth McCaughan♦
    Aug 17 at 16:45










    up vote
    6
    down vote













    I think Gareth McCaughan has the right reasoning but a small calculation error. I'll copy his explanations here :



    Suppose we leave the corners there. Then




    Let's give coordinates to the cubes from 1 to 5 in length, width and height. A rectangular prism (= cuboïd) is defined by its smallest and biggest index (possibly equal) on each axis, so there are $(binom52+5)^3=15^3=3375$ of these.




    How many of these are excluded by having no corners?




    A cuboïd $[a,b]times[c,d]times[e,f]$ uses a corner iff ($a=1$ OR $b=5$) AND ($c=1$ OR $d=5$) AND ($e=1$ OR $f=5$). The number of ways to choose $(a,b)$ so that this happens is $9$, so there are $9^3=729$ of these.




    Alternatively, by inclusion/exclusion:




    There are $5 times 5 times 5=125$ cuboïds using the 'vanished' $(1,1,1)$ corner cube, and $8$ ways to pick a corner.

    There are $5 times 5=25$ cuboïds using the 'vanished' $(1,1,1)$ and $(1,1,5)$ cubes, and $12$ ways to pick an edge.

    There are $5$ cuboïds using the four 'vanished' $(1,1,1)$, $(1,5,1)$, $(1,5,5)$ and $(1,1,5)$ cubes on any given face, and $6$ ways to pick a face.

    There is $1$ cuboïd using all eight 'vanished' corner cubes.

    The number of 'wrong' cuboïds is then: $(125 times 8)-(25 times 12)+ (5 times 6) -1=729$




    So the number of "good" cuboïds is




    $3375 - 729 = mathbf2646$.







    share|improve this answer






















    • Evargalo, I think you had it initially correct in your alternative explanation; your math no longer tallies in the final equation of your third paragraph.
      – El-Guest
      Aug 17 at 13:43










    • @El-Guest. Thanks, I've edited and I hope it is correct now.
      – Evargalo
      Aug 17 at 13:44










    • Looks much better. I can clean up some of the math formatting for you as well.
      – El-Guest
      Aug 17 at 13:46






    • 1




      Looks great! thanks again.
      – Evargalo
      Aug 17 at 13:49






    • 2




      This is slightly incorrect because it has "1 or 5" everywhere, where it should be "0 or 5". I confess myself slightly miffed that someone else is getting the coveted green checkmark for copying-and-pasting my answer, fixing a trivial error, and making another trivial error in turn, but never mind. I suppose there's the inclusion-exclusion bit. (I decided not to do it that way because the argument I actually gave was much easier to follow.)
      – Gareth McCaughan♦
      Aug 17 at 15:47














    up vote
    6
    down vote













    I think Gareth McCaughan has the right reasoning but a small calculation error. I'll copy his explanations here :



    Suppose we leave the corners there. Then




    Let's give coordinates to the cubes from 1 to 5 in length, width and height. A rectangular prism (= cuboïd) is defined by its smallest and biggest index (possibly equal) on each axis, so there are $(binom52+5)^3=15^3=3375$ of these.




    How many of these are excluded by having no corners?




    A cuboïd $[a,b]times[c,d]times[e,f]$ uses a corner iff ($a=1$ OR $b=5$) AND ($c=1$ OR $d=5$) AND ($e=1$ OR $f=5$). The number of ways to choose $(a,b)$ so that this happens is $9$, so there are $9^3=729$ of these.




    Alternatively, by inclusion/exclusion:




    There are $5 times 5 times 5=125$ cuboïds using the 'vanished' $(1,1,1)$ corner cube, and $8$ ways to pick a corner.

    There are $5 times 5=25$ cuboïds using the 'vanished' $(1,1,1)$ and $(1,1,5)$ cubes, and $12$ ways to pick an edge.

    There are $5$ cuboïds using the four 'vanished' $(1,1,1)$, $(1,5,1)$, $(1,5,5)$ and $(1,1,5)$ cubes on any given face, and $6$ ways to pick a face.

    There is $1$ cuboïd using all eight 'vanished' corner cubes.

    The number of 'wrong' cuboïds is then: $(125 times 8)-(25 times 12)+ (5 times 6) -1=729$




    So the number of "good" cuboïds is




    $3375 - 729 = mathbf2646$.







    share|improve this answer






















    • Evargalo, I think you had it initially correct in your alternative explanation; your math no longer tallies in the final equation of your third paragraph.
      – El-Guest
      Aug 17 at 13:43










    • @El-Guest. Thanks, I've edited and I hope it is correct now.
      – Evargalo
      Aug 17 at 13:44










    • Looks much better. I can clean up some of the math formatting for you as well.
      – El-Guest
      Aug 17 at 13:46






    • 1




      Looks great! thanks again.
      – Evargalo
      Aug 17 at 13:49






    • 2




      This is slightly incorrect because it has "1 or 5" everywhere, where it should be "0 or 5". I confess myself slightly miffed that someone else is getting the coveted green checkmark for copying-and-pasting my answer, fixing a trivial error, and making another trivial error in turn, but never mind. I suppose there's the inclusion-exclusion bit. (I decided not to do it that way because the argument I actually gave was much easier to follow.)
      – Gareth McCaughan♦
      Aug 17 at 15:47












    up vote
    6
    down vote










    up vote
    6
    down vote









    I think Gareth McCaughan has the right reasoning but a small calculation error. I'll copy his explanations here :



    Suppose we leave the corners there. Then




    Let's give coordinates to the cubes from 1 to 5 in length, width and height. A rectangular prism (= cuboïd) is defined by its smallest and biggest index (possibly equal) on each axis, so there are $(binom52+5)^3=15^3=3375$ of these.




    How many of these are excluded by having no corners?




    A cuboïd $[a,b]times[c,d]times[e,f]$ uses a corner iff ($a=1$ OR $b=5$) AND ($c=1$ OR $d=5$) AND ($e=1$ OR $f=5$). The number of ways to choose $(a,b)$ so that this happens is $9$, so there are $9^3=729$ of these.




    Alternatively, by inclusion/exclusion:




    There are $5 times 5 times 5=125$ cuboïds using the 'vanished' $(1,1,1)$ corner cube, and $8$ ways to pick a corner.

    There are $5 times 5=25$ cuboïds using the 'vanished' $(1,1,1)$ and $(1,1,5)$ cubes, and $12$ ways to pick an edge.

    There are $5$ cuboïds using the four 'vanished' $(1,1,1)$, $(1,5,1)$, $(1,5,5)$ and $(1,1,5)$ cubes on any given face, and $6$ ways to pick a face.

    There is $1$ cuboïd using all eight 'vanished' corner cubes.

    The number of 'wrong' cuboïds is then: $(125 times 8)-(25 times 12)+ (5 times 6) -1=729$




    So the number of "good" cuboïds is




    $3375 - 729 = mathbf2646$.







    share|improve this answer














    I think Gareth McCaughan has the right reasoning but a small calculation error. I'll copy his explanations here :



    Suppose we leave the corners there. Then




    Let's give coordinates to the cubes from 1 to 5 in length, width and height. A rectangular prism (= cuboïd) is defined by its smallest and biggest index (possibly equal) on each axis, so there are $(binom52+5)^3=15^3=3375$ of these.




    How many of these are excluded by having no corners?




    A cuboïd $[a,b]times[c,d]times[e,f]$ uses a corner iff ($a=1$ OR $b=5$) AND ($c=1$ OR $d=5$) AND ($e=1$ OR $f=5$). The number of ways to choose $(a,b)$ so that this happens is $9$, so there are $9^3=729$ of these.




    Alternatively, by inclusion/exclusion:




    There are $5 times 5 times 5=125$ cuboïds using the 'vanished' $(1,1,1)$ corner cube, and $8$ ways to pick a corner.

    There are $5 times 5=25$ cuboïds using the 'vanished' $(1,1,1)$ and $(1,1,5)$ cubes, and $12$ ways to pick an edge.

    There are $5$ cuboïds using the four 'vanished' $(1,1,1)$, $(1,5,1)$, $(1,5,5)$ and $(1,1,5)$ cubes on any given face, and $6$ ways to pick a face.

    There is $1$ cuboïd using all eight 'vanished' corner cubes.

    The number of 'wrong' cuboïds is then: $(125 times 8)-(25 times 12)+ (5 times 6) -1=729$




    So the number of "good" cuboïds is




    $3375 - 729 = mathbf2646$.








    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Aug 17 at 21:04

























    answered Aug 17 at 13:32









    Evargalo

    869211




    869211











    • Evargalo, I think you had it initially correct in your alternative explanation; your math no longer tallies in the final equation of your third paragraph.
      – El-Guest
      Aug 17 at 13:43










    • @El-Guest. Thanks, I've edited and I hope it is correct now.
      – Evargalo
      Aug 17 at 13:44










    • Looks much better. I can clean up some of the math formatting for you as well.
      – El-Guest
      Aug 17 at 13:46






    • 1




      Looks great! thanks again.
      – Evargalo
      Aug 17 at 13:49






    • 2




      This is slightly incorrect because it has "1 or 5" everywhere, where it should be "0 or 5". I confess myself slightly miffed that someone else is getting the coveted green checkmark for copying-and-pasting my answer, fixing a trivial error, and making another trivial error in turn, but never mind. I suppose there's the inclusion-exclusion bit. (I decided not to do it that way because the argument I actually gave was much easier to follow.)
      – Gareth McCaughan♦
      Aug 17 at 15:47
















    • Evargalo, I think you had it initially correct in your alternative explanation; your math no longer tallies in the final equation of your third paragraph.
      – El-Guest
      Aug 17 at 13:43










    • @El-Guest. Thanks, I've edited and I hope it is correct now.
      – Evargalo
      Aug 17 at 13:44










    • Looks much better. I can clean up some of the math formatting for you as well.
      – El-Guest
      Aug 17 at 13:46






    • 1




      Looks great! thanks again.
      – Evargalo
      Aug 17 at 13:49






    • 2




      This is slightly incorrect because it has "1 or 5" everywhere, where it should be "0 or 5". I confess myself slightly miffed that someone else is getting the coveted green checkmark for copying-and-pasting my answer, fixing a trivial error, and making another trivial error in turn, but never mind. I suppose there's the inclusion-exclusion bit. (I decided not to do it that way because the argument I actually gave was much easier to follow.)
      – Gareth McCaughan♦
      Aug 17 at 15:47















    Evargalo, I think you had it initially correct in your alternative explanation; your math no longer tallies in the final equation of your third paragraph.
    – El-Guest
    Aug 17 at 13:43




    Evargalo, I think you had it initially correct in your alternative explanation; your math no longer tallies in the final equation of your third paragraph.
    – El-Guest
    Aug 17 at 13:43












    @El-Guest. Thanks, I've edited and I hope it is correct now.
    – Evargalo
    Aug 17 at 13:44




    @El-Guest. Thanks, I've edited and I hope it is correct now.
    – Evargalo
    Aug 17 at 13:44












    Looks much better. I can clean up some of the math formatting for you as well.
    – El-Guest
    Aug 17 at 13:46




    Looks much better. I can clean up some of the math formatting for you as well.
    – El-Guest
    Aug 17 at 13:46




    1




    1




    Looks great! thanks again.
    – Evargalo
    Aug 17 at 13:49




    Looks great! thanks again.
    – Evargalo
    Aug 17 at 13:49




    2




    2




    This is slightly incorrect because it has "1 or 5" everywhere, where it should be "0 or 5". I confess myself slightly miffed that someone else is getting the coveted green checkmark for copying-and-pasting my answer, fixing a trivial error, and making another trivial error in turn, but never mind. I suppose there's the inclusion-exclusion bit. (I decided not to do it that way because the argument I actually gave was much easier to follow.)
    – Gareth McCaughan♦
    Aug 17 at 15:47




    This is slightly incorrect because it has "1 or 5" everywhere, where it should be "0 or 5". I confess myself slightly miffed that someone else is getting the coveted green checkmark for copying-and-pasting my answer, fixing a trivial error, and making another trivial error in turn, but never mind. I suppose there's the inclusion-exclusion bit. (I decided not to do it that way because the argument I actually gave was much easier to follow.)
    – Gareth McCaughan♦
    Aug 17 at 15:47










    up vote
    3
    down vote













    A computer version in JavaScript:



    <!doctype html>
    <html>
    <title>Cuboids</title>
    <body>
    <span id='out'></span><br>
    <button onclick='go();'>go</button>
    </body>

    <script>

    function go() c==14)) d++;
    out.textContent=d;

    d=0;
    for (let a=0;a<5;a++)
    for (let b=0;b<5;b++)
    for (let c=0;c<5;c++)
    d+=countCuboids(a,b,c);
    out.textContent+=' :: '+d;


    function countCuboids(a,b,c)
    if (a%4==0 && b%4==0 && c%4==0) return 0;
    if (a%4>0 && b%4==0 && c%4==0) return (4-a)*(5-b)*(5-c);
    if (a%4==0 && b%4>0 && c%4==0) return (5-a)*(4-b)*(5-c);
    if (a%4==0 && b%4==0 && c%4>0) return (5-a)*(5-b)*(4-c);
    if (a%4>0 && b%4>0 && c%4==0) return (5-a)*(5-b)*(5-c)-(5-c);
    if (a%4>0 && b%4==0 && c%4>0) return (5-a)*(5-b)*(5-c)-(5-b);
    if (a%4==0 && b%4>0 && c%4>0) return (5-a)*(5-b)*(5-c)-(5-a);
    if (a%4>0 && b%4>0 && c%4>0) return (5-a)*(5-b)*(5-c)-1;


    </script>

    </html>


    The first version maps $0..14$ to $1,12,123,1234,12345,2,23,234,2345,3,34,345,4,45,5$ and counts anything that has a $1$ or a $5$ in all three loop variables.



    Result: 729 (=$15^3-2646$)



    The second uses an explicit function to calculate the number of right, up, back cuboids from a starting cube, and sums them.



    Result: 2646






    share|improve this answer
























      up vote
      3
      down vote













      A computer version in JavaScript:



      <!doctype html>
      <html>
      <title>Cuboids</title>
      <body>
      <span id='out'></span><br>
      <button onclick='go();'>go</button>
      </body>

      <script>

      function go() c==14)) d++;
      out.textContent=d;

      d=0;
      for (let a=0;a<5;a++)
      for (let b=0;b<5;b++)
      for (let c=0;c<5;c++)
      d+=countCuboids(a,b,c);
      out.textContent+=' :: '+d;


      function countCuboids(a,b,c)
      if (a%4==0 && b%4==0 && c%4==0) return 0;
      if (a%4>0 && b%4==0 && c%4==0) return (4-a)*(5-b)*(5-c);
      if (a%4==0 && b%4>0 && c%4==0) return (5-a)*(4-b)*(5-c);
      if (a%4==0 && b%4==0 && c%4>0) return (5-a)*(5-b)*(4-c);
      if (a%4>0 && b%4>0 && c%4==0) return (5-a)*(5-b)*(5-c)-(5-c);
      if (a%4>0 && b%4==0 && c%4>0) return (5-a)*(5-b)*(5-c)-(5-b);
      if (a%4==0 && b%4>0 && c%4>0) return (5-a)*(5-b)*(5-c)-(5-a);
      if (a%4>0 && b%4>0 && c%4>0) return (5-a)*(5-b)*(5-c)-1;


      </script>

      </html>


      The first version maps $0..14$ to $1,12,123,1234,12345,2,23,234,2345,3,34,345,4,45,5$ and counts anything that has a $1$ or a $5$ in all three loop variables.



      Result: 729 (=$15^3-2646$)



      The second uses an explicit function to calculate the number of right, up, back cuboids from a starting cube, and sums them.



      Result: 2646






      share|improve this answer






















        up vote
        3
        down vote










        up vote
        3
        down vote









        A computer version in JavaScript:



        <!doctype html>
        <html>
        <title>Cuboids</title>
        <body>
        <span id='out'></span><br>
        <button onclick='go();'>go</button>
        </body>

        <script>

        function go() c==14)) d++;
        out.textContent=d;

        d=0;
        for (let a=0;a<5;a++)
        for (let b=0;b<5;b++)
        for (let c=0;c<5;c++)
        d+=countCuboids(a,b,c);
        out.textContent+=' :: '+d;


        function countCuboids(a,b,c)
        if (a%4==0 && b%4==0 && c%4==0) return 0;
        if (a%4>0 && b%4==0 && c%4==0) return (4-a)*(5-b)*(5-c);
        if (a%4==0 && b%4>0 && c%4==0) return (5-a)*(4-b)*(5-c);
        if (a%4==0 && b%4==0 && c%4>0) return (5-a)*(5-b)*(4-c);
        if (a%4>0 && b%4>0 && c%4==0) return (5-a)*(5-b)*(5-c)-(5-c);
        if (a%4>0 && b%4==0 && c%4>0) return (5-a)*(5-b)*(5-c)-(5-b);
        if (a%4==0 && b%4>0 && c%4>0) return (5-a)*(5-b)*(5-c)-(5-a);
        if (a%4>0 && b%4>0 && c%4>0) return (5-a)*(5-b)*(5-c)-1;


        </script>

        </html>


        The first version maps $0..14$ to $1,12,123,1234,12345,2,23,234,2345,3,34,345,4,45,5$ and counts anything that has a $1$ or a $5$ in all three loop variables.



        Result: 729 (=$15^3-2646$)



        The second uses an explicit function to calculate the number of right, up, back cuboids from a starting cube, and sums them.



        Result: 2646






        share|improve this answer












        A computer version in JavaScript:



        <!doctype html>
        <html>
        <title>Cuboids</title>
        <body>
        <span id='out'></span><br>
        <button onclick='go();'>go</button>
        </body>

        <script>

        function go() c==14)) d++;
        out.textContent=d;

        d=0;
        for (let a=0;a<5;a++)
        for (let b=0;b<5;b++)
        for (let c=0;c<5;c++)
        d+=countCuboids(a,b,c);
        out.textContent+=' :: '+d;


        function countCuboids(a,b,c)
        if (a%4==0 && b%4==0 && c%4==0) return 0;
        if (a%4>0 && b%4==0 && c%4==0) return (4-a)*(5-b)*(5-c);
        if (a%4==0 && b%4>0 && c%4==0) return (5-a)*(4-b)*(5-c);
        if (a%4==0 && b%4==0 && c%4>0) return (5-a)*(5-b)*(4-c);
        if (a%4>0 && b%4>0 && c%4==0) return (5-a)*(5-b)*(5-c)-(5-c);
        if (a%4>0 && b%4==0 && c%4>0) return (5-a)*(5-b)*(5-c)-(5-b);
        if (a%4==0 && b%4>0 && c%4>0) return (5-a)*(5-b)*(5-c)-(5-a);
        if (a%4>0 && b%4>0 && c%4>0) return (5-a)*(5-b)*(5-c)-1;


        </script>

        </html>


        The first version maps $0..14$ to $1,12,123,1234,12345,2,23,234,2345,3,34,345,4,45,5$ and counts anything that has a $1$ or a $5$ in all three loop variables.



        Result: 729 (=$15^3-2646$)



        The second uses an explicit function to calculate the number of right, up, back cuboids from a starting cube, and sums them.



        Result: 2646







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 17 at 15:14









        JonMark Perry

        13.3k42666




        13.3k42666



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fpuzzling.stackexchange.com%2fquestions%2f69841%2frectangular-prisms%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            List of Gilmore Girls characters

            Confectionery