Secret Primary Factor

View as PDF

Submit solution


Points: 1
Time limit: 0.05s
Memory limit: 12M

Author:
Problem type
Allowed languages
Python

Description

Lee once saw a way to calculate secret number, and he's curious about how he can mutate the problem, so he came up with an idea, calculate the secret number's secret factor.

Lee's Secret Primary Factor's calculating steps are:

Given a interger input N

  1. combine N's odd and even digits into 2 numbers
  2. subtract 2 numbers and take it's absolute
  3. calculate the largest primary factor
  4. the result is what Lee wanted
For example:

N = 48422

Odd Even
442 82

|Odd-Even| = 360 = 2 \times 2 \times 2 \times 3 \times 3 \times 5 = 2^3 \times 3^2 \times 5

Therefore, the Secret Primary Factor of 58422 is 5

Constraints

The digit count of input (N):

2 \le len(input) \le 144

The digit count of output:

1 \le len(output) \le 2

Sample IO

Input Output
48422 5
2244782037 7
1243293377632122 19

Comments

There are no comments at the moment.