login
Positive integers which are neither squarefree integers nor prime powers.
120

%I #28 Aug 15 2024 02:02:21

%S 12,18,20,24,28,36,40,44,45,48,50,52,54,56,60,63,68,72,75,76,80,84,88,

%T 90,92,96,98,99,100,104,108,112,116,117,120,124,126,132,135,136,140,

%U 144,147,148,150,152,153,156,160,162,164,168,171,172,175,176,180,184,188

%N Positive integers which are neither squarefree integers nor prime powers.

%H Michael De Vlieger, <a href="/A126706/b126706.txt">Table of n, a(n) for n = 1..10000</a>

%e 45 is in the sequence because 45=3^2*5, i.e., neither squarefree nor a prime power.

%p with(numtheory): a:=proc(n) if mobius(n)=0 and nops(factorset(n))>1 then n else fi end: seq(a(n), n=1..230); # _Emeric Deutsch_, Feb 17 2007

%t Select[Range[200], Max @@ Last /@ FactorInteger[ # ] >1 && Length[FactorInteger[ # ]] > 1 &] (* _Ray Chandler_, Feb 17 2007 *)

%t Select[Range[200],!SquareFreeQ[#]&&!PrimePowerQ[#]&] (* _Harvey P. Dale_, Aug 05 2023 *)

%o (PARI) isok(k) = !issquarefree(k) && !isprimepower(k); \\ _Michel Marcus_, Nov 02 2022

%o (Python)

%o from math import isqrt

%o from sympy import primepi, integer_nthroot, mobius

%o def A126706(n):

%o def f(x): return int(n+sum(primepi(integer_nthroot(x,k)[0]) for k in range(2,x.bit_length()))+sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1)))

%o m, k = n, f(n)

%o while m != k:

%o m, k = k, f(k)

%o return m # _Chai Wah Wu_, Aug 15 2024

%Y Cf. A005117, A000961, A059404.

%K nonn

%O 1,1

%A _Leroy Quet_, Feb 11 2007

%E Extended by _Emeric Deutsch_ and _Ray Chandler_, Feb 17 2007