Click here to Skip to main content
12,452,106 members (58,097 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# C#4.0
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 24-Sep-12 0:47am
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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

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;
}
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 24 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100