# Getting the terms containing rational exponents to zero in an expression

I have some expressions. For example:

 expr=f[x]^(7/3) + 2*f[x]^(2 + 2/(3*n)) + f[x]


where n is an integer.

I want to get the terms containing rational exponents to zero. For the example above; I want to reach f[x].

My try is

expr /. f[x]^Rational[_, _] -> 0


or

Assuming[expr /. f[x]^Rational[_, _] -> 0, n \[Element] Integers]


PossibleIntegerQ[a_, n] :=
Resolve[Exists[n, Element[n, Integers], Element[a, Integers]]]

expr /. f[x]^a_. /; ! PossibleIntegerQ[a, n] -> 0
(*    f[x]    *)


The combination of Resolve and Exists determines for each term $$f(x)^a$$ whether there exists an integer $$n$$ that makes the exponent $$a(n)$$ integer-valued (i.e., whether or not $$a$$ is "possibly an integer"). If not, the term is set to zero.

Rational numbers are atomic (i.e., cannot be divided into subexpressions)

AtomQ[3/4]

(* True *)


Consequently, rationals have no parts (although Numerator and Denominator act as if rationals had parts), and the pattern Rational[_, _] never occurs

expr = f[x]^(7/3) + 2*f[x]^(2 + 2/(3*n)) + f[x];

expr /. f[x]^(_?(! FreeQ[#, Rational] &)) :> 0

(* f[x] *)