How sine wave is generated using lookup tables
Lookup tables are incredibly useful.

In audio, when you're doing a chorus or flange effect, or a synthesizer with a modulating envelope, you want to be able to cycle through a sine wave in a lookup table and not just keep track of some infinitely growing index n.

You'll want to use some mathematical program like MATLAB, Octave, or Mathematica to generate as many points as is practical (I wouldn't go with less than 512 or 1024 points) and store that in an array. This is your lookup table.

For a fractional index, what you'll end up doing is linearly interpolating around the nearest two indices at that fractional value. Let's say your index is 8/3. You've called up your index in a 1024 point table four times. What do you do? Now you're at index 32/3.

You'll need to find the lower index floor(32/3) and the higher one ceil(32/3). You'll need some conditionals in case you're at the end. I'll leave that exercise to you.

So now you've got your neighbor indices, you'll evaluate the interpolated value at that fractional index using the linear interpolation formula.

y = x*y2 + (1-x)*y1;

where x is the difference between your fractional index and the nearest index rounded down, y1 is the nearest value of the lookup table rounded down (you found the index earlier, now just use it to index into the lookup array) and y2 is the same thing for the nearest value rounded up.

You would track the index in a variable and increment it each loop of your program by 8/3 and do a wraparound when necessary (when you go beyond the length of the lookup table).

The trickiest thing is keeping track of the indices. The nearest value rounded up may be the 0th index.