This challenge is based upon three sequences, below are their formulae:
a1 = 0; for n > 0, an = an-1 - n
if positive and not already in the sequence, otherwise
an = an-1 + n
an = (Φn – (–Φ)–n) / √5
where Φ denotes the golden ratio, and
a1 = 0
a1 = 0; an = n * (n+1) / 2
Your task is to take specified nth terms of each sequence and perform certain basic mathematical operations on them, namely addition, subtraction, multiplication, division, and the support of parentheses, nothing more is required.
Input is always in infix notation, and output formats are unrestricted.
Your code must be able to handle all real numbers from -10,000,000 to +10,000,000
Standard loopholes apply, and built-in functions for these sequences are not allowed.
Examples:
(These examples use an example output format of 1R = 1st term of R, 3430T = 3430th term of T, and so on, however you are free to use whichever output format you desire.)
Examples:
- (1R + 1F) * 3
= ( 0 + 0 ) * 3
= 0
- (1R * 1F) - 3
= ( 0 * 0 ) - 3
= - 3
- (1R + 2R) + (57R - 35R) / (51R - 41R) ) + (31F + 32F) - (54T)
= { [ (0 + 1) + (30 - 113) ] / (33 - 38) } + (832040 + 1346269) - (1431)
= { [ (0 + 1) + (-83) ] / (-5) } + (2178309) - (1431)
= [ (1 - 83 ) / (-5) ] + (2178309) - (1431)
= (-82 / -5) + (2178309) - (1431)
= (16.4) + (2178309) - (1431)
= 2176894.4