OFFSET

1,2

COMMENTS

Smallest k such there are exactly n integers among (1,2,3,4,...,k) relatively prime to n. - Benoit Cloitre, Jun 09 2002

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..10000

FORMULA

a(p) = p+1, p is a prime, a(2^n)= 2^(n+1) - 1. What are a(pq), a(pqr), a(n) where n the product of first k primes? - Amarnath Murthy, Nov 14 2002

Let the remainder when n is divided by phi(n) be r and the quotient be k. I.e., n = k*phi(n) + r. Then k*n + r < a(n) < (k+1)*n. If the phi(n) numbers be arranged in increasing order and if the r-th number is m then a(n) = k*n + m. - Amarnath Murthy, Jul 07 2002

EXAMPLE

6 is relatively prime to 1, 5, 7, 11, 13, 17,..., the 6th term of this sequence being 17, so a(6) = 17.

MATHEMATICA

f[n_] := Block[{c = 0, k = 1}, While[c < n, If[CoprimeQ[k, n], c++ ]; k++ ]; k - 1]; Array[f, 66] (* Robert G. Wilson v, Sep 10 2008 *)

Table[Position[CoprimeQ[Range[300], n], True, 1, n][[-1]], {n, 70}]//Flatten (* Harvey P. Dale, Aug 14 2020 *)

PROG

(PARI) for(n=1, 100, s=1; while(sum(i=1, s, if(gcd(n, i)-1, 0, 1))<n, s++); print1(s, ", "))

(Haskell)

a069213 = last . a077581_row -- Reinhard Zumkeller, Sep 26 2014

CROSSREFS

KEYWORD

nonn

AUTHOR

Leroy Quet, Apr 11 2002

STATUS

approved