A frequency of 830.61 Hz has a period of 1/830.61 seconds.
At 96000 Hz sample rate, to convert seconds to samples, multiply seconds by 96000.
So a single cycle at 830.61 Hz would be 96000/830.61 = 115.57770795 sample periods.

68991 cycles of 830.61 Hz at 96000 Hz sample rate would be:
1 cycle period = 96000/830.61 samples
68991 cycles = (68991 * 96000)/ 830.61 = 7973821.64914942
So 7973822 samples will be very nearly perfect.

83061 cycles of 830.61 Hz at 96000 Hz sample rate would be:
1 cycle period = 96000/830.61 samples
83061 cycles = (83061 * 96000)/ 830.61 = 9600000
So 96000.00 samples will be perfect

I was trying to account for the two decimal places and over complicating it

I looked for the closest number of complete cycles to your figure of 7973856 samples.

To do that:
We know that 1 cycle is: “(sample rate)/frequency” samples.
How many cycles in 7973856 samples = (number of samples)/(samples per cycle)
Which gives us:
7973856/(96000/830.61)
= 68991.29721 cycles
Rounding to the closest number of cycles = 68991 cycles.

Any whole number of samples that is an exact multiple of 96000/830.61
Try 100 seconds

that’s a pretty nasty frequency, isn’t it?
The exact value (to 50 places) would be:
830.60939515989027704488357786743025088666010693809 Hz

The question is now how much accuracy one wants.
Steve’s 33.3… seconds are perfect for 830.61 Hz
For 830.609 Hz it would be:
1,000 s / GCD(96,000,000 , 830,609) = 1,000 / 1 = 1,000 seconds
and for 830.6094 Hz:
10,000 s / GCD(960,000,000 , 8,306,094) = 10,000 / 6 = 1,666.667 seconds

That’s the problem with such irrational, transcendental numbers…

But really just wanted to make it possible to make accurate loops that don’t click (without having to look for them) of any audio frequency which has two decimal places in it at any given sample rate

So I could make a sine wave I could throw in an Arduino or a Pi and it would loop? to play an accurate tone at say 319.88Hz

And I can predict the zero cross point of the sample and just type in a number rather than look for it

I need a formula in an Excel sheet which says

SAMPLE START = 0
FREQUENCY (Hz) XX,XXX.XX
SAMPLE RATE XXX,XXX

= NUMBER OF AUDIO SAMPLES TILL WAVEFORM CROSSES ZERO XXX,XXX,XXX

So if an Arduino plays back WAVs at a lower sample rate of say 8KHz then I can use the Audacity tone generator to make a suitable WAV and set the loop points and it will playback without clicking (in an ideal world ;/)

We know that for frequency F Hz, there are F complete cycles in 1 second,
an if F is a whole number, then the number of complete cycles in 1 second will be a whole number.

So what we need to do for a decimal number, is to look for a frequency that is an exact multiple of F and is itself a whole number. For a 2 digit decimal this is easy - we can just multiply by 100.
830.61 * 100 = 83061 (whole number).
So for any 2 digit decimal frequency, 100 seconds will be a whole number of cycles.
830.61 Hz has 830.61 cycles in 1 second
830.61 Hz has 83061 cycles in 100 seconds.
We know that there are an exact whole number of samples in each whole second (96000), so 100 seconds must be a whole number of samples (9600000).

For ‘some’ decimal frequencies, smaller durations may be possible. To find these, look for common factors of the number of samples and the number of cycles in 100 seconds.
In this case we have 9600000 samples in 100 seconds, and 83061 cycles in 100 seconds.
Both numbers are divisible by 3.
9600000/3 = 3200000
83061/3 = 27687
so in 320000 samples there are exactly 27687 cycles.

Tip: You can save the snippet either directly on the hard drive, or more conveniently as user preset:
Nyquist Prompt–>Manage–>Save Preset
and it can easily be revoked by Manage–>User Presets–>given name.

Alternatively, it could be made to work as a proper plugin for the “Analyze” menu.
…or generate menu with the tone with the right frequency and length (sample rate is given by the selection or the project rate).
Robert