login
Maximum of { k>0 | k<n and k is strongly prime to n }, or zero if this set is empty.
2

%I #12 Jan 27 2021 05:31:14

%S 0,1,0,0,0,3,0,5,5,7,7,9,7,11,11,13,13,15,13,17,17,19,19,21,19,23,23,

%T 25,25,27,23,29,29,31,31,33,31,35,35,37,37,39,37,41,41,43,43,45,43,47,

%U 47,49,49,51,49,53,53,55,55,57,53,59,59,61,61,63,61,65,65,67,67,69

%N Maximum of { k>0 | k<n and k is strongly prime to n }, or zero if this set is empty.

%C k is strongly prime to n iff k is relatively prime to n and k does not divide n-1.

%C Editor's note: It seems that 1 is strongly prime to 1 by convention.

%H Peter Luschny, <a href="http://www.oeis.org/wiki/User:Peter_Luschny/StrongCoprimality">Strong coprimality</a>.

%e a(11) = max{3, 4, 6, 7, 8, 9} = 9.

%p with(numtheory):

%p Primes := n -> select(k->isprime(k),{$1..n}):

%p StrongCoprimes := n -> select(k->igcd(k,n)=1,{$1..n}) minus divisors(n-1):

%p A181840 := proc(n) max(op(StrongCoprimes(n)));subs(infinity=0,%) end:

%t a[n_] := Max[ Select[ Range[n-1], CoprimeQ[#, n] && ! Divisible[n-1, #] &]] /. -Infinity -> 0; a[1] = 1; Table[a[n], {n, 0, 71}] (* _Jean-François Alcover_, Jun 27 2013 *)

%o (PARI) a(n)={ forstep(k=n-2,2,-1,gcd(k,n)==1 & (n-1)%k & return(k)); n==1 } \\ _M. F. Hasler_, Nov 17 2010

%Y Cf. A181830, A181839.

%K nonn

%O 0,6

%A _Peter Luschny_, Nov 17 2010