How to calculate the frequency of a gas giant eclipsing the sun from a moon? Say you have a moon around a gas giant which goes around a star. If the moon has an inclination of around 0° relative to the gas giant's orbit, the gas giant will eclipse the star every orbit of the moon. However, if the inclination is somewhat larger than 0°, not every orbit of the moon will contain a planetary eclipse. How would you calculate the amount of moon orbits in a row with a planetary eclipse?
Let’s start with an easy example and say the orbit of the planet with radius $r_p$ around the sun with radius $r_s$ is circular, the orbit of the moon around the planet is circular, the inclination of the moon's orbit is 90 degrees from the planet's orbital plane, and the orbital period of the moon is 1/360th the orbital period of the planet. Let's call the vector from the sun to the planet $v_1$ (with length $d_1$), the vector from the planet to the moon $v_2$ (with length $d_2$), and the vector from the sun to the moon $v_3$.  Let’s assume the moon is so small we don’t have to worry about orbital passes in which there is a solar eclipse visible from one side of the moon, but not from the other.
Every consecutive time the moon ascends through the planet's orbital plane, the angle $\theta$ between $v_1$ and $v_2$ will increase by 1 degree.  A little trigonometry (does everyone remember SohCahToa?) will give us the angle between $v_1$ and $v_3$ as $\phi = \arctan (d_2 \sin\theta/(d_1+d_2 \cos\theta)$.  So from the perspective of the moon, the angle between the sun and the planet in the sky will be $\alpha=\theta-\phi$.  The planet will be at least partially eclipsing the sun in the lunar sky whenever $\alpha&lt;\beta_p+\beta_s$ where $\beta_p= \arctan(r_p/d_2)$ is the half angle of the planet in the lunar sky, and $\beta_s= \arctan(r_s/\sqrt{(d_1+d_2 \cos\theta)^2+(d_2 \sin\theta)^2}$ is the half angle of the sun in the lunar sky.
Here is a diagram looking at the planet's orbital plane when the moon passes through the plane:

Clear as mud?  Let’s do an example with Jupiter (which we will now assume has a circular orbit) and our Sun!  Jupiter’s orbit is 4333 days, so our moon’s orbital period should be 4333/360 =~12 days.  Kepler’s third law says the ratio of the cube of the SMA (semi-major axis) to the square of the orbital period is constant for moons about a body, and we know Jupiter’s moon Callisto has a SMA of 1.883e6km and an orbital period of 16.69 days, so we have the equation $d_2^3/12^2=(1.882e6)^3/16.69^2$.  Solving yields $d_2=1.51e6km$ is how far our moon is from Jupiter.  Jupiter has a radius of $r_p=6.9911e5$km so the half solid angle of Jupiter from our moon is $\beta_p = \arctan(6.9911e5/1.51e6)=0.5radians$ or 28.6 degrees.  The solid angle of the sun from our moon will average about $\beta_r = \arctan(6.957e6/7.8e8)=0.00892radians$ or 0.551 degrees, but it varies a bit in the third significant digit.
Plug it all into the above equations and you get an orbit without an eclipse, followed by 59 orbits with an eclipse and then another orbit without an eclipse.  Here is the matlab code for posterity:
theta = 0:1:359;
d1=7.8e8;
rs=6.957e6;
d2=1.51e6;
rp = 6.9911e5;
phi = atan(d2*sin((pi/180)*theta)./(d1+d2*cos((pi/180)*theta)));
bp = atan(rp/d2);
bs = atan(rs./sqrt((d1+d2*cos(pi/180*theta)).^2+(d2*sin(pi/180*theta)).^2));
alpha =pi/180*theta-phi;
sum(alpha&lt;bp+bs)*2-1

Notes:

This was an easy example because I got to choose all the orbital geometries.  Want to make it harder? Choose a planetary orbital period that isn’t an integer multiple of the lunar orbital period. Want to make it harder? Choose an inclination less than 90 degrees so that some eclipses occur when the moon is outside the planetary orbital plane. Want to make it harder?  Choose highly elliptical orbits for both the planet and the moon, so that $d_1$ and $d_2$ both vary as separate functions of time.  Want to make it harder?  Specify a large moon so that some eclipses can only be seen from some points on the moon, but not others.

I provided the solution for partial eclipses.  If you want the solution only for full eclipses, use this equation: $\alpha&lt;\beta_p-\beta_s$ instead of this equation: $\alpha&lt;\beta_p+\beta_s$ above.

I did not provide a closed analytical solution for the general problem of counting consecutive solar eclipses from a moon given the orbital elements for the planet and moon and the radii of the sun and planet.  However, in describing the solution for a particular class of orbits, I think I've clearly detailed the calculation method that could extend to any particular orbit. The key is in understanding that even though a moon's orbital plane is fixed in an PCI (Planet Centered Inertial) coordinate system, it appears to precess in a sun-centered, planet-fixed coordinate system. A similar example of this phenomenon is the four seasons here on earth due to the Earth's axial tilt.  The Earth's axial tilt is nearly constant, but from our perspective here on Earth, it appears to precess.

Classical orbital mechanics is disgustingly hard and unforgivingly unintuitive. It's much easier to use Satellite Toolkit or Universe Sandbox to plug in your initial orbits, propagate them, and count the eclipses as others suggest.