
First look at why your sequence is so fragile
f (1) = 6, f (2) = 15, f (3) = 28, f (4) = 45 ....
==> f (2) f (1) = 9; f (3) f (2) = 13; f (4) f (3) = 17; f (5) f (4) = 21 ...
=> 139 = 4, 1713 = 4, 2117 = 4 .... Obviously an arithmetic sequence
=> f (n) f (n1) = 4 (n1) +5 (n> 1). From this recurrence relationship, you can get the result.
Push down as follows:
f (2)f (1) = 4 * 1 + 5;
f (3)f (2) = 4 * 2 + 5;
f (4)f (3) = 4 * 3 + 5;
...
f (n) f (n1) = 4 * (n1) +5;
Add the above formulas => f (n) f (1) = 2n * n + 3n5, note that f (1) = 6.
So f (n) = 2n * n + 3n + 1
As far as your needs are concerned, you need a nonlinear pseudorandom book generator. A simple way is to define a large table by yourself, the data in it is predefined, and then it is nonlinear (play your own imagination :)).
Then use rand (n), (n = 1,2, ...) to generate a number, use the even bits of this number to determine the row, and the odd bits to determine the column, and then take out the values in the table.
The key to this method is that the contents of this form must be safe. If someone disassembles it, this method will be in vain ...
If you have a high need for security, then you need a cryptographically secure pseudorandom number generator. You can search for PRNG online. There are many readymade implementations (mostly written by foreign cryptography experts). There is no way to ensure that the National Security Agency takes your program. 
