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.
%I A022797 #60 Mar 06 2024 04:45:52 %S A022797 3,7,11,15,20,23,29,33,38,45,49,57,62,65,71,78,85,88,95,101,105,112, %T A022797 117,124,133,139,142,147,151,157,172,177,185,188,199,202,209,217,222, %U A022797 229,236,239,251,255,260,263,276,289,295,298,303,311,315,326 %N A022797 a(n) = n-th prime + n-th nonprime. %H A022797 Harvey P. Dale, <a href="/A022797/b022797.txt">Table of n, a(n) for n = 1..1000</a> %F A022797 a(n) = A000040(n) + A018252(n). - _Jaroslav Krizek_, Nov 18 2009 %e A022797 The first four primes are 2, 3, 5, 7 and the first four nonprimes are 1, 4, 6, 8. Hence a(1) = 2 + 1 = 3, a(2) = 3 + 4 = 7, a(3) = 5 + 6 = 11 and a(4) = 7 + 8 = 15. %t A022797 ppnp[terms_] := Module[{prs = Prime[Range[terms]], nprs, lenprs}, nprs = Complement[Range[Prime[terms]], prs]; lenprs = Length[prs]; Total /@ Thread[{prs, Take[nprs, lenprs]}]]; ppnp[60] (* _Harvey P. Dale_, Nov 29 2011 *) %o A022797 (Python) %o A022797 from sympy import prime, composite %o A022797 def A022797(n): return 3 if n == 1 else prime(n)+composite(n-1) # _Chai Wah Wu_, Aug 30 2021 %o A022797 (PARI) a(n) = my(nonprime(i)=my(p=1, q=i); while(p!=q, p=q; q=i+primepi(p)); q); prime(n) + nonprime(n); \\ _Ruud H.G. van Tol_, Feb 16 2024 %o A022797 (PARI) alist(N) = my(r=primes(N), q=3); r[1]+=1; for(n=2, N, if(isprime(q++),q++); r[n]+=q); r; \\ _Ruud H.G. van Tol_, Feb 16 2024 %Y A022797 Cf. A000040, A018252. %Y A022797 Cf. A064799 (with composite numbers instead of nonprimes). %K A022797 nonn,easy,nice %O A022797 1,1 %A A022797 _Clark Kimberling_