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.

A073898 a(1) = 1; for n>1, a(n) = smallest even or odd number not occurring earlier accordingly as n is prime or composite.

This page as a plain text file.
%I A073898 #18 Nov 11 2015 11:20:09
%S A073898 1,2,4,3,6,5,8,7,9,11,10,13,12,15,17,19,14,21,16,23,25,27,18,29,31,33,
%T A073898 35,37,20,39,22,41,43,45,47,49,24,51,53,55,26,57,28,59,61,63,30,65,67,
%U A073898 69,71,73,32,75,77,79,81,83,34,85,36,87,89,91,93,95,38,97,99,101,40,103
%N A073898 a(1) = 1; for n>1, a(n) = smallest even or odd number not occurring earlier accordingly as n is prime or composite.
%C A073898 Inverse of A073846. - _Chayim Lowen_, Oct 28 2015
%F A073898 a(n) = (4*pi(n)-2*n-1)*(pi(n)-pi(n-1))  + 2*(n - pi(n-1)) - 1, where pi = A000720. - _Robert Israel_, Oct 28 2015
%p A073898 A073898 :=proc(nmax) local a,n,k; a := [1] ; while nops(a) < nmax do n := nops(a)+1 ; if isprime(n) then k :=2; else k :=1; fi ; while k in a do k := k+2 ; od ; a := [op(a),k] ; od ; RETURN(a) ; end: op(A073898(80)) ; # _R. J. Mathar_, Jun 27 2007
%t A073898 Table[(4 PrimePi[n] - 2 n - 1)*(PrimePi[n] - PrimePi[n - 1]) + 2 (n - PrimePi[n - 1]) - 1, {n, 72}] (* _Michael De Vlieger_, Nov 11 2015 *)
%o A073898 (PARI) vector(100, n, (4*primepi(n)-2*n-1)*(primepi(n)-primepi(n-1))+2*(n-primepi(n-1))-1) \\ _Altug Alkan_, Oct 29 2015
%Y A073898 Cf. A000720, A073897.
%Y A073898 Cf. A073846.
%K A073898 easy,nonn
%O A073898 1,2
%A A073898 _Amarnath Murthy_, Aug 18 2002
%E A073898 Corrected and extended by _R. J. Mathar_, Jun 27 2007