arjtryarjtry
In a six-digit integer N F(k) is the value of the k-th digit. For example, F(4) is the value of the hundreds digit of N. Is N divisible by 7?
1. F(1) = F(4), F(2) = F(5), F(3) = F(6)
2. F(1) = F(2) = ... = F(6)
ABABAB
1) 100000*A +10000*B+ 1000*A +100*B + 10A +B
= 101010*A+10101* B
= (2a+b) * 10101
10101 --> is divisiable by 7
To find out if a number is divisible by seven, take the last digit, double it, and subtract it from the rest of the number
1010-2 --> 108 is divisable by 7
Suffcieint
2) A* 111111
111111 -->11111-2 =11109
11109 -->1110-18 = 1092 =
1092 --> 105 is divisable by 7
sufficient
Any other short cuts.
Am I reading this wrong? Is the number ABABAB or ABCABC? Obviously, your method would still be able to test: