A379771 Number of k <= n that are neither squarefree nor prime powers.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 19, 20, 20
Offset: 1
Examples
a(n) = 0 for n = 1..11, since 12 is the smallest number that is neither squarefree nor a prime power. a(n) = 1 for n = 12..17, since the only k <= n that is neither squarefree nor a prime power is 12. a(n) = 2 for n = 18..19, since 12 and 18 are the only numbers in A126706 that do not exceed n. a(n) = 3 for n = 20..23, since 12, 18, and 20 are the only numbers in A126706 that do not exceed n, etc.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
- Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^20.
Programs
-
Mathematica
Array[Count[Range[#], _?(Nor[SquareFreeQ[#], PrimePowerQ[#]] &)] &, 120]
-
PARI
a(n) = sum(k=1, n, !issquarefree(k) && !isprimepower(k)); \\ Michel Marcus, Jan 11 2025
-
Python
from math import isqrt from sympy import mobius, integer_nthroot, primepi def A379771(n): return -sum(mobius(k)*(n//k**2) for k in range(2,isqrt(n)+1))-sum(primepi(integer_nthroot(n,k)[0]) for k in range(2,n.bit_length())) # Chai Wah Wu, Jan 22 2025
Comments