A231471 Largest integer less than 11 and coprime to n.
10, 9, 10, 9, 9, 7, 10, 9, 10, 9, 10, 7, 10, 9, 8, 9, 10, 7, 10, 9, 10, 9, 10, 7, 9, 9, 10, 9, 10, 7, 10, 9, 10, 9, 9, 7, 10, 9, 10, 9, 10, 5, 10, 9, 8, 9, 10, 7, 10, 9, 10, 9, 10, 7, 9, 9, 10, 9, 10, 7, 10, 9, 10, 9, 9, 7, 10, 9, 10, 9, 10, 7, 10, 9, 8, 9, 10, 7, 10, 9
Offset: 1
Examples
a(1) = 10 because 10 is the largest integer less than 11 and it's coprime to 1. a(2) = 9 because 10 is not coprime to 2 but 9 is. a(6) = 7 because 10, 9 and 8 are not coprime to 6 = 2*3. a(210) = 1 because 210 = 2*3*5*7 is not coprime to any number n > 1, n < 11.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
f:= proc(n) local k; for k from 10 by -1 do if igcd(n,k)=1 then return k fi od end proc: map(f, [$1..210]); # Robert Israel, Jul 03 2020
-
Mathematica
Table[m = 10; While[GCD[m, n] != 1, m--]; m, {n, 75}] (* Alonso del Arte, Nov 09 2013 *)
-
PARI
a(n,m=11)=for(k=1,m,gcd(n,m-k)==1&&return(m-k))
Comments