Challenge located here
Okay so I figured out the number to call in I just don't understand what to do with the result (this could probably have something to do with my limited experince in mathamatics)
so I calc the first Prime fibonacci number larger than the one given over the phone
so lets call that number x
but now I don't under stand the "sum of the prime devisors +1"
as I understand it X is prime so there for the prime devisors are 1 and X
unless its (x+1) to then find the devisors (array D) then find the numbers in D that are prime (array Pd)
Pd1+Pd2= answer
Am I barking up the right tree?
My source code thus far ( I Can provide the is prime code if needed i assume its not)
private static long CalcPassword2(long p)
{
p++;
List<int> factors = new List<int>();
for (int i = 1; i <= p; i++)
{
if (p % i == 0)
if (isprime(i))
{
factors.Add(i);
}
}
if (factors.Count >= 2)
{
factors.Sort();
factors.Reverse();
return factors[0]+factors[1];
}
return 1;
}
I miss read the answer is the sum of all prime factors of the number x
Here is the updated code: (please feel free to comment on the code)