Function to decrypt a series

auditdata

New member
Joined
Jul 31, 2020
Messages
3
Sorry for the cryptic title but a bit complicated to sum up in a phrase!
I have the need for a function to predict the sequential value of the decimal part of a communication frequency.
So in the table below I need to be able to derive the "n" value from knowing the "f".
I suspect it is something to do with divide by 4 and the modulus of 5 but can't crack it.
Every 4th it increments by 10 instead of 5.
n f
0 0
1 5
2 10
3 15
4 25
5 30
6 35
7 40
8 50
9 55
10 60
11 65
12 75
etc till
159 990
 

pka

Elite Member
Joined
Jan 29, 2005
Messages
10,117
Sorry for the cryptic title but a bit complicated to sum up in a phrase!
I have the need for a function to predict the sequential value of the decimal part of a communication frequency.
So in the table below I need to be able to derive the "n" value from knowing the "f".
I suspect it is something to do with divide by 4 and the modulus of 5 but can't crack it.
Every 4th it increments by 10 instead of 5.
n f
0 0
1 5
2 10
3 15
4 25
5 30
6 35
7 40
8 50
9 55
10 60
11 65
12 75
etc till
159 990
One needs to use the floor function \(f(n)=\left(5\cdot\left\lfloor \dfrac{n}{4} \right\rfloor\right)\) SEE HERE
 

auditdata

New member
Joined
Jul 31, 2020
Messages
3
Thanks. That gives me f from n but I need n from f? Is that possible?
:)
 

Dr.Peterson

Elite Member
Joined
Nov 12, 2017
Messages
8,305
If you don't need to check whether f is valid, try f/5 - floor(f/25). For example, if f=65, n=65/5 - floor(65/25)=13- floor(2.6)=13-2=11.
 

auditdata

New member
Joined
Jul 31, 2020
Messages
3
Perfect
 
Top