# How to find that a number is divisible by 3, without using division/subtraction

India
January 19, 2007 5:16am CST
Hi all, A new puzzle for you again, How to find that a number is divisible by 3, without using division/subtraction etc? I hope people will enjoy this series and take participate to encourage myself to post more and more puzzle for your brain exerciese.... Please do reply ...
11 responses
@dholey (1383)
• India
29 Jan 07
int check(int v) { int a=1,b=3; for( ; b
@dholey (1383)
• India
29 Jan 07
one can use long instead of int for big value .....
@dholey (1383)
• India
29 Jan 07
here is the correct logig .. without using +,/and %... void main() { long x,y; printf("\n ENTER ANY NUMBER "); scanf("%ld",&x); for(y=x;y3;y-=3) ; if(y==3) printf("%ld is fully divisible by 3",x); else printf("%ld is not fully divisible by 3",x); } i think it is one of the answer for your puzzle .... i am still thinking for some other option too .... (where are you not loged for last three days ... any thing serious )
@dholey (1383)
• India
1 Feb 07
here comes the real solution... it took long time to make logic ... but MAZA AA GAYA .... HERE IS THE REAL CODE YOU CAN SEE THERE IS NO ARITHMETIC OPERATOR USED AND IT CAN BE USED TO CHECK ANY NUMBERS DIVISIBILITY .. ONE HAS TO CHENG THE VALUE OF MACRO DIV ONLY .......... THANKS DUDE TO MAKE ME A LITTLE SHARP .... I SOLVED IT ... HURRRA .... (i just have finished the logic building and testing .... you can understand the feelings of accomplishing task) here is the code #include #include #define DIV 3 void main() { unsigned x,y,z,c,car,k; long v; x=y=DIV; clrscr(); cout v; if (v
@deepuj (591)
• India
19 Jan 07
Well i way is this, it will help when the no. is really big, add up all the digits of the no. , if the sum is divisible by 3, then the no. is also divisible by 3.If anyone know any other better method plz post.
@deepuj (591)
• India
19 Jan 07
Ex:5421 sum of all digits : 5+4+2+1 = 12 ,which is divisible by 3, hence the no. 5421 is also divisible by 3.
• India
19 Jan 07
Good answer but I got a doubt. The answer is 12 and to check whether 12 is divisible by 3 we need to check it by dividing (in terms of computer programming)? But in the question it is written we cannot divide or subtract.
• Pakistan
19 Jan 07
Hey thats a great way! Thhanks for telling
• India
20 Jan 07
Yes, its a good puzzle. As in division, if a number (Say m) is divided by another number (say n), then m is said to be divisible by n when remainder comes to be 0 (zero). The same concept I am using her. If m%3 is equal to 0 (zero) than number is divisible by 3. Else not. I wrote above in accordance with the programming language.
• India
20 Jan 07
Sorry I forgot one thing, % is a modulus operator results a remainder. Thanks.
• India
21 Jan 07
Hi Vijay, I m very sorry, but i forget to mention that % is also not acceptable... No subtraction, No division and No Modulus :)
@trogoz (140)
• Italy
3 Feb 07
I love math puzzles! But i want solutions for those i cannot solve! However i know this: sum all cyphers of the number until you have a single cypher, then if it's divisible by 3 (so it can be 3, 6 or 9) the starting number is!!
@dholey (1383)
• India
3 Feb 07
see , we can not use any of the arithmetical operator so??????
• India
20 Jan 07
first choose a number which u want to divide, now add the digits in the n u have choosen if the no is greater than 9 than add again the digits of resultant no. now if the no is 3, 6, 9 than u can divide the number by . e.g. u choose -- 57 5+7=12 , then add 1+2=3. now u can divide 57 by 3.
• India
21 Jan 07
Hmmm.... really intresting..... seems like u fix that. Nice solution dear. Now, there is no need of subraction, division or modulus..... But, can i come up with a twist, (Interesting for all algo lovers).... What if, i say No addition is allowed ???? :) Comments are most welcome !!!!
• India
19 Jan 07
we can use MODULUS symbol "%" for doing this .Eg: 27%3=0 that is the remainder after division. Therefore we can conclude that when any integer number is divisible by 3 then its remainder will be 0 or else if the remainder is not 0 then the number is not divisible by 3 !!! Eg: 28 % 3 = 1 so 28 is not divisible by 3
• India
21 Jan 07
No Arpita, % (Modulus) is also not accepted. Well i think i should include this also in my question... sorry for this mistake:)
@russelme (37)
• Philippines
19 Jan 07
Is modulo accepted? I mean in a programming if a number mod by 3 is equal to zero then it is divisible by 3. Example 9%3=0. But I think its like division..? Is this the way?
• India
21 Jan 07
No, this is also not accepted. Well i think i should include this also in my question... sorry for this mistake :)
@Xhristy (59)
• Ireland
22 Apr 07
lol i like this :D
@AJMSmith (113)
8 Feb 07
Insert a + sign between the first 2 digits of the number and sum repeatedly until you have only 1 digit left eg 1048576 - 48577 - 8581 - 589 - 94 - 13 - 4. The result is conguent with the original number modulo 9 (-ve numbers give a result in the range -9 to -1, +ve number in the range 1 to 9 and zero is the only number to give zero). Multiples of 3 give a multiple of 3 as a result. Doing the same with PAIRS of digits (spltting the number in pairs from the right) can be used as a test for 11 as a factor. 1 048576 - 4 8577 - 85 81 - 1 66 - 67. 1048576 is 7 modulo 11. A multiple of 11 would give a multiple of 11 here. How it works. by summing the digits (eg 1048576 to 148576 what you are doing is subtracting 0.9 times the value of the first digit from the number this is a multiple of 9 so the result is unchanged modulo 9ef from 1048576 to 148576 you subtract 900000. Since 3 is a factor of 9 any multiple of 3 must also ne a multiple of 3 when the number is taked mod 3 the 11 test works because you are subtracting multples of 99 (rather than 9) and the result (number mod 99) is congruent with the original number mod 11 (11 is a factor of 99).
@bkpdp1 (921)
• India
25 Jan 07
Hey, a good question. I am trying to solve it. If i will show you a half glass of water, you may say it is half full glass or half empty glass. Similary according to your question Say a number = 24564. So 2+4+5+6+4 = 21, So if you take HCF (Highest Common Factor) of 21, it will be either 3 or 7. (I have not devided or substracted) As 3 is there, so the number is divisible by 3 and if HCF of 21 does not consist of 3, then it will never be devided by the number. Hope you got my point..
• India
25 Jan 07
take a no which u want to divide by 3. e.g.:- no is 23451. 2+3+4+5+1=15, 1+5=6. 6 is divisible by 3 .so 23451 is divisible by 3.