Separating merged array of arithmetic and geometric series [closed]
- by user1814037
Possible Duplicate:
Separating merged array of arithmetic and geometric series
My friend asked me an interseting question.
Given an array of positive integers in increasing order. Seperate them in two series, an arithmetic sequence and geometric sequence. The given array is such that a solution do exist.
The union of numbers of the two sequence must be the given array.
Both series can have common elements i.e. series need not to be disjoint.
The ratio of the geometric series can be fractional.
Example:
Given series : 2,4,6,8,10,12,25
AP: 2,4,6,8,10,12
GP: 4,10,25
I tried taking few examples but could not reach a general way. Even tried some graph implementation by introducing edges if they follow a particular sequence but could not reach solution.