document.write( "Question 467162: D has less than 30 marbles. When he puts them in piles of 3 he has no marble left over. when he puts them in piles of 5 he has 2 left. He has........ marbles. \n" ); document.write( "
Algebra.Com's Answer #320440 by robertb(5830)\"\" \"About 
You can put this solution on YOUR website!
The problem is equivalent to solving a linear diophantine equation\r
\n" ); document.write( "\n" ); document.write( "3x = 5y + 2, or 3x - 5y = 2.\r
\n" ); document.write( "\n" ); document.write( "Bezout's identity says that the equation ax + by = c having one solution (r,s) will have other solutions given by \"x+=+r+%2B+%28kb%29%2Fgcd%28a%2Cb%29\" and \"y+=+s+-+%28ka%29%2Fgcd%28a%2Cb%29\", where k is from the set of all integers.\r
\n" ); document.write( "\n" ); document.write( "Now one solution of 3x - 5y = 2 is (-1,-1), so let r = -1 and s = -1.\r
\n" ); document.write( "\n" ); document.write( "Hence \"x+=+-1+%2B+%28-5k%29%2Fgcd%283%2C-5%29+=+-1+-+5k\"
\n" ); document.write( " and \"y+=+-1+-+%283k%29%2Fgcd%28a%2Cb%29+=+-1+-+3k\",
\n" ); document.write( "For k = -1 ==> x = 4, y = 2;
\n" ); document.write( "k = -2 ==> x = 9, y = 5;
\n" ); document.write( "k = -3 ==> x = 14, y = 8;...etc.
\n" ); document.write( "Therefore there are two possible solutions to the original problem, either\r
\n" ); document.write( "\n" ); document.write( "3*4 = 5*2 + 2 = 12, or \r
\n" ); document.write( "\n" ); document.write( "3*9 = 5*5 + 2 = 27.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "
\n" ); document.write( "
\n" );