## Fermat’s Divisors Challenges

### September 8, 2015

Pierre de Fermat issued these two challenges in 1657: First, find a cube that, when increased by the sum of its aliquot divisors, becomes a square; for instance, 73 + (1 + 7 + 72) = 203. Second, find a square that, when increased by the sum of its aliquot divisors, becomes a cube. I would guess that Fermat knew the answer to the first challenge but not the second.

In the days before computers, challenges such as this were frequently issued by one mathematician or group of mathematicians to their competing colleagues; for instance, the French mathematicians might challenge the German mathematicians. Once the challenge was met, the solving group would issue a new challenge to the original challengers. It was considered un-gentlemanly to issue a challenge to which you did not have a solution, though Fermat was probably respected enough to get away with it. Times have changed.

Your task is to write programs that find solutions to the two challenges. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2 3

### 4 Responses to “Fermat’s Divisors Challenges”

1. Rutger said

In Python.

```def sum_divisors_is_square(cube):
sum_divisors = sum([i for i in range(1,cube/2+1) if not cube % i]+[cube])
return sum_divisors ** 0.5 ==  int(sum_divisors**0.5)

for i in range(10):
print i, sum_divisors_is_square(i**3)
```

Finding divisors could be more efficient (iterate up through sqrt(n), if i is a divisor, then so is n/i). Also, Python’s range() function doesnt like big numbers, so should be transformed in a while loop.

2. […] makes solving the Fermat Exponent problem […]

3. Mayur Lokare said

#include
int main()
{
int i,sum,sq=0,l=0,n;
printf(“Enter the Range\n”);
scanf(“%d”,&n);
for(i=1;i<n;i++)
{
sum=1+i+i*i+i*i*i;
while(sq %d\n”,i,l);
l=1;
}
}

O/P:
Enter the Range
1000
1 -> 2
7 -> 20

4. Mayur Lokare said

EX 2.

#include
int main()
{
int i,sum,cu=0,l=0,n;
printf(“Enter the Range\n”);
scanf(“%d”,&n);
for(i=1;i<n;i++)
{
sum=1+i+i*i;
while(cu %d\n”,l,i);
l=1;
cu=0;
}
}

O/P:
Enter the Range
1000
7 -> 18