Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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 1:47am
Comments
OriginalGriff at 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 at 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 at 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 at 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
0 Zoltán Zörgő 220
1 Peter Leow 160
2 CPallini 120
3 BillWoodruff 85
4 bling 80
0 Sergey Alexandrovich Kryukov 9,428
1 OriginalGriff 6,901
2 Peter Leow 4,737
3 Zoltán Zörgő 4,349
4 CHill60 2,932


Advertise | Privacy | Mobile
Web01 | 2.8.150129.1 | Last Updated 24 Sep 2012
Copyright © CodeProject, 1999-2015
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