NOTE: This problem statement contains subscripts and superscripts which may not display properly for plugin users.
Write a program to generate a list of random 3D points in space, and then compute the distance between the pair of closest points. Also determine how many distinct pairs of points are this exact distance apart.
Generate the random points using the following pseudo-random number generator. Starting with a given seed0:
seedi+1 = (seedi * 16807) mod (231-1)
The ith random number (starting at i = 1) is given by:
randi = (seedi mod (2 * range)) - range
The 3D points are triples of 3 successive random numbers:
(rand1, rand2, rand3) (rand4, rand5, rand6) (rand7, rand8, rand9) (rand10, rand11, rand12) etc...
You will be given an initial seed, the range, and N (the number of points). The random numbers produced by the generator will be between -range and range-1, inclusive. Return a int with two elements: the first element should be the square of the distance between the pair of closest points, and the second element should be the number of distinct pairs of points that have this same squared distance.
NOTE: Be sure to use 64-bit arithmetic for the multiply and mod in the random-number generator, and for computing squared distances.
|-||Ignore any duplicate points. (See example 1.)|
|-||There will be at least 2 unique points.|
|-||N will be between 2 and 150000, inclusive.|
|-||range will be between 1 and 1000000, inclusive.|
|-||seed will be between 1 and 1000, inclusive.|
|-||The square of the distance of the closest pair of points will be less than 1000000000.|