Consider all 2 digit numbers N such that the last 2 digits of N^2 are N itself. What is the sum of all these 2 digit numbers?
the answer is 76
sorry the answer should be 101
I do like this:
first consider the possible last digit of the number, then you have 0,1,5,6
Let N be ab
For number end with 0,
the last two digits of N will be 00
no numbers can be formed as 00 is not a
2 digit numbers
For number end with 1,
it must satisfy the conditions:
last digit of 2a=a
no numbers can be formed
For number end with 5,
it must satisfy the conditions:
last digit of 10a+2=a
the number 25 can be formed
For number end with ,
it must satisfy the conditions:
last digit of 12a+3=a
the number 76 can be formed
Sum of N=76+25=101
To find the sum of all two-digit numbers N such that the last two digits of N^2 are N itself, we need to determine which values of N satisfy this condition and then add them up.
Let's start by understanding the condition that the last two digits of N^2 are equal to N. We can express this mathematically as:
(N^2) % 100 = N
Here, "%" represents the modulus operator, which gives the remainder of the division. So, the expression above means that when N^2 is divided by 100, the remainder should be equal to N.
Now, let's iterate through all two-digit numbers to check which ones satisfy this condition:
```python
sum_of_numbers = 0
for N in range(10, 100):
if (N ** 2) % 100 == N:
sum_of_numbers += N
print(sum_of_numbers)
```
In this code, we initialize a variable `sum_of_numbers` to keep track of the sum of the numbers that satisfy the condition. Then, we use a for loop to iterate over each two-digit number N from 10 to 99.
Inside the loop, we check if the square of N, denoted as `N ** 2`, modulo 100 is equal to N. If it is, we add N to the `sum_of_numbers`.
After the loop finishes, we print the final value of `sum_of_numbers`, which will be the sum of all two-digit numbers satisfying the given condition.
Running the code will give you the desired sum of all two-digit numbers N.