NDIVPHI - N DIV PHI_N

Given an integer N <= 1040 find the smallest m <= N such that m/phi(m) is maximum.

Input

N1
N2
.
.
.
N20

Output

m1
m2
.
.
.
m20

Example

Input:
10
.
.
Output:
6
.
.

Added by:Frank Rafael Arteaga
Date:2010-04-22
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC PERL6 SQLITE VB.NET
Resource:ProjectEuler

hide comments
2020-03-14 07:25:00
there are 20 inputs
2019-03-13 03:25:03
i am comparing numbers after each successive multiplication, but the given order is of 10^40, which makes it impossible for me to compare, what is the workaround for that?

Last edit: 2019-03-13 03:29:36
2018-08-26 16:46:07
the input format is not specified correctly

Last edit: 2018-09-01 16:02:07
2018-01-04 11:49:38
Finally AC !
silly mistake.Used < intsead of <=
2017-06-25 11:49:47
cakewalk with python..
2016-06-26 13:29:49
Awesome !!
Just Take a deep breathe n think a strategy to procede
Its cousin can be found here: https://projecteuler.net/problem=70
2014-09-28 18:31:20 Ayush Agarwal
python is awesome
2014-09-24 05:40:08 Bharath Reddy
Take care of the case when n = 1
2013-01-26 00:45:13 saket diwakar
python is awesome....:)
2012-06-03 13:10:03 Samuel Shen
i have checked everything...its giving me correct answers for all n.....and time limit is also within 1 sec....even then TLE.....anyone plz help....
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.