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.

A370482 Characteristic function of primes plus characteristic function of even numbers.

This page as a plain text file.
%I A370482 #22 Jan 17 2025 09:29:34
%S A370482 1,0,2,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,0,
%T A370482 1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,1,1,0,1,0,1,1,
%U A370482 1,0,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1
%N A370482 Characteristic function of primes plus characteristic function of even numbers.
%C A370482 There is only one 2 in the sequence, so if the value 2 is blanked out, a riddle is created that demands some out-of-the-box thinking.
%H A370482 Antti Karttunen, <a href="/A370482/b370482.txt">Table of n, a(n) for n = 0..100000</a>
%F A370482 a(n) = A010051(n) + A059841(n).
%e A370482 1 is neither prime nor even so a(1) = 0 + 0 = 0.
%e A370482 2 is both a prime and even so a(2) = 1 + 1 = 2.
%e A370482 3 is a prime but odd so a(3) = 1 + 0 = 1.
%e A370482 4 is not a prime but even so a(4) = 0 + 1 = 1.
%t A370482 a[n_] := Boole[PrimeQ[n]] + Boole[EvenQ[n]]; Array[a, 100, 0] (* _Amiram Eldar_, Mar 31 2024 *)
%o A370482 (Python)
%o A370482 from sympy import isprime
%o A370482 def A370482(n): return isprime(n)+(n&1^1) # _Chai Wah Wu_, Apr 25 2024
%o A370482 (PARI) A370482(n) = (!(n%2) + isprime(n)); \\ _Antti Karttunen_, Jan 17 2025
%Y A370482 Cf. A010051, A059841.
%Y A370482 If a(2) were 1 instead of 2, then this would the characteristic function of {0} U A106092, whose complement A014076 gives the positions of 0's. - _Antti Karttunen_, Jan 17 2025
%K A370482 nonn,easy
%O A370482 0,3
%A A370482 _Jens Ahlström_, Mar 31 2024