login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A268340
Characteristic function of the prime powers p^k, k >= 2.
6
0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
OFFSET
1
COMMENTS
Mobius transform of A046660. - Isaac Saffold, Dec 14 2017
FORMULA
a(n) = Sum_{d|n} (mobius(n/d)*(bigomega(d) - omega(d))) - Isaac Saffold, Dec 14 2017
MAPLE
N:= 1000: # to get a(1)...a(N)
V:= Vector(N):
for p in select(isprime, [2, seq(i, i=3..isqrt(N), 2)]) do
for k from 2 to floor(log[p](N)) do
V[p^k]:= 1
od od:
convert(V, list); # Robert Israel, Dec 14 2017
MATHEMATICA
Table[Boole@ And[PrimePowerQ@ n, ! PrimeQ@ n], {n, 105}] (* Michael De Vlieger, Feb 02 2016 *)
Table[If[!PrimeQ[n]&&PrimePowerQ[n], 1, 0], {n, 130}] (* Harvey P. Dale, Jan 20 2019 *)
PROG
(PARI) a(n)=my(b); ispower(n, , &b)&&isprime(b)
(PARI) first(n) = my(res = vector(n)); forprime(p = 2, sqrtint(n), for(i = 2, logint(n, p), res[p^i] = 1)); res \\ David A. Corneth, Nov 03 2017
(Python)
from sympy import primefactors
def A268340(n): return int(len(s:=primefactors(n)) == 1 and n>s[0]) # Chai Wah Wu, Mar 31 2023
CROSSREFS
Characteristic function of A246547.
Sequence in context: A284508 A347519 A160351 * A355453 A336356 A319988
KEYWORD
nonn,easy
AUTHOR
Jeppe Stig Nielsen, Feb 02 2016
EXTENSIONS
More terms from Antti Karttunen, Nov 03 2017
STATUS
approved