The way mathematics tends to work is you have some kind of abstract objects, then you have logical axioms related to these, and then it is about exploring connections between the fundamentals, making recourse to deductive logic.
So, basically it's an Ne+Ti thing.
Other functions can come into it too, but I think that works as an approximation. So the only types who are likely to do maths for its own sake are NTPs. If another type studies pure mathematics then chances are it will either be a) an atypical approach to a niche area within mathematics, or b) the mathematics will be secondary to some other field. Pure mathematics tends to be more abstract than other kinds of mathematics, so a strong intuition is more necessary.
Going through each of the types and their relation to mathematics:
NTPs: these are the natural mathematicians - both INTP and ENTP. They are going to dominate in pure mathematics, and be the main types you'll see at the upper end of the field. Their Ne allows them to brainstorm solutions to problems, see connections between different results and topics, and their Ti allows them to logically check that everything flows together correctly. With the Si+Fe, they're able to teach and do literature reviews, for example.
NTJs: Ne and Ti are the 5th and 6th functions for an NTJ, i.e. they're energising but unconscious. An NTJs therefore is unlikely to excel in mathematics for its own sake, but may be inspired by it. When the NTJ is studying a conceptual system, such as a physical or computational system, they will find that embedded in this is the manifestation of mathematical principles. So they are likely to pick up mathematical skills that will describe theoretically what they are trying to do practically. They still can excel in pure mathematics for its own sake, but it's much less likely than it is for an NTP. They're more likely to go for the applied side of it.
SFJs: Ne and Ti are the 3rd and 4th functions for the SFJ, so these are conscious but energetically taxing. An SFJ can do mathematics with effort, and the occassional SFJ may become enthused by the subject. They are likely to do mathematics as a result of it being embedded in some social institution. Chances are, many of them will handle mathematics fine at high school even if they don't particularly enjoy it, but studying mathematics at university, where the approach is more clearly NT, will likely be off-putting. They may apply maths to financial areas, and are perhaps likely to become maths teachers if they do pursue maths.
NFJs: Ne and Ti are respectively the 5th and 3rd functions for the INFJ, and the 6th and 4th functions for the ENFJ, so INFJ is much more likely than ENFJ to enter into pure mathematics. There will be a mixed approach to doing maths. They may excel in some areas but not others. They can do the logic, but they prefer the abstraction, and the INFJ will make a notable contribution to any problem which allows for detached contemplation - where one can turn the problem over in their mind to find a novel/insightful solution to a problem, rather than working it all out on paper. They will prefer the "intuitive approach" to mathematics, and suffer when it comes to rigour.
STJs: Ne and Ti are respectively the 3rd and 5th functions for the ESTJ, and the 4th and 6th functions for the ISTJ, so an ESTJ is more likely than an ISTJ to go into mathematics. This is a similar scenario to the NFJ, except reversed. They will likely have a hard time with the abstraction of pure mathematics, but excel in areas like calcuation. They are likely to study maths in the context of a discipline like finance/economics rather than for its own sake.
NFPs: Ne and Ti are respectively the 1st and 7th functions for the ENFP, and the 2nd and 8th functions for the INFP, so an ENFP is more likely to go into mathematics than an INFP. They are likely to enjoy areas where there is a focus on the abstract elements, and the need for logical rigour is downplayed. So there will be some areas of maths which appeal to them, but not most.
STPs: Ne and Ti are respectively the 7th and 1st functions for the ISTP, and the 8th and 2nd functions for the ESTP, so the ISTP is more likely to go into mathematics than an ESTP. They are likely to be very applied in their approach to mathematics - not in the sense of applied mathematics as a discipline, but in the sense that they will prefer to analyse real objects rather than abstract objects, so they're generally unlikely to enter into pure mathematics, but nonetheless may be regarded as fairly mathematically minded.
SFPs: Ne and Ti are the 7th and 8th functions for an SFP, so the SFP is the type most removed from mathematics. However, they can still incorporate maths into their life. See, an SFP will immerse themself in an area which is important to them, and from there may focus on some kind of conceptual system, or on the notion of conceiving a manner towards success, and this manner of conceptualisation may have a math behind it. One example is that the SFP may align their value system and experiences with a religious tradition, and study a conceptual system within that, and that conceptual system has a math behind it which they will pick up and incorporate into their lives.
So anyone can do maths, but they do it in a way which is individual to them, tending to be typical of what type they are. The NTP is dominant in pure mathematics.
I myself am an INFJ maths major.
I do recall in the Math Department, there were a lot of people not really interested in working on proofs. Most of them would read previous solutions to similar proofs before initiating. I'd much come up with some novel solution than rely entirely on regurgitation/memory. My main issue with writing proofs was that I would write more than what was needed to concisely get the point across. For instance, I had to work with another student to prove a theorem in front of the class. I thought of multiple ways to tackle the problem. I ended up reaching the conclusion, however, the teacher went up to the board and wrote a few lines to complete the proof (in contrast to my scattered approach). I did spend a lot of time creating and proving formulas that most likely have been invented such as vedic multiplication....mainly because I enjoyed finding patterns/relations. I also created the following theorem for prime numbers (Used it to attempt solving Goldbach Conjecture, however, I am not mature enough as a Mathematician to solve it.....): All prime numbers follow the following forms: 6i +1 or 6j +5 for i, j ∈ N
Proof (p=6i+1):
Every prime integer can be written of the following forms:
p' = 3k, p' = 3k+1 or p'= 3k+2
if p' is 3k and k>1, then p' is not prime (k|p' where k >1)
Thus, p' = 3k does not exist in the set of all primes, except 3 itself.
Suppose p' = 3k+1 = (2+1)k+1 = 2k + (k+1).
if k+1 is even, then p' is is non prime even number.
So, let k+1 be odd s.t k+1 = (2i+1) ==> k=2i
Then 3k+1 = 3(2i) +1 = 6i+1.
The other form follows the same reasoning.
Suppose p = 6i+1 is non prime. Let a be a divisor >=5
Then i ∈ {a((β+ n*|b|) + 1)/(|b|) | a >5} or
i ∈ {a((β+ n*b) - 1)/(b) | a =5}
where
β = min {x ∈ N | a((x+ n*|b|) + 1)/(|b|) ∈ N
or a((x+ n*b) - 1)/(b) ∈ N}
Proof:
Let (a+b) = 6 s.t p = (a+b)i +1 = ai +(bi+1).
suppose a is a divisor >=5. Then a| p iff bi+1 = aβ for some β ∈ Z+
Now, if a = 5, then b>0 ==> bi+1 >= 0 since i ∈ Z+.
Then aβ >=0 ==> β>=0 for the same reasoning. (a > 0).
Therefore, i = aβ-1/(b) where β∈ Z+
If a >5, then b<0, which means bi+1 <=0. Therefore, aβ <=0 ==>β<=0 since a >0.
In this case, i = (aβ-1/(b)) Because i >0, we have
i = |aβ-1|/(|b|. But |aβ-1| = |aβo+1| iff - β = βo. So, we can define i = |aβ+1|/(|b| for β∈ Z+
Let n ∈ N. Then since a*n >=5, it follows that
i = a(β + n*b)-1/(b) is a non-prime input for the form p = 6i+1 if a = 5, and i = |a(β+n|b|)+1|/(|b| is a non-prime input of the same form if a>5.
Algorithm:
Let a = 11. Then b = -5 since a +b =6
Case 2:
i = aβ +1/ |b| ==> i = 11β + 1 /|-5| = 11β +1/5
Now, β = min {x∈N | 11x +1/6 ∈N} = 4
So, i = 11*4+1/(6) = 45/5 = 9
==> p = 6*i+1 = 6*9+1 = 55
and 11|55
Therefore, if i ∈ { 9, 9+11*1, 9+11*2, 9+11*3, ...., 9+11*(n-1) where n>4}, then 11| 6*i+1
Note, | = divides, ∈ = exists in, and {} = a set.