login
A370482
Characteristic function of primes plus characteristic function of even numbers.
1
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, 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, 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
OFFSET
0,3
COMMENTS
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.
LINKS
FORMULA
a(n) = A010051(n) + A059841(n).
EXAMPLE
1 is neither prime nor even so a(1) = 0 + 0 = 0.
2 is both a prime and even so a(2) = 1 + 1 = 2.
3 is a prime but odd so a(3) = 1 + 0 = 1.
4 is not a prime but even so a(4) = 0 + 1 = 1.
MATHEMATICA
a[n_] := Boole[PrimeQ[n]] + Boole[EvenQ[n]]; Array[a, 100, 0] (* Amiram Eldar, Mar 31 2024 *)
PROG
(Python)
from sympy import isprime
def A370482(n): return isprime(n)+(n&1^1) # Chai Wah Wu, Apr 25 2024
(PARI) A370482(n) = (!(n%2) + isprime(n)); \\ Antti Karttunen, Jan 17 2025
CROSSREFS
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
Sequence in context: A037910 A162781 A056975 * A294079 A375669 A114117
KEYWORD
nonn,easy
AUTHOR
Jens Ahlström, Mar 31 2024
STATUS
approved