login
A228628
9's complement of prime(n).
3
7, 6, 4, 2, 88, 86, 82, 80, 76, 70, 68, 62, 58, 56, 52, 46, 40, 38, 32, 28, 26, 20, 16, 10, 2, 898, 896, 892, 890, 886, 872, 868, 862, 860, 850, 848, 842, 836, 832, 826, 820, 818, 808, 806, 802, 800, 788, 776, 772, 770, 766, 760, 758, 748, 742, 736, 730, 728
OFFSET
1,1
COMMENTS
a(n) = 10^k - 1 - prime(n) where k is the number of digits in prime(n). If d is d digit in prime(n) replace it with 9 - d.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A061601(A000040(n)). - Charles R Greathouse IV, Aug 29 2013
a(n) = A160668(n) - 1. Alois P. Heinz, Dec 08 2017
EXAMPLE
a(6) = 86 because prime(6) = 13 and 9 - 1 = 8, 9 - 6 = 3.
MAPLE
a:= n-> (p-> 10^length(p)-p-1)(ithprime(n)):
seq(a(n), n=1..100); # Alois P. Heinz, Dec 08 2017
MATHEMATICA
nineComplement[n_] := FromDigits[Table[9, {Length[IntegerDigits[Prime[n]]]}] - IntegerDigits[Prime[n]]]; Table[nineComplement[n], {n, 1, 71}]
PROG
(PARI) a(n)=my(p=prime(n)); 10^#Str(p)-p-1 \\ Charles R Greathouse IV, Aug 29 2013
(Python)
from sympy import primerange
def nc(n): return 10**len(str(n)) - 1 - n
def auptop(limit): return [nc(p) for p in primerange(1, limit+1)]
print(auptop(271)) # Michael S. Branicky, Jul 06 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Michel Lagneau, Aug 28 2013
STATUS
approved