login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A109942
Largest k-digit number coprime to n, where k is the number of digits in n.
1
9, 9, 8, 9, 9, 7, 9, 9, 8, 99, 98, 97, 99, 99, 98, 99, 99, 97, 99, 99, 97, 97, 99, 97, 99, 99, 98, 99, 99, 97, 99, 99, 98, 99, 99, 97, 99, 99, 98, 99, 99, 97, 99, 97, 98, 99, 99, 97, 99, 99, 98, 99, 99, 97, 98, 99, 98, 99, 99, 97, 99, 99, 97, 99, 99, 97, 99, 99, 98, 99, 99, 97
OFFSET
1,1
LINKS
FORMULA
a(n) >= n+1 unless n is in A002283, in which case a(n)=n-1. - Robert Israel, Jan 30 2017
MAPLE
f:= proc(n) local k;
for k from 10^(1+ilog10(n))-1 by -1 do
if igcd(n, k) = 1 then return k fi
od
end proc:
map(f, [$1..100]); # Robert Israel, Jan 30 2017
CROSSREFS
Sequence in context: A050812 A139345 A231470 * A339745 A346929 A346927
KEYWORD
base,easy,nonn
AUTHOR
Amarnath Murthy, Jul 19 2005
EXTENSIONS
More terms from David Wasserman, Jul 19 2005
STATUS
approved