cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A165971 The n-th odd nonprime minus the n-th even nonprime.

This page as a plain text file.
%I A165971 #10 Aug 01 2024 14:26:02
%S A165971 1,5,9,13,15,15,19,19,21,25,27,27,29,29,33,33,35,39,39,41,43,43,45,45,
%T A165971 45,47,51,55,57,57,57,57,57,57,59,61,61,65,65,65,65,69,69,71,71,73,75,
%U A165971 75,77,77,81,81,81,81,85,89,89,89,89,89,91,91,91,91,91,93,97,99,99,103
%N A165971 The n-th odd nonprime minus the n-th even nonprime.
%H A165971 G. C. Greubel, <a href="/A165971/b165971.txt">Table of n, a(n) for n = 1..5000</a>
%F A165971 a(n) = A014076(n) - A163300(n).
%F A165971 Equals: {1} U A160522.
%e A165971 a(1) = 1-0 = 1. a(2) = 9-4 = 5. a(3) = 15-6 = 9.
%t A165971 A014076 := Select[Range@500, ! PrimeQ@# && OddQ@# &]; A163300 := Drop[Range[0, 500, 2], {2}]; Table[(-A163300[[n]] + A014076[[n]]), {n, 1, 50}] (* _G. C. Greubel_, Sep 17 2017 *)
%o A165971 (Python)
%o A165971 from sympy import primepi
%o A165971 def A165971(n):
%o A165971     if n == 1: return 1
%o A165971     m, k = n-1, primepi(n) + n - 1 + (n>>1)
%o A165971     while m != k:
%o A165971         m, k = k, primepi(k) + n - 1 + (k>>1)
%o A165971     return m-(n<<1) # _Chai Wah Wu_, Aug 01 2024
%Y A165971 Cf. A014076, A163300, A141468, A160522.
%K A165971 nonn,less
%O A165971 1,2
%A A165971 _Juri-Stepan Gerasimov_, Oct 02 2009
%E A165971 77 duplicated by _R. J. Mathar_, Oct 10 2009