Basic math
The number is divisible by 3 if the sum of its digits is divisible by 3. Example: 35, sum of its digits is 3+5=8, not divisible by 3, therefore 35 is not divisible by 3. 63, sum of its digits is 6+3=9, divisible by 3, therefore 63 is divisible by 3.
What if you have a number, which digits sum to a huge number and you do not know if it is divisible by 3? Keep summing digits, thus taking sum of digits of the sum of digits of the sum of digits.... and keep going until you get a single-digit number. If it is divisible by 3, your original number is also divisible by 3.
Example: 5909678375907723895907723723045096832479280. Its digits sum is:
5+9+0+9+6+7+8+3+7+5+9+0+7+7+2+3+8+9+5+9+0+7+7+2+3+7+2+3+0+4+5+0+9+6+8+3+2+4+7+9+2+8+0=216. Now sum up digits for 216, 2+1+6=9, 9 is divisible by 3, therefore, original number is divisible by 3.