Quick Overview

This question evaluates combinatorics and probability skills, specifically counting combinations and recognizing arithmetic progression structure among distinct integers, and belongs to the Coding & Algorithms category for Data Scientist roles.

Compute probability of random arithmetic progression triple

Company: Mavensecurities

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Take-home Project

You have the integers from 1 to 30 inclusive. You randomly choose 3 **distinct** numbers **without replacement**, and all 3-element subsets are equally likely. The order in which the numbers are drawn does **not** matter. What is the probability that these three numbers can be arranged to form an arithmetic progression (three distinct terms with a common difference)? Express your answer as a simplified fraction or decimal.

Quick Answer: This question evaluates combinatorics and probability skills, specifically counting combinations and recognizing arithmetic progression structure among distinct integers, and belongs to the Coding & Algorithms category for Data Scientist roles.

Return the simplified probability that three distinct numbers chosen from 1..30 form a three-term arithmetic progression.

Constraints

  • Return the reduced fraction as a string.

Examples

Input: ()

Expected Output: '21/406'

Explanation: There are 210 arithmetic-progression triples among C(30,3)=4060 subsets.

Hints

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.

Loading coding console...