I’ve just gotten stuck…

I have the following integers:

```
F1 = 1 // start frequency
F2 = 100 // stop frequency
Fd = 1 // frequency step size
Fn = 99 // number of frequency points
```

Now the problem is if I change Fn to 98, Fd is recalculated and is still 1. That means Fn is incorrect.

What I want to happen is if Fn is decremented, the next lowest value should be a possible number of frequency points (49 here). This allows Fd = 2. The next lowest value should be 33; the next lowest should be 24, etc.

I’m looking for the solution that results in the proper Fn points for any values of F1 and F2 (F1 is always lower than F2 and all values are positive) when changing Fn by 1s, 10s, 100s, etc.

I tried to do it by changing Fd and then calculating Fn instead of directly changing Fn, but I run into other issues when moving back and forth, I’m not landing on the right points again.

```
Fd = Fd - Fd * delta; // delta is multiplying by 1s, 10s, 100s, etc.
Fn = (F2 - F1) / Fn;
if (Fn < 1) {
Fd = Fd + delta;
}
Fn = (F2 - F1) / Fd;
```