5
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
4Reposting deleted challenges is poor form and can lead to an automatic question ban. If a challenge of yours should be undeleted, please flag it for moderator attention. – Dennis – 2016-11-11T16:00:08.580
1@DrMCMoylex Regardless of suggestions in chat, having a heavily downvoted, closed, deleted question contributes to automatic question bans, which cannot be lifted by moderators. The only way of lifting the ban is to fix those questions, which isn't possible if they have already been duped. – Dennis – 2016-11-11T16:10:23.243
@TheBitByte http://meta.codegolf.stackexchange.com/questions/5598/downvoting-needs-to-change
– Oliver Ni – 2016-11-11T16:21:49.887