6 kyu

Compact polynomial

38 of 68Glushatov

Description:

Task

Consider an n-th-degree polynomial with integer coefficients:

xn+a1xn1+...+an1x+anx^n + a_1*x^{n-1} + ... + a_{n-1}*x + a_n

Let's call this polynomial compact if it has only integer roots which are non-repeating and non-zero and an|a_n| is minimal.

Your task is to find the maximum and minimum values of a1a_1 in the compact polynomial.

You're given the degree of the polynomial: nn (1n1018)(1≤n≤10^{18}).

Return a tuple (min, max).

Note

Test feedback is minimal as part of this puzzle.

Examples

first_coefficient(1) => (-1, 1)

Fundamentals
Puzzles
Mathematics

Similar Kata:

Stats:

CreatedJan 9, 2022
PublishedJan 9, 2022
Warriors Trained502
Total Skips76
Total Code Submissions967
Total Times Completed68
Python Completions38
C++ Completions19
C Completions17
JavaScript Completions19
Total Stars15
% of votes with a positive feedback rating86% of 32
Total "Very Satisfied" Votes25
Total "Somewhat Satisfied" Votes5
Total "Not Satisfied" Votes2
Total Rank Assessments17
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Glushatov Avatar
  • hobovsky Avatar
  • dfhwze Avatar
  • Yushi.py Avatar
Ad