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.

A165955 n-th odd nonprime plus n-th even nonprime.

This page as a plain text file.
%I A165955 #13 Aug 02 2024 02:01:31
%S A165955 1,13,21,29,35,39,47,51,57,65,71,75,81,85,93,97,103,111,115,121,127,
%T A165955 131,137,141,145,151,159,167,173,177,181,185,189,193,199,205,209,217,
%U A165955 221,225,229,237,241,247,251,257,263,267,273,277,285,289,293,297,305,313,317,321,325
%N A165955 n-th odd nonprime plus n-th even nonprime.
%H A165955 G. C. Greubel, <a href="/A165955/b165955.txt">Table of n, a(n) for n = 1..5000</a>
%F A165955 a(n) = A014076(n) + A163300(n).
%e A165955 a(1) = 1+0 = 1. a(2) = 9+4 = 13. a(3) = 15+6 = 21.
%t A165955 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 *)
%t A165955 Module[{nn=300,np,enp,onp,len},np=Select[Range[0,nn],!PrimeQ[#]&];enp= Select[ np,EvenQ];onp=Select[np,OddQ];len=Min[Length[enp], Length[ onp]]; Total/@Thread[{Take[enp,len],Take[onp,len]}]] (* _Harvey P. Dale_, Nov 28 2018 *)
%o A165955 (Python)
%o A165955 from sympy import primepi
%o A165955 def A165955(n):
%o A165955     if n == 1: return 1
%o A165955     m, k = n-1, primepi(n) + n - 1 + (n>>1)
%o A165955     while m != k:
%o A165955         m, k = k, primepi(k) + n - 1 + (k>>1)
%o A165955     return m+(n<<1) # _Chai Wah Wu_, Aug 01 2024
%Y A165955 Cf. A014076, A141468, A163300.
%K A165955 nonn
%O A165955 1,2
%A A165955 _Juri-Stepan Gerasimov_, Oct 01 2009
%E A165955 Entries checked by _R. J. Mathar_, Oct 10 2009