Determine the sum of the four smallest prime factors of:
2016239 -1
clearvars,clc
n=sym(2016)^239 - 1;
ct=0; p=1; tot=0;
while ct<6
p=nextprime(p+1);
if mod(n,p)==0
tot=tot+p;
ct=ct+1;
fprintf('%1d %5d %5d\n',[ct p tot])
end
end
finds
seq prime cumulative
total
1 5 5
2 13 18
3 31 49
4 479 528
5 1913 2441
so the answer is the sum of 5 + 13 + 31 + 479 = 528. The 2441 sum, including the fifth such prime factor, 1913, is shown as a bonus. After that, allowing about a minute more, testing primes to 392,351, none are found to divide n.
Matlab does report that only the first power of these five primes divide n:
>> mod(n,25)
ans =
10
>> mod(n,13^2)
ans =
104
>> mod(n,31^2)
ans =
124
>> mod(n,479^2)
ans =
9101
>> mod(n,1913^2)
ans =
3129668
What's left after dividing by the first five prime factors is still not prime, however:
>> m=n/(5*13*31*479*1913)
m =
3212999100326873825193976220655406380369446602007243975908933749426666288915337901127057095218217184
6991636930673633683280953579103832070633231986657486698571476534039814637999524195065913056565282893
7663616080651781232105615343065349623444256532516390886075073280275649760449313191387742921188378540
2453723230823739989618691311727985865741560231710835021084212017326252809730887449083175882120403966
2890443176588563695596493840974300189033271208724028105265081844197844710272837596847334046666941409
2815712622251147426185498412745885051257154300629271743239562091996681446452161675512111786954579039
5214000305664026803331947472080678833537205872685756390367479275824809754123249868162863612464210083
059899282409338031378889936517759111169277371165102237437130959745789001247127927
>> isprime(m)
ans =
logical
0
|
Posted by Charlie
on 2023-06-14 13:40:54 |