TopcoderArchiveVisit Topcoder
SRM22 Dec 2013
SRM 617

SilverbachConjecture

Problem statement, definition, constraints, and public examples.

Problem Statement

In this problem, some test cases have more than one correct output. We are using a special checker to verify that the output of your program is correct.

A positive integer x is called composite if there are positive integers y > 1 and z > 1 such that x = yz. In other words, a composite positive integer has a positive integer divisor other than 1 and itself. For example, 48 is composite because 48 = 4*12. The smallest few composite integers are 4, 6, 8, 9, and 10.

You are given an int n. Return a int[] with two elements. Both elements of the returned int[] must be positive composite integers, and their sum must be n.

For the given constraints on n at least one such pair always exists. Note that if there are many such pairs, your solution can return any one of them.

Definition

Class:
SilverbachConjecture
Method:
solve
Parameters:
int
Returns:
int[]
Method signature:
int[] solve(int n)
(be sure your method is public)

Constraints

  • n will be between 20 and 2000, inclusive.

Examples

  1. 20
    Returns: {8, 12 }
    For n=20 there are seven correct answers: {4,16}, {6,14}, {8,12}, {10,10}, {12,8}, {14,6}, and {16,4}. Your program must return one of these seven answers.
  2. 30
    Returns: {15, 15 }
    You may return two identical numbers.
  3. 999
    Returns: {699, 300 }
  4. 45
    Returns: {15, 30 }
Back to all problems