OFFSET
0,1
COMMENTS
A109002 and A178500 give record values and where they occur: A109002(n+1)=a(A178500(n)) and a(m)<A109002(n+1) for m<A178500(n). - Reinhard Zumkeller, May 28 2010
If n is divisible by 3, so is a(n). The same goes for 9. - Alonso del Arte, Dec 01 2011
For n > 0, a(n-1) consists of the A055642(n) least significant digits of the 10-adic integer -n. - Stefano Spezia, Jan 21 2021
REFERENCES
Kjartan Poskitt, Murderous Maths: Numbers, The Key to the Universe, Scholastic Ltd, 2002. See p 159.
LINKS
Indranil Ghosh, Table of n, a(n) for n = 0..25000 (terms 0..1000 from Harry J. Smith)
FORMULA
a(n) = if n<10 then 9 - n else 10*a([n/10]) + 9 - n mod 10. - Reinhard Zumkeller, Jan 20 2010
a(n) <= 9n - 1. - Charles R Greathouse IV, Nov 15 2022
EXAMPLE
a(7) = 2 = 10 - 1 -7. a(123) = 1000 -1 -123 = 876.
MAPLE
MATHEMATICA
nineComplement[n_] := FromDigits[Table[9, {Length[IntegerDigits[n]]}] - IntegerDigits[n]]; Table[nineComplement[n], {n, 0, 71}] (* Alonso del Arte, Nov 30 2011 *)
PROG
(PARI) g(n) = for(x=0, n, ln=length(Str(x)); y=10^ln-1 - x; print1(y", ")) \\ Cino Hilliard, Mar 11 2006
(PARI) for (n=0, 1000, ln=length(Str(n)); write("b061601.txt", n, " ", 10^ln - 1 - n) ) \\ Harry J. Smith, Jul 25 2009
(PARI) A061601(n)=my(e=length(Str(n))); 10^e-1 - n; \\ Joerg Arndt, Aug 28 2013
(Haskell)
a061601 n = if n <= 9 then 9 - n else 10 * ad n' + 9 - d
where (n', d) = divMod n 10
-- Reinhard Zumkeller, Feb 21 2014, Oct 04 2011
(Python)
def A061601(n):
return 10**len(str(n))-1-n # Indranil Ghosh, Jan 30 2017
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Amarnath Murthy, May 19 2001
EXTENSIONS
Corrected and extended by Matthew Conroy, Jan 19 2002
STATUS
approved