TopcoderArchiveVisit Topcoder
SRM8 May 2001
SRM 1

PrimeNumbers

Problem statement, definition, constraints, and public examples.

Problem Statement

Implement a class PrimeNumbers that contains a method pairwisePrimes.  The
method inputs an int (num) and returns the number of ways the number can be
written as the sum of three distinct integers that are pairwise relatively
prime; that is no pair of the three integers has a common factor greater than 1.

Note:

- num is greater than 0 and less than or equal to 40.
- One of the three distinct integer can be 1; Numbers are Pairwise Relatively
Prime if they share no factor GREATER than 1.

Method Signature:

public int pairwisePrimes( int );

Examples:

For num=8:  8 can be written as 1+2+5 and 1+3+4 and the method should return 2.
For num=18, the method should return 14

Definition

Class:
PrimeNumbers
Method:
pairwisePrimes
Parameters:
int
Returns:
int
Method signature:
int pairwisePrimes(int param0)
(be sure your method is public)

Constraints

    Examples

      No public sample cases were explicitly marked for this problem in the original data.

      Back to all problems