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.

A105661 a(n)=1 if n is a prime, 2 if n is an even semiprime, otherwise 0.

Original entry on oeis.org

0, 1, 1, 2, 1, 2, 1, 0, 0, 2, 1, 0, 1, 2, 0, 0, 1, 0, 1, 0, 0, 2, 1, 0, 0, 2, 0, 0, 1, 0, 1, 0, 0, 2, 0, 0, 1, 2, 0, 0, 1, 0, 1, 0, 0, 2, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 1, 0, 1, 2, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 2, 0, 0, 0, 0, 1, 0, 0, 2, 1, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0
Offset: 1

Views

Author

Giovanni Teofilatto, May 04 2005

Keywords

Examples

			a(3) = 1 because n = 3 is a prime;
a(4) = 2 because n = 4 = 2*2 is an even semiprime;
a(8) = 0 because n = 8 is neither prime nor an even semiprime.
a(15) = 0 because n = 15 = 3*5 is an odd semiprime.
		

Crossrefs

Programs

  • Mathematica
    Table[Which[PrimeQ[n],1,EvenQ[n]&&PrimeOmega[n]==2,2,True,0],{n,120}] (* Harvey P. Dale, Jul 05 2021 *)
  • PARI
    for(n=1,105,if((n%2==0)&&(bigomega(n)==2),r=2,r=isprime(n));print1(r,","))
    
  • Scheme
    (define (A105661 n) (cond ((= 1 (A001222 n)) 1) ((and (even? n) (= 2 (A001222 n))) 2) (else 0))) ;; Antti Karttunen, Jul 26 2017

Extensions

Corrected and extended by Rick L. Shepherd, May 17 2005