login
a(n) = prime(n)-n, the number of nonprimes less than prime(n).
72

%I #57 Oct 12 2024 09:07:42

%S 1,1,2,3,6,7,10,11,14,19,20,25,28,29,32,37,42,43,48,51,52,57,60,65,72,

%T 75,76,79,80,83,96,99,104,105,114,115,120,125,128,133,138,139,148,149,

%U 152,153,164,175,178,179,182,187,188,197,202,207,212,213,218,221,222

%N a(n) = prime(n)-n, the number of nonprimes less than prime(n).

%C a(n) = A048864(A000040(n)) = number of nonprimes in RRS of n-th prime. - _Labos Elemer_, Oct 10 2002

%C A000040 - A014689 = A000027; in other words, the sequence of natural numbers subtracted from the prime sequence produces A014689. - _Enoch Haga_, May 25 2009

%C a(n) = A000040(n) - n. a(n) = inverse (frequency distribution) sequence of A073425(n), i.e., number of terms of sequence A073425(n) less than n. a(n) = A065890(n) + 1, for n >= 1. a(n) - 1 = A065890(n) = the number of composite numbers, i.e., (A002808) less than n-th primes, (i.e., < A000040(n)). - _Jaroslav Krizek_, Jun 27 2009

%C a(n) = A162177(n+1) + 1, for n >= 1. a(n) - 1 = A162177(n+1) = the number of composite numbers, i.e., (A002808) less than (n+1)-th number of set {1, primes}, (i.e., < A008578(n+1)). - _Jaroslav Krizek_, Jun 28 2009

%C Conjecture: Each residue class contains infinitely many terms of this sequence. Similarly, for any integers m > 0 and r, we have prime(n) + n == r (mod m) for infinitely many positive integers n. - _Zhi-Wei Sun_, Nov 25 2013

%C First differences are A046933 = differences minus one between successive primes. - _Gus Wiseman_, Jan 18 2020

%H T. D. Noe, <a href="/A014689/b014689.txt">Table of n, a(n) for n=1..1000</a>

%F G.f: b(x) - x/((1-x)^2), where b(x) is the g.f. of A000040. - _Mario C. Enriquez_, Dec 13 2016

%t Table[Prime[n] - n, {n, 61}] (* _Alonso del Arte_ *)

%o (PARI) a(n) = prime(n)-n \\ _Charles R Greathouse IV_, Sep 05 2011

%o (Haskell)

%o a014689 n = a000040 n - fromIntegral n

%o -- _Reinhard Zumkeller_, Apr 09 2012

%o (Magma) [NthPrime(n)-n: n in [1..70]]; // _Vincenzo Librandi_, Mar 20 2013

%o (Python)

%o from sympy import prime

%o def A014689(n): return prime(n)-n # _Chai Wah Wu_, Oct 11 2024

%Y Equals A014692 - 1.

%Y Cf. A000040, A033286, A158611, A002808, A065890.

%Y Cf. A232463, A232443.

%Y The sum of prime factors of n is A001414(n).

%Y The sum of prime indices of n is A056239(n).

%Y Their difference is A331415(n).

%Y Cf. A000720, A046933, A056239, A318995, A325036, A331380, A331416, A331418.

%K nonn,easy,nice

%O 1,3

%A _Mohammad K. Azarian_

%E More terms from Vasiliy Danilov (danilovv(AT)usa.net), July 1998

%E Correction for Aug 2009 change of offset in A158611 and A008578 by _Jaroslav Krizek_, Jan 27 2010