Seems there is an error

programming
Tags: #<Tag:0x00007f24266dec68>

#1

When applying the solution it fails on A=4
On my results of [1,3]
and only suggest the following results: [2,2]
which is not aligned with the problem conditions of: [a,b] < [c,d]
Where a<c OR (a==c AND b<d)


#2

You only need to traverse A/2 times where A is the number and the condition is automatically maintain.


#3

Let me rephrase,
For A=4
The suggested results are: [2,2]
which is not aligned with the problem conditions of: [a,b] < [c,d]
Where a<c OR (a==c AND b<d)

My solution is: [1,3]
Which is aligned with this condition, however
It is not accepted


#4

1 is not prime.
bool isPrime(int n)
{
if(n == 1)
return false;
if(n == 2 || n== 3)
** return true;**
if(n%2 == 0 || n%3 == 0)
return false;

    for(int i=5; i*i<=n; i=i+6){
        if(n%i==0 || n%(i+2)==0){
         return false;
    }
    }
    return true;
}

plz use above code to check for prime.