What will be the value of least significant byte?

214 Views Asked by At

Let N be the sum of all numbers from 1 to 1023 except the five prime numbers 2, 3, 11, 17 , 31, all numbers are represented by two bytes, what is the value of least significant byte? My approach is sum of N natural number up to 1023 is $\frac{n(n+1)}{2}=\frac{2^{10} (2^{10}-1)}{2}$ which, once I subtract 64 from the given number, gives $ (2^{19}-2^9-2^6)$ which gives me 01000000 as the value of least significant byte, but the answer is 11000000. I think I am doing something wrong. For not having any doubts I am giving the image of original question.

enter image description here

1

There are 1 best solutions below

1
On BEST ANSWER

This is another way of saying , what will be the remainder when $N$ is divided by $2^8=256$?

Here $$N = \frac{1023\times 1024}{2} - (2+3+11+17+31)$$ $$= 1023\times 512 - 64$$ $$= 1022\times 512 + (512-64)$$ $$ = 1022\times 512 + 448$$

Now $448\pmod{256} =192 = 11000000_{2}.$