A231470 Largest integer less than 10, coprime to n.
9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 5, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 5, 9, 9, 8, 9, 9, 7, 9, 9, 8, 9, 9, 7, 9, 9
Offset: 1
Examples
a(210)=1 because 210=2*3*5*7 is not coprime to any number n>1, n<10.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, order 210.
Programs
-
Mathematica
lgi[n_]:=Module[{k=9},While[!CoprimeQ[n,k],k--];k]; Array[lgi,100] (* Harvey P. Dale, Dec 26 2024 *)
-
PARI
a(n)=for(k=1,9,gcd(n,10-k)==1&&return(10-k))
-
PARI
a(n)=n=n%210; (2456570291879305656378327950088507572292988734220585220471023291179171177166614 45448973642646595615830994341498146323777941833948520102560885856758200689935551 394284409822886865709103348710416026442401 \ 9^n)%9+1 \\ Charles R Greathouse IV, Oct 13 2022
Comments