Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How can i check that passed number is a calypso number or not

int isCalypso(int n)

Is there anyone who can tell me that any logic or help for that will be your kind enough for me
Posted
Comments
OriginalGriff 24-Sep-12 7:24am    
What have you tried?
Because we don't do your homework for you - we expect you to put some effort in!
usmanali.ali843 24-Sep-12 8:16am    
if you can't help a stucking person to bring him out from any particular issue and not be able to give any helpful logic behind any problem then I haven't seen so dumb and dull and stupid person like you did because if you know any logic then that will be your honesty to tell to those who just stuck in that problem and don't disheart them. Remember these things. Hope you'll take care of these things next time

1 solution

If by "calypso number" you mean this then a naive implementation would be sometihng like:

C#
bool isCalypso(int n)
{
    int pairCount=0;
    for (int i = 2; i <= n/2 && pairCount < 2; i++){
        if (isPrime(i) && isPrime(n-i) pairCount++;
    }
    return pairCount > 1;
}
 
Share this answer
 
Comments
usmanali.ali843 24-Sep-12 8:17am    
Thanks a lot to bring me out from this problem yeah i have done now what i wanna do thanks again.
sjelen 24-Sep-12 8:45am    
If it helped, then mark it as solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900