The set of primes ≥ 5 ⊂ {6n+1: n∈ω} ∪ {6n-1: n∈ω} and so f() has an infinite number of ‘integer’ points including all of those where the function values are primes ≥ 5.

E.g.

n=1 and so f(8)=7 and f(4)=5

n=2 and so f(28)=13 and f(20)=11

n=3 and so f(60)=19 and f(48)=17

etc.

Clearly some of these integer points have composite function values.

E.g when n=4 then f(104)=25=5² and when n=8, f(400)=49=7² .

The case (6n+1)

If we let g(n)=2n(3n+1), n∈ω, then f(g(n))=6n+1. Also, it is easily shown that

f(g(g(n)))=fogog(n)=fg²(n)=(6n+1)² , i.e. composite.

Again, fg³(n)=((6n+1)²)²=(6n+1)^4. This extends to fg^(a+1)(n)=(6n+1)^(2^a).

The case (6n-1)

If we let g(n)=2n(3n-1), n∈ω, then f(g(n))=6n-1. Also, if h(n)=6n, n∈ω, then

f(g(h(n))) = (6n)² – 1 = (6n+1)(6n-1), i.e. composite.

If we let P(5) = {prime numbers ≥ 5}, A = {6n+1: n∈ω} and B = {6n-1: n∈ω} then it is easy to show that P(5) ⊂ A ∪ B, A ∩ B = Ø, and (A, .) is a commutative semi-group where . is ordinary multiplication. Also, if a∈A and b∈B then it is clear that a²∈A, b²∈A and ab∈B.

Since P(5) is infinite and P(5) ⊂ A ∪ B, then A and B cannot both contain at most a finite number of primes, so A, B, or both, must contain an infinite number of primes.

The set B contains an infinite number of primes.

If PB is the set of primes in B and CB is the set of composites in B then B=PB ∪ CB and obviously
PB ∩ CB = ∅.

Suppose now that PB is finite. We will try to show that this leads to a contradiction.

PB is finite means that PB can be listed as a set of n primes in order, i.e.

PB = {p1, p2, … , pn} where p1<p2 … <pn.

Now consider x = 6(∏i=1 .. n pi) – 1. Clearly x∈B. If x∈PB then x≤pn which is clearly not true and so x∈CB .

If all of the primes dividing x belong to A, then x∈A which is not possible since A ∩ B = Ø, and so at least one prime dividing x belongs to B. Since x = 6(∏i=1 .. n pi) – 1 that means some prime in B divides into 1, i.e. impossible.