Started by trying to make a simple function to estimate and got quite close but it didn't work out, so I went the math way.
My explanation may not be perfect as these concepts are quite difficult to grasp and visualise, learnt a lot from this problem!
This solution is very math heavy, proceed with caution
After this it is very simple, the sequence converges very quickly so we don't need many primes to get the desired accuracy
Enter an integer (yourinput)
Code will output bar(f_yourinput)