text:
Is my number Unique
In this challenge we learned a way to encode every positive integer using factor trees.
Here is how it works:

The empty string has value of 1.
(S) where S is any expression with a value of S evaluates to the Sth prime.
AB where A and B are arbirary expressions with values of A and B respectively has value A*B.

For example if we wanted to represent 7 we would do
  7 -> (4) -> (2*2) -> ((1)(1)) -> (()())

Turns out we can represent every whole number using this method.  In fact some numbers we can represent in multiple ways.  Because multiplication is commutative 10 is both
((()))()

and
()((()))

At the same time some numbers can only be represented in 1 way.  Take 8 for example.  8 can only be represented as
()()()

And since all of our atoms are the same we can't use commutivity to reorganize them.

So now the question is "Which numbers can only be represented in 1 way?".  The first observation is one I just started making back there.  It seems that perfect powers have some special properties.  Under further investigation we can find 36, which is 62 is a perfect power but has multiple representations.
(())()(())()
(())()()(())
()(())()(())
()(())(())()
()()(())(())

And this makes sense because 6 is already rearrangable, so any number we make out of 6 must also be rearrangable.
So now we have a rule:

A number has a unique representation if it is a perfect power of a number with a unique representation.

That rule can help us reduce determining if a composite number is unique to determining if a prime number is unique.  Now that we have that rule we want to figure out what makes a prime number unique.  This is actually pretty self evident.  If we take a unique number and wrap it in parentheses, the result must be unique, and, going the other way if n has multiple representations the nth prime must have multiple representations.  This yields the second rule:

The nth prime is unique if and only if n is unique.

Both of these rules are recursive, so we are going to need a base case.  What is the smallest unique number?  One might be tempted to say 2 because its just (), but 1, the empty string, is even smaller and is unique.

1 is unique.

With these three rules we can determine whether a number has a unique factor tree.
Task
You may have seen it coming, but your task is to take a positive integer, and determine if it is unique.  You should write either a program or function that does this computation.  You should output one of two possible values, what these values are is up to you but one should represent "yes", being output when the input is unique and one should represent "no" being output otherwise.
Your answers should be scored in bytes with less bytes being better.
Test cases
Here are the first couple unique numbers:
1
2
3
4
5
7
8
9
11
16
17
19
23
25
27
31

Suggested test cases
5381 -> Unique

It seems that OEIS A214577 is somehow related, so if you need more test cases try there, but I don't know they are the same so use at your own risk.

I believe that the prime factors had to be sorted but whatever.

@JonathanAllan no, it's all here.

Suggested test case: 5381

@StephenLeppik Test case added, thanks.

@WheatWizard Can our program error for non-unique numbers, and return a consistent value for unique numbers?

@H.PWiz I'm going to say that a full program can error as output because that is a form of output for a program, but a function must return a value.

Husk, 11 10 bytes
Saved one byte thanks to Zgarb!
Ωεo?oṗ←¬Ep

Returns 1 for unique, 0 otherwise
Try it online! Or returning the first 50
Explanation:
Ωε              Until the result is small (either 1 or 0), we repeat the following
         p     Get the prime factors
  o?           If ...
        E      they are all equal:
    ȯṗ←           Get the index of the first one into the primes
               Else:
       ¬          Not the list (since non-empty lists are truthy, this returns 0)

Oh, and your explanation says "ȯp←".

@EriktheOutgolfer Good catch, fixed

I think ṁ¬ can be just ¬ since the list must be non-empty in that branch.

@Zgarb Oh fancy, I think you gave me that tip before

Jelly, 10 bytes
After a LOT of fiddling around!
ÆET0ṪḊ?µl¿

A monadic link taking a positive integer and returning 1 if it is unique or 0 if not.
Try it online!
How?
ÆET0ṪḊ?µl¿ - Link: number, n     e.g. 11          or 13            or 20
         ¿ - while:
        l  - ...condition: (left) logarithm with base (right)
           -               note: x log 0 and x log 1 both yield None, which is falsey
       µ   - ...do the monadic chain: (first pass shown)
ÆE         -   prime exponent array   [0,0,0,0,1]    [0,0,0,0,0,1]    [2,0,1]
  T        -   truthy indexes         [5]            [6]              [1,3]
      ?    -   if:
     Ḋ     -   ...condition: dequeue (i.e. if length > 1)
   0       -   ...then: literal zero   -              -               0
    Ṫ      -   ...else: tail           5              6               -
           - end result                1              0               0

Wait, logarithm, what?!
Lets run through some examples of the loop.
If n=31 (311, the eleventh prime):
log test # |  left, x |  right, b |  x log b
-----------+----------+-----------+----------
         1 |       31 |        31 |    1.000 -> continue
         2 |       11 |        31 |    0.698 -> continue
         3 |        5 |        11 |    0.671 -> continue
         4 |        3 |         5 |    0.683 -> continue
         5 |        2 |         3 |    0.631 -> continue
         6 |        1 |         2 |    0.000 -> stop, yielding left = 1

If n=625 (54):
log test # |  left, x |  right, b |  x log b
-----------+----------+-----------+----------
         1 |      625 |       625 |    1.000 -> continue
         2 |        3 |       625 |    0.171 -> continue
         3 |        2 |         3 |    0.631 -> continue
         4 |        1 |         2 |    0.000 -> stop, yielding left = 1

If n=225 (52×32):
log test # |  left, x |  right, b |  x log b
-----------+----------+-----------+----------
         1 |      225 |       225 |    1.000 -> continue
         2 |     *  0 |       225 |-inf+nanj -> continue
         3 |     ** 0 |         0 |     None -> stop, yielding left = 0

*The dequeued list was not empty
**Tailing an empty list in Jelly yields 0

APL (Dyalog), 42 bytes
⎕CY'dfns'
{1≥⍵:1⋄1=≢∪r←3pco⍵:∇1+¯1pco⊃r⋄0}

Using ⎕CY'dfns' with dfnses isn't very feasible on tio.

My answer came out quite similar to yours, although, I did write the first version around 4 hours ago

@H.PWiz look man, I don't really care when people submit in the same language although I usually prefer to just comment when I find shorter solution, but this is almost the same. I don't mind you keeping it, but I find answers that look the same pretty useless. About timing - that's how it works. I dropped dozens of answers because someone else came first. I (and I believe the rest) am doing it for fun, not a real competition.

Sorry for taking so long getting around to it, but I have deleted my answer. Looking back, a comment seems like it would have been more appropriate. I think, since I was new to APL at the time, such an answer required a fairly significant amount of effort, and I felt a comment would have made it feel like a waste

Jelly, 11 bytes
ÆfẋE$ḢÆCµl¿

Try it online!
-2 thanks to a very genius trick by Jonathan Allan.
Using H.PWiz's Husk algorithm.

Since log to the base one and zero both yield None you can do ÆfẋE$ḢÆCµl¿for 11 :)

@JonathanAllan Hey, that's a first! Nice.

Pari/GP, 49 bytes
f(n)=d=factor(n);n<2||(#d~<2&&f(primepi(d[1,1])))

Try it online!


text:
Primes ’n’ Digits
This has no practical purpose but it could be fun to golf.
Challenge
Given a number n,

Count the amount of each digit in n and add 1 to each count
Take the prime factorization of n
Count the amount of each digit in the prime factorization of n, without including duplicate primes
Create a new list by multiplying together the respective elements of the lists from steps 1 and 3
Return the sum of that list

For example, 121 has two 1s and a 2, so you would get the following list from step 1:
0 1 2 3 4 5 6 7 8 9
1 3 2 1 1 1 1 1 1 1

The prime factorization of 121 is 112, which gives the following list for step 3:
0 1 2 3 4 5 6 7 8 9
0 2 0 0 0 0 0 0 0 0

Note how we did not count the exponent. These multiply together to get:
0 1 2 3 4 5 6 7 8 9
0 6 0 0 0 0 0 0 0 0

And the sum of this list is 6.
Test cases
1 -> 0
2 -> 2
3 -> 2
4 -> 1
5 -> 2
10 -> 2
13 -> 4
121 -> 6

Notes

Standard loopholes are forbidden.
Input and output can be in any reasonable format.
You should leave ones (or zeros for step 3) in the list for digits that did not appear in the number.
This is code-golf, so the shortest solution in bytes wins.

Does 667 (=23*29) make for two 2s, one 3, and one 9 in step 3?

@JonathanAllan Yes.

@wizzwizz4 232792560 -> [2,1,4,2,1,2,2,2,1,2] (step 1); 2*2*2*2*3*3*5*7*14*17*19 (step 2); so [0,5,1,2,0,1,0,2,0,1] (step 3); then [0,5,4,4,0,2,0,4,0,2] (Step 4); and hence should output 21.

@JonathanAllan It would be nice if I could count. :-/

05AB1E (legacy), 5 bytes
fS¢>O

Try it online!
f      list of prime factors (without duplicates) of the implicit input
S      characters, all of the digits
¢      count each of the characters in the implicit input
>      increase each of the counts
O      sum (implicit output)

Jelly,  18  17 bytes
-1 byte thanks to caird coinheringaahing & H.PWiz (avoid pairing the two vectors)
DF‘ċÐ€⁵
ÆfQÇæ.Ç‘$

A monadic link taking a positive integer and returning a non-negative integer.
Try it online!
How?
DF‘ċÐ€⁵ - Link 1, digitalCount: number(s)    e.g. [13,17]
D       - to decimal list (vectorises)            [[1,3],[1,7]]
 F      - flatten                                 [1,3,1,7]
  ‘     - increment (vectorises)                  [2,4,2,8]
      ⁵ - literal ten                             10
    Ð€  - map across              (implicit range [1,2,3,4,5,6,7,8,9,10])
   ċ    - count                                   [0,2,0,1,0,0,0,1,0,0]

ÆfQÇæ.Ç‘$ - Main link: positive integer, n   e.g. 11999
        $ - last two links as a monad:
      Ç   -   call the last link (1) as a monad   [0,2,0,0,0,0,0,0,0,3]
       ‘  -   increment (vectorises)              [1,3,1,1,1,1,1,1,1,4]
Æf        - prime factorisation                   [13,13,71]
  Q       - deduplicate                           [13,17]
   Ç      - call the last link (1) as a monad     [0,2,0,1,0,0,0,1,0,0]
    æ.    - dot product                           8

17 bytes

Or use dot product

Jelly, 16 bytes
ṾċÐ€ØD
ÆfQÇ×Ç‘$S

Try it online!
Developed independently from and not exactly the same as the other Jelly solution.
Explanation
I'm gong to use 242 as an example input.
ṾċÐ€ØD     Helper link
Ṿ          Uneval. In this case, turns it's argument into a string.
           242Ṿ → ['2','4','2']. [2,11] → ['2', ',', '1', '1']. The ',' won't end up doing anything.
    ØD     Digits: ['0','1',...,'9']
 ċÐ€       Count the occurrence of €ach digit in the result of Ṿ

ÆfQÇ×Ç‘$S  Main link. Argument 242
Æf         Prime factors that multiply to 242 → [2,11,11]
  Q        Unique elements → [2,11]
   Ç       Apply helper link to this list → [0,2,1,0,0,0,0,0,0,0]
     Ç‘$   Apply helper link to 242 then add 1 to each element → [1,1,3,1,2,1,1,1,1,1]
    ×      Multiply the two lists element-wise → [0,2,3,0,0,0,0,0,0,0]
        S  Sum of the product → 5

APL (Dyalog), 43 41 bytes
⎕CY'dfns'
+/×/+/¨⎕D∘.=⍕¨(⎕D,r)(∪3pco r←⎕)

Try it online!
How?
r←⎕ - input into r
3pco - prime factors
∪ - unique
⎕D,r - r prepended with 0-9
⍕¨ - format the factors and the prepended range
⎕D∘.= - cartesian comparison with every element of the string 0123456789
+/¨ - sum each row of the two tables formed
×/ - multiply the two vectors left
+/ - sum the last vector formed

Pip, 44 bytes
Y_N_.aM,tT++o>aTa%o{a/:olPBo}$+y*Y_N JUQlM,t

Takes input from command-line argument. Try it online!

Python 2, 136 127 bytes
lambda a:sum(''.join(u(a)).count(`i`)*-~`a`.count(`i`)for i in range(10))
u=lambda a:[`j`for j in range(2,a)if a%j<1>len(u(j))]

Try it online!
Credits

Reduced from 136 bytes to 127 by Mr. Xcoder

127 bytes

@Mr.Xcoder Updated, thanks for showing me the use of -~ I was always a bit confused on that. And I need to start remembering the <1 thing.  Thanks for the help.

You can take a look through this for -~ and related stuff.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Prefixless Palindromes
Write a program or function that takes N, and S and outputs the number of palindromes of length S you can build using an alphabet of size N such that any prefix of size between 2 and S-1 is not a palindrome.
For example if N were 2 and S were 5
The valid palindromes would be
01110
10001

And thus the answer would be 2
This is code-golf so answers will be scored in bytes based on their length with fewer bytes being better.

Welcome to PPCG! Despite its laconic format, this looks like a valid challenge -- provided that it is neither a dupe nor a question picked somewhere else without permission. At the very least, you'd need to add an objective primary winning criterion such as code-golf. I'd recommend to add some examples and test cases as well.

@Arnauld It's possible for us to change a off-topic question to a valid challenge (ais523 did that for a few times) but in that case it is obviously not what the OP want. It won't hurt anyway.

the result isn't infinite ? for N >= 2 : 01111111111111111111111111..0 is a palindrome such that any prefix is not a palindrome

@NahuelFouilleul of length S.

@user77149 If you ask it here you will get answers like "Jelly, 15 bytes: Try it online!"

14 bytes

Jelly, 10 bytes
ṗŒḂƤ€Ḋ€Ḅċ1

This is a brute-force search over all ns possible strings.
My results differ from the other answers', but the solutions my answer counts seem to be valid.
Try it online!

Pyth, 16 bytes
lf!tit_IM._T2^SE

Try it here!
My answer agrees with Dennis' results, rather than the Haskell and the Python answers.
How it works

lf!tit_IM._T2^SE | Full program.

              SE | Grab the second input (E), make an integer range from 1 ... E.
             ^   | And take the Qth Cartesian Power, where Q is the first input.
 f               | Filter by a condition that uses T as a variable.
         ._T     | Take all the prefixes of T...
      _IM        | And for each prefix, check if they're invariant over reversal.
     t           | Take the tail (remove the first element).
    i       2    | Convert from base 2 to integer.
  !t             | Decrement, negate. Note that among the integers, only 0 is falsy.
l                | Take the length of the filtered list.

Husk, 19 bytes
Lf(=1ḋ↔mS=↔‼hU¡h)πŀ

Try it online or view the solutions!
Explanation
Lf(=1ḋ↔mS=↔‼hU¡h)πŀ  -- takes two arguments N S, example: 2 4
                  ŀ  -- range [0..N-1]: [0,1]
                 π   -- all strings of length S: [[[0,0,0,0],[0,0,0,1],…,[1,1,1,1]]
 f(             )    -- filter with the following predicate (example with [0,1,1,0]):
              ¡h     --   infinitely times take the head & accumulate in list: [[0,1,1,0],[0,1,1],[0,1],[0],[],[],…
             U       --   only keep longest prefix with unique elements: [[0,1,1,0],[0,1,1],[0,1],[0],[]]
           ‼h        --   get rid of last two (apply twice head): [[0,1,1,0],[0,1,1],[0,1]]
       m             --   map the following
        S=           --     is itself equal to..
          ↔          --     .. itself reversed?
                     --   ↳ [1,0,0]
      ↔              --   reverse: [0,0,1]
     ḋ               --   convert from binary: 1
   =1                --   is it equal to 1: 1
                     -- ↳ [[1,0,0,1],[0,1,1,0]]
L                    -- length: 2

Clean, 129 bytes
import StdEnv,StdLib
?l=l==reverse l
@n s=sum[1\\p<-iter s(\a=[[e:b]\\e<-[1..n],b<-a])[[]]|and[?p:[not(?q)\\q<-inits p%(2,s-1)]]]

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
2017 SCRAM Finder
Background
The nuclear industry has term, SCRAM, used to describe a quick shutdown of the reactor.  There's a fun myth that it stands for "Safety Control Rod Ax Man," the role which served to shut down the Chicago Pile if it got too hot by literally cutting a rope with an ax (although this was debunked).
The US Nuclear Regulatory Commission (NRC) publishes a daily list of events at every licensed facility in the country. This includes power reactors, as well as research reactors, uranium mines, fuel fabrication facilities, and certain hospitals; we only care about power reactors.  There are many possible reports, most fairly boring, but each report is given a SCRAM Code, which is what you will be searching for. One example is shown below:

The SCRAM Code is "A/R" to indicate it was an automatic reactor SCRAM, but other codes are possible.  An "N" code indicates the event is not a SCRAM and can be ignored. Your task is to find all of the SCRAMS which occurred at US Nuclear power reactors in 2017.
Challenge

Your answer may take no input
Search through all daily event reports found here
Find all reports which have a SCRAM Code other than "N"
Reports must be at facility type "Power Reactor"
Output (STDOUT, nearest equivalent, function return, or sensible alternative) each SCRAM (in chronological order), identified by Facility Name, Event Number, Event Date, and SCRAM Code.  Each field must be delimited in some fashion, and each SCRAM must be delimited by a separate delimiter. Other than this, output format is flexible.
Only a sample of a minimum of 5 SCRAMS needs to be included in your answer, or you can post the full list if you'd like.
Some SCRAMs will have reports on multiple days due to follow-up reporting, your answer should weed out duplicate SCRAMs.
Some sites have multiple reactors (units) which can SCRAM separately.  You should determine SCRAMs at both units, but do not need to report which unit it came from. Required behavior for multiple unit simultaneous SCRAMs is not defined.
Note that not all 365 days of the year have reports, your answer must handle this.
This challenge is Code Golf, so shortest answer wins. Standard caveats and loopholes apply
In case the NRC changes the format of the webpage, your answer obviously doesn't need to handle this.

Sample Output
Field1 Field2 Field3 Field4|Field1 Field2 Field3 Field4|....
-------
Field1 Field2 Field3 Field4\n
Field1 Field2 Field3 Field4\n
...
------
[["Field1","Field2","Field3","Field4"],["Field1","Field2","Field3","Field4"],...]

Because the output is essentially fixed, [tag:kolmogorov-complexity] works too. (or not?)

@user202729, Added internet tag, forgot it existed and tried to find a web-scraping tag at posting. I wouldn't consider this fixed output since hypothetically reports can change, a few will be added in the next two days, and some may be retroactively added as a result of audits. Answers will need to re-scrape each run. Will add the note on website changes

Any reason for not passing the year as input? That would definitely justify the need to scrape. The URL would be https://www.nrc.gov/reading-rm/doc-collections/event-status/event/[YEAR]/.

I figured limiting to 2017 would make it nominally easier. Also I cant guarantee that the format of reports stayed consistent going back through the years

Wow that's an awful website. Everything is just nested tables with very little other organization. No classes or IDs to work with -_-

@Carcigenicate, gotta love the gov't, they're always so tech savvy

@wnnmaw I really wanted to do this challenge, but I'm not even sure it's feasible. Note how on the 28th (or 29th) of December, they retracted a report. The retraction notice offsets all the other elements, so it's not like you can say "the info table will always be the nth element". If you had picked a better set up site, this would have been a fun challenge. An hour of looking at their site structure for patterns just proved to be an exercise in frustration unfortunately.

The different parts of single reports aren't even grouped together. They're all just pushed into the same "feed". The only separator is the "top" button.

@Carcigenicate, I'm sorry to hear you can't do this especially given your excitement in answering!

@wnnmaw Have you tried parsing it? There could be a pattern that I'm missing, but like I said, there doesn't seem to be a consistent enough structure to reliably get the correct data.


text:
A Programming Puzzle of Mode Golf
Your task is to print the text Good morning, Green orb!, with every character repeated in place as many times as the most frequent byte in your source (the mode).  A trailing newline is permitted and need not be repeated.
For example if your source was
print p

Since p appears twice and every other byte appears once you would need to print
GGoooodd  mmoorrnniinngg,,  GGrreeeenn  oorrbb!!

Answers will be scored by the product of their byte count and the number of times the output is repeated.  For example the above code (if it worked) would score 7*2 = 14.  The goal should be to minimize one's score.
Your code must contain at least 1 byte.
Use this program to verify that your code and output match

Functions are allowed, right?

@totallyhuman Yes, so long as they don't take input.

Shouldn't this be tagged [tag:quine]?

Morning can't be capitalized, can it haha?

@magicoctopusurn Nope the text should be the same.

Sad face, was going to tie Jelly :P.

Brain-Flak, 384 * 106 366 * 100 = 36,600
(((((((()()()))))))(()({}{}{}(([(({}{})){}()]((((({}())){})){}{}()(({})<([{}](((({}()())))([{}]([{}]()((()()())(()()({}()([(({})){}()](((((({}))))({}({}{}{}){})(({}){}()))))<((((([]){}){}){}<>)<>)>[])))))))(((((()()())()){}{}){}){})<>(((({})<>)))>{}{})))))<(<>({})<>)>))(<>((({}))()){}{}<>)<>(((({}<>()))))({}{}{}<>)<>{((<>{}<><({}<>)>)<{({}[()]<(({}))>)}{}>)<>}<>{}

Try it online!
Explanation
The first thing I do is push the string
!bro neerG ,gninrom dooG

to the stack using pretty standard brain-flak Kolmogorov-complexity tactics.
(((((((()()()))))))(()({}{}{}(([(({}{})){}()]((((({}())){})){}{}()(({})<([{}](((({}()())))([{}]([{}]()((()()())(()()({}()([(({})){}()](((((({}))))({}({}{}{}){})(({}){}()))))<((((([]){}){}){}<>)<>)>[])))))))(((((()()())()){}{}){}){})<>(((({})<>)))>{}{})))))<(<>({})<>)>))(<>((({}))()){}{}<>)<>({}<>())

Then we push a counter to the off stack to tell us how many times to duplicate each character.  However I wasn't going to be able to determine what this counter was until I was done writing the program.
Next up we simultaneously reverse the string and duplicate each character in place the correct number of times.  Specifically the counter + 1.
{((<>{}<><({}<>)>)<{({}[()]<(({}))>)}{}>)<>}<>{}

These two parts of the program have a mode of 99 open parentheses.  However since we are most certainly going to need at least 1 parenthesis.  Here is where I noticed that the last character we pushed ! conveniently has character code 33 which means we can use it to create 99, the exact number we want using only one additional parenthesis.  This is quite the coincidence but it works.

Ah yes, just pretty standard brain-flak Kolmogorov-complexity tactics. Those are the thing.

You, my good fellow, must be mad to even try this. I'm just going to +1 and walk away before my brain explodes from trying to understand all the brackets.

Jelly, 13 bytes * 1 = 13
“¢Ȧ@XĊ'WÑṭḂ#»

Try it online!

Finally someone manages the elusive *1 answer. I had a feeling Jelly would be the language to do it...

@ETHproductions Haha, just halved my code while keeping  * 1

Haha dang I just found that right after you edited it

Out of curiousity, what exactly is the difference? How is the new compressed string half the length of the old one?

@ETHproductions I basically used  a non-optimal compressed string at first, then I used the optimised Jelly compressor which found the matches in the dictionary.

Haskell, 37 bytes × 3 = 111
-20 thanks to H.PWiz. -25 thanks to nimi.
"Good m\111rning, Green orb!"<*[2..4]

Try it online!
Haskell's operators FTW.
Self-reminder to never golf on mobile. I keep making dumb mistakes. I can push at least half the blame on mobile. :P

Using <* to save bytes (Note that I haven't checked its validity)

...Bloody hell, Haskell almost has too many operators. Thanks!

brainfuck, 235 x 77 = 18,095 points
Edit: -2 bytes thanks to @Dennis
-[>--<-------]>-[>+++++>+>+>+>+++++>+>+>+>+>+++>+++++>-->+>+>+>+>+>+>+>+++++>+>+>+>+++[<]>-]>>----------->+++++>++>->+>-------->-------->+++++>>->++++++>------>+>---->+>+++++>++>>->--------->++>++>>-[>+<---]>--------<<[>>[-<+<.>>]<<,<]

Try it online!
TIO test
Wait, this isn’t code bowling?? \s
With only 8 usable characters, brainfuck is one of the worst languages to do this question. I had to start with minimising which character would inevitably appear the most, typically either + or -. After writing the first iteration of the code, I found it horribly unbalanced in favour of +s. I rearranged parts of the code, such as generation of larger numbers, to use more -. Finally, I ended up at an equal amount of the two characters at 77 one less - than +. It’s certainly possible to reduce this further, which I’ll have a go at tomorrow.
But hey, at least I beat the Brainflak answer

Hey, congratulations! I can't believe that it's even possible to do this in BF... Pretty if it can be done in the ;# language ( ͡° ͜ʖ ͡°)

Alice, 49 bytes * 2 = 98 144
/:G!4o3r8"1=5',0Grey9Z<@
\"b0=dnm 2'i%g<7R6~e.;o/

Try it online!
Explanation
/...@
\.../

This is the usual framework for linear programs that operate entirely in Ordinal mode. Unfolding the zigzag control flow, we get:
"G04d3m821i5g,7G6ee9;<:b!=onr "'=%'<0Rr~y.Zo@

The basic idea is to avoid characters which repeat more than twice with the help of a transliteration. The transliteration we're going to do is the following:
input: "G04d3m821i5g,7G6ee9;<:b!"
from:  "0123456789:;<"
to:    "onr "

The way transliteration works in Alice is that the from and to strings are first repeated to the LCM of their lengths, although in this case, all the matters is the length of the from string, so we get:
from:  "0123456789:;<"
to:    "onr onr onr o"

This way, we get four different characters to represent the os, and three each for n, r and the space. We can generate the from string using range expansion as follows:
'<   Push "<".
0    Append a zero.
R    Reverse.
r    Range expansion.

The only issue now is that we'd need four " for both the input and the to string. To avoid that, we put them both into a single string and split it at a = used as a separator.
"G04d3m821i5g,7G6ee9;<:b!=onr "
     Push the string containing both parts.
'=%  Split around "=".

The rest is just:
~   Swap "from" and "to".
y   Transliterate.
.Z  Duplicate and interleave. This duplicates each character.
o   Print.
@   Terminate the program.

C (gcc), 74×6=444crossed out 444 is still regular 444 77×5=385 81×4=324
f(q){char*a="Go\157d morning, G\162een o\162b!";for(q=0;q<96;)putchar(a[q++/4]);}

Try it online!

o0 wat did you do to your post header

had a bit of fun

where did the crossed out 44 meta post go?

Python 2, 62 × 3 = 186
lambda:`sum(zip(*['Good morning, Green \x6frb!']*3),())`[2::5]

Try it online!

Vim, 42 41 keystrokes × 3 = 123
iGod morning, Green orb!<Esc>2|qsyl2pl@sqX0@s

Explanation:

iGod morning, Green orb!<Esc>
Write the string God morning, Green orb! (one o missing).
2|
Jump to the first o.
qsyl2pl@sq
Create a recursive macro s.
As a side effect, triple the current o.
X0
Remove one o and jump to the beginning.
@s
Run the macro s, which repeat each character twice.

APL (Dyalog Unicode), 46 bytes × 2 = 92
(Contains unprintables)
2/⎕UCS(¯18+⍳24)+⎕UCS'X~r-yz|wqum1$Jtfemln]'

Try it online!
+Alot of bytes thanks to Dyalog's code page, thanks to @Adám for pointing that out.

84

That's really genius, @Adám

I'm afraid you have to settle for 92 since ~⎕AV∊⍨⎕UCS 18.

C (gcc), 68 × 3 = 204
0000000: 6a 3b 6d 61 69 6e 28 29 7b 77 68 69 6c 65 28 6a  j;main(){while(j
0000010: 3c 37 32 29 70 75 74 63 68 61 72 28 7e 22 b8 90  <72)putchar(~"..
0000020: 90 9b df 92 90 8d 91 96 91 98 d3 df b8 8d 9a 9a  ................
0000030: 91 df 5c 32 32 30 8d 9d de 22 5b 6a 2b 2b 2f 33  ..\220..."[j++/3
0000040: 5d 29 3b 7d                                      ]);}

Thanks to @MDXF for saving 9 points and paving the way for 6 more!
Try it online!
Alternate version, printable ASCII, 69 × 3 = 207
j;main(k){while(j<72)putchar("Gnmg$hiuf`dl -I}ut|3{gt6"[k=j++/3]^k);}

Try it online!

Let us continue this discussion in chat.

C, 78 × 4 = 312
*s=L" ÞÞÈ@ÚÞäÜÒÜÎX@äÊÊÜ@ÞäÄB";main(y){while(*++s)for(;y++%5;putchar(*s/2));}

Try it online!
356 332

Commenting because I'm tired of finding it in my browser history every time I want to golf: I used this to find the number of character repetitions.

And this to encode the string.

Japt, 24 bytes * 2 = 48
`Good ¶rÍÁ,
GÎ9 b!`m²·¸

Contains an unprintable. Test it online!
The majority of the program is just a compressed string, which decompresses to
Good morning,
Green orb!

and m² then maps each character by repeating it ²wice okay, that was a bit of a stretch. Space is the only character that appears 3 times in the compressed string; to save one instance we replace it with a newline, then use ·¸ to split on newlines and immediately join on spaces. While 2 bytes longer, it substantially reduces the score (from 66 to 48).
Now if only there were a short way to do it using no character twice...

Because I can't see it: which character is in the source three times? I see several things that have a count of 2, but not 3.

@Draco18s None, the score is 24*2.

Then the output is wrong. You're printing each character 3 times instead of twice.

@Draco18s Dangit, posted the wrong link... Thanks for pointing that out.

*salute* And now that I look at your answer I see it has ² whereas the link had ³ :)

@Draco18s Yep, and they do the same thing, but ² twice and ³ thrice :-)

Yup, I know exactly what it does, just that I was looking at the source in the link as compared to the source in the answer. Otherwise I'd have seen that it was a bunged link. ;)

R, 65 bytes * 5 = 325 59 bytes * 5 = 295 62 bytes * 4 = 248
cat(gsub('(.)',strrep('\\1',4),"Good Mo\x72ning, Green orb!"))

Try it online!
There are 4 (or,') characters.

I've never seen strrep before, that should come in handy.

SNOBOL4 (CSNOBOL4), 97 bytes * 10 = 970
	S ='Good Morning, Green orb!'
y	S	LEN(1) . y rem . s	:f(p)
	x	=x DUPL(y,10)	:(y)
p	OUTPUT	=x
END

Try it online!
yeah........SNOBOL requires operators to be separated by whitespace, and there are whitespace requirements that are quite awkward. There are 9 '\t' and 10 ' ' in the code, so any improvements will require a fairly significant change in approach.

Ruby, 52 bytes × 3 = 156
puts"Good morning, Green \x6frb!".gsub(/(.)/,'\1'*3)

Try it online!

Nice way to avoid repeating characters

Perl 5, 59 × 2 = 118 points
$_="GSSdYmoVRing,YGVIen orb!";y<H-Z>[d-t ],s<.>[$&x2]eg;say

Try it online!
Perl 5, 51 × 3 = 153 156 points
s""GOOd morning, Green orb!";y'O'o';s/./$&x3/eg;say

Try it online!
Perl 5, 43 × 4 = 172 points
say"Good morning, Green orb!"=~s/./$&x4/egr

Try it online!
Saved 2 bytes in each solution thanks to @Xcali (a few changes ago). For all optimizations look at the edits.

Making this a program instead of a function would save 2 bytes (4 points): Try it online!

@Xcali, but your change needs a nonstandard option -M5.010, which also counts

That one is free: https://codegolf.meta.stackexchange.com/questions/11924/new-users-guides-to-golfing-rules-in-specific-languages/11939#11939

Python 2, 62*4 = 248
Thanks to @ovs and @Giuseppe!
lambda:"".join(c*4for(c)in"G\x6f\x6fd mor\x6eing, Green orb!")

Try it online!
Python 2, 51*6 = 306
print"".join(c*6for c in"Good morning, Green orb!")

Try it online!
Python 2, 70*5 = 350
lambda:"".join(c*5for(c)in"Gxxd mxrning, Green xrb!".replace('x','o'))

Try it online!
Thanks to @Mr. Xcoder for saving a byte from both versions!

You can remove the space between 6 and for.

57*4=228

@ovs that's not quite right, I think you need two \x6fs which is still good for 244

V, 35 bytes * 2 = 70
IG²od morning, GreeN ORb!5h3~Óˆ/°°

Try it online!
Hexdump:
00000000: 4947 b26f 6420 6d6f 726e 696e 672c 2047  IG.od morning, G
00000010: 7265 654e 204f 5262 211b 3568 337e d388  reeN ORb!.5h3~..
00000020: 2fb0 b0                                  /..

SOGL V0.12, 16 bytes * 1 = 16
7n]ēæ¬⁹≡qa╔αXE‘⁽

Try it Here!
Compression!
Though, if Green wasn't capitalized like that, this could be 3 bytes shorter :/

Clean, 77 bytes * 3 = 231
import StdEnv
f=[[b,b..]%(0,2)\\a<-:"Qyyn*wy|xsxq6*Q|oox*\171|l+",b<-[a-'
']]

Try it online!

Ohm v2, 20 bytes * 1 = 20
”1Gäåa¬Î|òÙγy[õ↕~LzN

Try it online!
Gotta love compression, although unfortunately it's not as good as SOGL's.

CJam, 32 bytes × 2 = 64
"Gnmg$hiuf`dl -I}ut|3orb!"K,.^:_

Try it online!
Pushes a string, then XORs the first 20 character with [0, 1, …, 19], then duplicates each character.

PowerShell, 49*5 58 bytes * 4 = 232 pts
-13 pts thanks to ASCII-only

-join("Good m{0}rning, Green {0}rb!"-f'o'|% t*y|%{"$_"*4})

Try it online!
Uses formatting to go from 5 os to 4 to chip out some numbers

232?

close

05AB1E, Score: 22 (22 bytes * 1)
…‚¿•´,„ˆ¨èã).ªðý23£'!«

Try it online.
Explanation:
NOTE 1: The wrap stack into list builtin ) is used instead of the builtin pair ‚, because the ‚ is already part of the dictionary word good.
NOTE 2: The two commas in the code ‚ and , may look the same, but are different unicode characters. The first one is usually used for the builtin pair, and the second for the builtin print to STDOUT with trailing newline. In this case they are used for the dictionary word good, and the expected comma in the output however.
…‚¿•´,        # 3-word dictionary string "good morning," (the comma counts as the third word)
„ˆ¨èã         # 2-word dictionary string "green orbit"
)             # Wrap everything on the stack into a list: ["good morning,","green orbit"]
 .ª           # Sentence capitalize all strings: ["Good morning,","Green orbit"]
   ðý         # Join by spaces: "Good morning, Green orbit"
     23£      # Only leave the first 23 characters: "Good morning, Green orb"
        '!«  '# Append a "!": "Good morning, Green orb!" (and output the result implicitly)

See this 05AB1E tip of mine (section How to use the dictionary?) to understand why …‚¿•´, is "good morning," and „ˆ¨èã is "green orbit".

PowerShell, 46 bytes * 4 = 184 points
"Good morning, Green orb!"-replace'.',('$0'*4)

Try it online!

That's clever. I completely forgot about $0

:| wait i tried this but only after doing the format so it didn't work as well as this did

¯\(ツ)/¯ what about TIO link?

Vyxal, 19 bytes, score 38
‛ƛ⁋`øø, ×ŀ ⋎Ė!`"Ṅ2•

Try it Online!
‛ƛ⁋                 # Compressed string
   `øø, ×ŀ ⋎Ė!`     # Compressed string
               "Ṅ   # Pair and join by spaces
                 2• # Double each character

Am I foolish, or is space thrice present?

@thejonymyster slaps face fixing

@thejonymyster Fixed.

nice 38 score :D

JavaScript (ES6), 61 bytes * 3 = 183
_=>'Good morning, Gr\145en \x6f\x72b!'.replace(/./g,"$&$&$&")

f=
_=>'Good morning, Gr\145en \x6f\x72b!'.replace(/./g,"$&$&$&")
console.log(f())

JavaScript (ES6), 51 bytes * 4 = 204
_=>'Good morning, Green orb!'.replace(/./g,'$&$&$&$&')

Answer suggested by @ETHproductions.

f=
_=>'Good morning, Green orb!'.replace(/./g,'$&$&$&$&')
console.log(f())

JavaScript (ES6), 73 bytes * 4 = 292
_=>`G00d mo1ning, G244n orb!`.replace(/./g,_=>(('o'+!0)[_]||_).repeat(4))

f=
_=>`G00d mo1ning, G244n orb!`.replace(/./g,_=>(('o'+!0)[_]||_).repeat(4))
console.log(f())

JavaScript (ES6), 58 bytes * 6 = 348
_=>'Good morning, Green orb!'.replace(/./g,_=>_.repeat(6))

f=
_=>'Good morning, Green orb!'.replace(/./g,_=>_.repeat(6))
console.log(f())

Alternatively, change _=>_ to '$&'

Alternaternatively, I think you can just do '$&$&$&$&$&$&' for the replacement, which then I think allows you remove two instances and go down to having several characters tied at 4, drastically reducing the score...

@ETHproductions Thanks, didn't know about that replacement pattern!

Jelly, 31 bytes × 2 = 62 points
“2ðƈZ(Øṡdȷ¿Ɱ’ṃ“God mrnig,eb!”x2

Try it online!
Explanation
“2ðƈZ(Øṡdȷ¿Ɱ’ṃ“God mrnig,eb!”x2
“2ðƈZ(Øṡdȷ¿Ɱ’                     Base 250 number
              “God mrnig,eb!”     Unique characters of "Good morning..."
             ṃ                    Convert the base 250 number in base 13 then index into the string "God mr..."
                             x2   Repeat each character twice because “ occurs twice in the source (and now 2)

Retina, 36×4=144

Good morning, Green orb!
.
$&$&$&$&

Try it online! There are three newlines and four os, so there's nothing more to be done.

Pushy, 36 * 2 = 72
`GXVWOP^4W_[afdc\hiB`N$29+L-''.

Try it online!
The main principle of this answer is that each character n is stored as n + index - 29 in order to avoid the repetition in the original string. This mapping created the string in the backticks. The rest of the program simply decodes this and prints each character twice:
` ... `              \ Push the encoded string
       N             \ Remove printing delimiter
        $            \ While there are items left on stack:
         29+         \   Add 29 to top of stack
            L-       \   Subtract current length from top of stack
              ''.    \   Print twice, then pop

Bytes used twice: `'W
Changelog

Golfed length from 41 to 38, by changing decoding method.
Golfed length from 38 to 37 by subtracting 29 from each encoded character to prevent multibyte characters.
Golfed length from 37 to 36 by using implicit 'end loop'

Ruby, 55x4 = 220 points
"Good morning, Green orb!".split(//).each{|x|print x*4}

Im quite annoyed that using each_char makes the count of r's 5..

brainfuck, 414 * 163 = 67,482
-[>-<---]>-------->>>-[>+>+>+>>+>+>+>+>+>+>+>>>+>+>+>+>+>>+>+>++<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<-----]<-[>+<-------]>-->+++++++++>+++++++++>-->------------------->+++++++>+++++++++>++++++++++++>++++++++>+++>++++++++>+>------->------------------->------------------------------->++++++++++++>->->++++++++>------------------->+++++++++>++++++++++++>---->>++++[<++++++++>-]<+[<]>[<<<[>+>+<<-]>>[->.<]>[-]>]

Try it online!
I'm not very good at brainfuck so this is likely far from optimal, but it works.
Explanation
The first part is
-[>+>+>+>>+>+>+>+>+>+>+>>>+>+>+>+>+>>+>+>++<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<+<-----]<-[>+<-------]>-->+++++++++>+++++++++>-->------------------->+++++++>+++++++++>++++++++++++>++++++++>+++>++++++++>+>------->------------------->------------------------------->++++++++++++>->->++++++++>------------------->+++++++++>++++++++++++>---->>++++[<++++++++>-]<+[<]>

This writes the charcodes for
Good morning, Green orb!

to memory in order.  It is certainly the place that could use the most optimization.
Then we have
[<<<[>+>+<<-]>>[->.<]>[-]>]

Which goes and prints off each character as many times as we tell it.  Since there are 163 pluses in the program we tell it to print each character 163 times.
-[>-<---]>--------

Standard ML (MLton), 84*5=420 83 bytes * 5 = 415
map(fn$ =>map(fn _=>print(str$))[0,2,3,4,5])(explode"Good mor\110ing, Green orb!");

Try it online!

Alternative approach (same score)
String.map;it(fn c=>(print(it(fn _=>c)"vwxyz");c))"Good mor\110i\110g, Green orb!";

Try it online!

Noether, 42 bytes * 4 = 168
"Good morning, Green orb!"~sL(si/4*Pi1+~i)

Outputs:
GGGGoooooooodddd    mmmmoooorrrrnnnniiiinnnngggg,,,,    GGGGrrrreeeeeeeennnn    oooorrrrbbbb!!!!

Try it online!

05AB1E, 22 bytes * 2 = 44
”‚¿•´,ˆ¨ orb!”'m5ǝ2иζJ

Try it online!

If I am able to output title-cased:
05AB1E, 13 bytes
”‚¿•´,ˆ¨ Orb!

Try it online!
Please note, CP-1252 ‚ is not a comma, therefore there are no dupes.

><>, 41 bytes x 7 = 287
|v"Good morning, Green orb!"
o\! !\:::|oo

Try it online!
As 'o' is used as the print character, this uses some mirrors to reuse them for printing.

@HeebyJeebyMan completely forgot to add that on, changed it now thanks :)

44*3

Perl 6, 3 * 54 bytes = 162
<<"G{q`o`x 2}d"morning,'Green'orb!>>~~say S:g{.}=$/x 3

Try it online!
I started off with the normal:
"Good morning, Green orb!"~~(S:g{.}=$/x 4).say

Which simply replaces each letter by 4 copies of itself and prints. The mode characters were the spaces and the os, so I changed the string part to a word quote with interpolation:
<<Good morning,'Green'orb!>>~~say S:g{.}=$/x 4

This decreased the spaces down to 3. Next was the o, which I decided to double in the oo part of Good.
<<"G{q`o`x 2}d"morning,'Green'orb!>>~~say S:g{.}=$/x 4

This involved wrapping the Good in interpolating quotes of its own, then having to use a custom quoting construct to do the o character, since the quote characters were taken.

AWK, 57 bytes × 4 = 228
END{$0="Good morning, Green orb!";gsub(/./,"&&&&");print}

Try it online!

saved 2 bytes and 8 points assuming empty input

K (oK), 35 bytes * 4 = 140
Solution:
`0:,/4#'"Good morning, Green orb!";

Try it online!
Explanation:
Nothing fancy here, the most common letter is o which occurs 4 times.
`0:,/4#'"Good morning, Green orb!"; / the solution
        "Good morning, Green orb!"  / the string to be displayed
     4#'                            / 4 take (#) each (') repeats each character 4 times
   ,/                               / flatten these lists
`0:                               ; / print to stdout (`0:) and swallow return value (;)

Swift, 53*3=159 bytes
{"Good morning, Green \u{6f}rb!".flatMap{[$0,$0,$0]}}

Try it online!

Java 11, score: 455 (91 bytes * 5)
x->{for(var s:"G\157od mo\162ning, G\162een orb!".split(""))System.out.print(s.repeat(5));}

The e, o, r, and t are all four used 5 times.
Try it online.
Explanation:
x->{                     // Method with empty unused parameter and no return-type
  for(var s:"G\157od mo\162ning, G\162een orb!"
                         //  Push String "Good morning, Green orb!"
            .split(""))  //  And loop over its characters as Strings
    System.out.print(s   //   Print the current character
      .repeat(5));}      //   Repeated 5 times

Pip, 42*4 = 168
a:"Good morning, Green orb!"Fi,#a{L4O(ai)}

Try it online!

Julia, 59 × 3 = 177
map(y->print(y^3),["Good morning, G\x72ee\x6E \x6Frb!"...])

Try it online!

Excel, 60x4 = 240
=CONCAT(REPT(MID("Good morning, Green orb!",ROW(1:24),1),4))

Zsh + sed, 61 × 2 = 122
sed<<.�"s$?.$?&&0g"|tr�{A-Z,AG\ d-z}
BOoDCmORniNg,CBREen orb!

Attempt This Online!
� represents tabs.
Getting a good score without sed seems pretty hard.

Uiua, 32 bytes×4 os=128 points
&p♭⍉↯4"Good morning, Green orb!"

Test pad
On stdout:
GGGGoooooooodddd    mmmmoooorrrrnnnniiiinnnngggg,,,,    GGGGrrrreeeeeeeennnn    oooorrrrbbbb!!!!


text:
Play tic-tac-toe and never lose
(There exists some challenges that require to use the best strategy, but here we don't. Even if you are able to win, you are allowed to make a tie)
Challenge
Write a program which plays the game tic-tac-toe. It must not lose (therefore, it should end the game either with a tie or by winning).
Allowed I/O methods

Input may be the current board. You can assume that all previous moves of the 2nd player were played by your engine.
Input may be the first player's moves, and your function stores which moves happened in the past. In this case the function is called multiple times, once for each move; or the function/program prompt input for multiple times.
You are allowed to take an extra input saying if you are the first player, or write two (possibly related) functions to solve the first-player problem and the second-player one. If your program need use the input method 2 (multiple call), you can decide what is passed in the first call.
Output may be the board after your turn.
Output may be your move.
A move may be represented as a pair of numbers (can be 0-indexing or 1-indexing), a number in range 0~8, or a number in range 1~9.
The board may be represented as a 3×3 array, or an array of length 9. Even if the language have 0-indexing array, you can use 1-indexing.
The cells on the grid may use any 3 different values to indicate X, O and empty.

Winning criteria
Shortest code in each language win.

If a losing is given to you then your solution is invalid. You are playing with other, so the chessboard won't instantly change, so we can assume that all previous moves of the 2nd player were also played by our engine

Why the In this case you can have a reset function or reset when the game is over part is removed? Function need to be called for multiple times, don't it?

https://xkcd.com/832/

@l4m2 Just restart the interpreter. Done. Why bother with it? It just unnecessarily increase the byte count for nothing.

As a reminder, you should not change the challenge in the comment.

'll change the problem when change is decided. Pure explanation that also exist in the problem doesn't lead to editing prob, either

Is it acceptable to provide an interactive program that repeatedly prompts the player for their move, each time outputting the program's counter move in response? I think that is the intent of option 2 of the allowed I/O, but it isn't entirely clear to me.

@James Holderness Yes you can. The original contain doesn't say "call for multiple times", and someone changed it.

Don't do the bonus. Either require it or remove it, don't make it optional. The bonus ruins the challenge..

@Bruce Forte The program uses best stragety, but the other player may not

I guess that's what bonus do. I change it into "need to handle both, but can be two function "

Befunge, 181 168 bytes
>>4&5pp20555>>03>16p\::5g8%6p5v
 ^p5.:g605$_ #!<^_|#:-1g61+%8g<
543217539511|:_^#->#g0<>8+00p3+5%09638527419876
v<304p$_v#:->#$$:2`#3_:^
>#\3#13#<111v124236478689189378

Positions on the board are numbered 1 to 9. By default you get the first move, but if you want to allow the computer to go first, you can just enter 0 for your first move. When you've made a move, the computer will respond with a number indicating their move.
There are no checks to make sure you don't enter a valid move, and there also no checks to see if anyone has won or lost. Once their are no more moves to be made, the program just goes into an infinite loop.
It's a bit difficult to test this online, since there are no online interpreters with interactive input. However, if you know what moves you're going to make in advance (which assumes you know how the computer is going to respond), you can kind of test on TIO with those moves preprogrammed.
User plays first: Try it online!
Computer plays first: Try it online!
To makes it easier to see what's going on, I've also got a version that outputs the board between moves.
User plays first: Try it online!
Computer plays first: Try it online!
Note that you'll have to wait for TIO to timeout before you can see the results.
Explanation
The board is stored in the Befunge memory area as a flat array of 9 values, indexed from 1 to 9. This lets us use the zero offset as a special case "no move" when we want to let the computer play first. Player moves are stored as 4, and computer moves as 5. To start with all positions are initialised to 32 (the Befunge memory default), so whenever we access the board we mod with 8, so we'll get back either 0, 4 or 5.
Given that arrangement, if we sum the values of any three positions on the board, we know that the computer is one move away from winning if the total is 10, the player is one move away from winning if the total is 8, and the positions are shared between computer and player (but still one position is free) if the total is 9.
Our entire strategy is based around this concept. We have a routine that takes a list of triples indicating sets of three positions on the board, we calculate the sum of those positions, and if the sum equals a certain total, the computer moves to whichever of the positions in the set is free.
The main list of triples that we test are the winning combinations (1/2/3, 1/5/9, 1/4/7, etc.). We first look for a total of 10 (the computer is about to win), and then a total of 8 (the player is about to win and we need to block that move). Less obviously, we also check for a total of 9 (if the player and computer each have one of the positions, it's a good strategy for the computer to take the third).
Prior to that last scenario, the other strategic move we make is to check all the corner sets (1/2/4, 2/3/6, etc.) as well as two opposing corner combinations (1/8/9 and 3/7/8). If any of these combinations sum to 8, i.e. the player has taken two of the positions, it's a good strategy for the computer to take the remaining free position.
Finally, there are a two special case moves. First, we always try and take the center position before any other move. This is achieved with the same routine as all our other moves, just passing in a single triple, 5/5/5, and a target sum of 0. Additionally, if all other test have failed to find a move, we try to take one of the top corners as a last resort. Again this is simply achieved by testing the triples 1/1/1 and 3/3/3, with a target sum of 0.
I don't think this is necessarily a perfect strategy - there may be games that the computer draws which could potentially have been won - but it's good enough to never lose a match. I've run a test script that tried to play every possible move against the computer, and for every valid sequence of moves, the computer either won or drew the game.

I don't quite know Befunge, but maybe you can go test all possible input (Sample)

@l4m2 FYI, I have now run a test script that tried every possible move against the computer and can confirm that it never loses.

Python 3, 18 bytes
lambda a:a+a%2*2-1

Try it online!
This brilliant AI will always force a tie, and sometimes win if you let it.
The grid is numbered in a spiral, like so:
1 2 3
8 9 4
7 6 5

and the computer always goes first. For the first move, input "10". This is a little redundant because it always goes in the same place, but it's already built into the algorithm so ¯\_(ツ)_/¯
By going in the middle first, the game is essentially converted into 1 dimension, with the only way to win being 3 in a row along the sides. The divides all of these remaining 8 squares into pairs, and always goes in the other square in the pair. For example, if you go in square 1, it goes in square 2. If you go in square 2, it goes in square 1. The nice thing about this system is that it will never make an illegal move, as well as never losing.
This was actually from a magic trick invented by Martin Gardner, where you can predict the outcome of a game of tic-tac-toe. Every game ends the exact same, including rotation, or the computer wins. It "never loses".
This is definitely my favorite solution to a code golf that I ever have found, and probably ever will find.

Why not number the middle one 1 and therefore a xor solves? Anyway question require ability to let player go first so this is not a correct answer

@l4m2 god damn it, how did I not see that...I spent so long trying to find a more efficient way that just mod :p I bow down to thee superior coding skill

Python 2: 399 401 349 333 317 370 bytes
2x Bug Fix: credit to l4m2
-52 chars: credit to undergroundmonorail
-16 chars: credit to Jonathan Frech
-26 chars: credit to user202729
def f(b):
 t=4,9,2,3,5,7,8,1,6;n=lambda k:[t[i]for i,j in enumerate(b)if j==k];p,o,a,I=n(2),n(1),n(0),t.index
 for i in p:
    for j in p:
     for k in a:
        if i+j+k==15and-j+i:return I(k)
 for i in o:
    for j in o:
     for k in a:
        if i+j+k==15and-j+i:return I(k)
 for i in 9,3,7,1:
    if i in a and 5 in p:return I(i)
 for i in 5,4,2,8,6:
    if i in a:return I(i)
 return I(a[0])

Try it Online!
On the first day of a linear algebra course I took last semester, my astute graduate student instructor proposed that if you represent the tic-tac-toe board as the the matrix:
4 | 9 | 2
--+---+--
3 | 5 | 7
--+---+--
8 | 1 | 6

then getting three in a row is equivalent to picking three numbers in the range [1,9] that add up to 15. This answer exploits this idea.  The function takes a list containing nine numbers representing the board.  0 indicates an empty space, 1 is occupied by the opponent, and 2 represents a previous play made by the program.  The first 3 lines figure out what numbers the program has picked (p), the opposition has picked (o), and are still available (a).  It then looks through the available numbers and sees if any of them, combined with two numbers it has already picked add to fifteen.  If it does, it will pick that square and win.  If there are no immediate winning moves, it will check to see if the opponent can win using the same method.  If they can, it will take their winning square.  If there is neither a winning nor blocking move available, it will move in a corner.  This prevents a fools mate:
- - -
- X -
- - -

- O -             # Bad Move
- X -
- - -

- O X
- X -
- - -

- O X
- X -
O - -

- O X
- X -
O - X

If none of these situations occur, it will choose a square arbitrarily.  The function outputs a number [0,8] representing the 0 indexed square chosen by the algorithm.
Edit: The algorithm now prioritizes the center over the diagonal, which will prevent another fools mate possibility pointed out by l4m2 and related strategies.
Edit: To clarify, the function takes in a board in the form of an array and outputs a move as an integer on [0,8].  Because this I/O strategy is so clunky , here's a wrapper script that makes it more interactive.  It takes a single command line argument, which should be 1 if the player goes first, and 0 if the program goes first.
import sys

def f(b):
 t=4,9,2,3,5,7,8,1,6;n=lambda k:[t[i]for i,j in enumerate(b)if j==k];p,o,a,I=n(2),n(1),n(0),t.index
 for i in p:
    for j in p:
     for k in a:
        if i+j+k==15and-j+i:return I(k)
 for i in o:
    for j in o:
     for k in a:
        if i+j+k==15and-j+i:return I(k)
 for i in 9,3,7,1:
    if i in a and 5 in p:return I(i)
     for i in 5,4,2,8,6:
        if i in a:return I(i)
 return I(a[0])

board = [0,0,0,0,0,0,0,0,0]
rep = {0:"-",1:"X",2:"O"}

turn = int(sys.argv[1])
while True:
    for i in range(3):
        print rep[board[i*3]]+" "+rep[board[i*3+1]]+" "+rep[board[i*3+2]]
        print
    if turn:
        move = int(raw_input("Enter Move [0-8]: "))
    else:
        move = f(board)
    board[move] = turn+1
    turn = (turn+1)%2

Hacked

All your return lines except the last one can be put on the line before them, saving whitespace

Also I can't help but wonder if it would save bytes to, instead of doing e=enumerate, do f=lambda n:[t[i]for i,j in enumerate(b)if j==n] and assign p, o and a using the function. Haven't counted it though

333 bytes.

Still hacked. https://xkcd.com/832/ really helps

Hacked 3

Python 3: 341 bytes
So, my first attempt of code golfing, nice challenge! I thought of something similar myself with a complete game in mind though. Here is the AI code:
def e(b,t):return any([b[i]==b[i+d]==b[i+2*d]==t for i,d in((0,1),(3,1),(6,1),(0,3),(1,3),(2,3),(0,4),(2,2))])
def n(b,t,d=8):
    if e(b,t):return 0,1
    if e(b,-t):return 0,-1
    if all(b):return 0,0
    x=-2
    for m in range(9):
        if b[m]==0:
            b[m]=t;s,b[m]=-n(b,-t,d-1)[1],0
            if s>x:x,y=s,m
    return y,x

Try online
Try the code here.

Input/output
Function n takes a 1D array as input where X and O are represented by 1 and -1, and empty squares by 0. Example board:
b = [0, 1, 0, -1, 0, -1, 0, 0, 1]

equals
[' ', 'X', ' ']
['O', ' ', 'O']
[' ', ' ', 'X']

It then outputs the best move (board index 0 to 8) for the given player along with its evaluation:

Score = 1: Current player wins
Score = -1: Other player wins
Score = 0: Draw if both players play perfectly
\

Explanation
Function 'n' is a Negamax framework where it goes through the entire tree of possible solutions from the given board state until the game is finished (a player wins or board is full). For each possible move it goes depth first and checks all possible outcomes of that move until the end.
If the score from a move is larger than the current best (set to -2 as default to always get a better move to play) the best score and best move is updated. At the end the best move and score is returned.
\
Commented code
# Checks if the given player has 3 in a row and returns 1 if so
def evaluate(board,turn):
    for i, d in (0,1),(3,1),(6,1),(0,3),(1,3),(2,3),(0,4),(2,2):
        if board[i]==b[i+d]==b[i+2*d]==turn: return 1

# Negamax recursive function
def negamax(board, turn, depth=8):

    # Checks if player or opponent has won
    if evaluate(board,turn): return 0,1
    if evaluate(board,-turn): return 0,-1

    # Checks if board is full
    if all(board): return 0,0

    # Goes through all possible moves in the board (available spots)
    best_score = -2
    for index in range(9):
        if board[index]==0:

            # Make the move, evaluate position, and unmake the move
            board[index] = turn
            score = -negamax(board, -turn, depth-1)[1]
            board[index] = 0

            # If score was better than previous best score, update best score and move
            if score > best_score:
                best_score, best_move = score, index

    # Return best move and score after it has gone through all possibilities
    return best_move, best_score


text:
Approximate definite integrals using Riemann sums
Left and right Riemann sums are approximations to definite integrals. Of course, in mathematics we need to be very accurate, so we aim to calculate them with a number of subdivisions that approaches infinity, but that's not needed for the purposes of this challenge. You should instead try to write the shortest program, taking input and providing output through any of the default methods, in any programming language, which does the following:
Task
Given two rational numbers \$a\$ and \$b\$ (the limits of the definite integral), a positive integer \$n\$, a boolean \$k\$ representing left / right and a black-box function \$f\$, calculate the left or right Riemann sum (depending on \$k\$) of \$\int_a^b f(x)\mathrm{d}x\$, using \$n\$ equal subdivisions.
I/O Specs

\$a\$ and \$b\$ can be rational / floating-point numbers or fractions.
\$k\$ can be represented by any two distinct and consistent values, but please keep in mind that you aren't allowed to take complete or partial functions as input.
\$f\$ is a black-box function. Citing the meta answer linked above, the content (i.e. the code) of black-box-functions may not be accessed, you can only call them (passing arguments if applicable) and observe their output. If needed, please include the necessary information about the syntax your language uses such that we can test your submission.

As output, you must provide a rational / floating-point / fraction representing the Riemann sum you are asked for. As discussed in the past, floating-point imprecision can be ignored, as long as your output is accurate to at least three decimal places when rounded to the nearest multiple of 1 / 1000 (e.g. 1.4529999 is fine instead of 1.453).
Math Specs

\$f\$ is guaranteed to be continuous between \$a\$ and \$b\$ (no jumps, no holes, no vertical asymptotes).
There are three possible cases you have to handle: \$a = b\$ (The result should be \$0\$ or its equivalents), \$a < b\$ or \$a > b\$.
If \$b < a\$, the integral changes its sign. Also, the right sense of the integral in this case is towards \$a\$.
Areas under the graph are negative and those above the graph are positive.

Examples / Test Cases
The resolution is not optimal, because I had to shrink them down a bit, but they're still readable.

\$f(x) = 2x + 1,\: a = 5,\: b = 13,\: n = 4\$, k = right:

The result should be \$15 \cdot 2 + 19 \cdot 2 + 23 \cdot 2 + 27 \cdot 2 = 168\$, because the width of each rectangle is \$\frac{|b - a|}{n} = 2\$ and the corresponding heights are \$f(7) = 15,\:f(9) = 19,\:f(11) = 23,\:f(13) = 27\$.
\$f(x)=\sqrt{x},\: a = 1,\: b = 2.5,\: n = 3\$, k = left:

The output should be \$1.8194792169\$.
\$f(x) = -3x + 4 + \frac{x^2}{5},\: a = 12.5,\: b = 2.5,\: n = 10\$, k = right:

The expected output value is \$- (- 4.05 - 5.45 - 6.45 - 7.05 - 7.25 - 7.05 - 6.45 - 5.45 - 4.05 - 2.25) = 55.5\$, because the integral changes signs when flipping the boundaries (\$b<a\$).
\$f(x) = 9 - 4x +  \frac{2x^2}{7},\: a = 0,\: b = 15,\: n = 3\$, k = left:

Calculating our Riemann sum, we get \$13.5714285715\$.
\$f(x) = 6,\: a = 1,\: b = 4,\: n = 2\$,  k = right — Output: \$18\$.
\$f(x) = x^7 + 165x + 1,\: a = 7,\: b = 7,\: n = 4\$, k = left — Output: \$0\$.
\$f(x) = x \cdot \sin(x^{-1}),\: a = 0,\: b = 1,\: n = 50\$, k = right — Output: \$0.385723952885505\$. Note that sine uses radians here, but feel free to use degrees instead.

Special thanks: This challenge has been posted in the Sandbox, where it received valuable feedback from user202729, AdmBorkBork and Leaky Nun.

I sure hope the solutions here help many years' worth of Calc I students...

f(x) = x * sin(1 / x); a = 0; b = 1; n = 50; k = right — Output: 0.385723952885505. Note that sine uses radians here, but feel free to use degrees instead. Now that f(x) is a black box why does it matter?

@l4m2 It doesn’t matter much, just wanted to let people know that they shouldn’t worry about such things.

@Giuseppe No. The methods of programs here are even worse than methods of handheld calculators. [just saying]

@user202729 yeah I guess I was just projecting how boring I found it to compute Riemann sums by hand in Calc I. Gotta do a midpoint/trapezoid/Simpson's method challenge next!

R, 69 65 63 57 bytes
function(a,b,n,k,f,w=(b-a)/n)sum(sapply(a+w*(1:n-k),f))*w

Try it online!
Takes k=FALSE for right-hand sums, although the TIO link now includes aliases for "left" and "right" for ease of use.
a+w*(1:n-k) generates appropriate left- or right-hand points.
Then sapply applies f to each element of the result, which we then sum up and multiply by the interval width (b-a)/n to yield the result. This last also neatly takes care of any sign issues we might have.

SNOBOL4 (CSNOBOL4), 127 bytes
	DEFINE('R(a,b,n,k,p)')
R	l =(b - a) / n
	i =1
l	R =R + eval(p '(a + l * (i - k))')
	i =lt(i,n) i + 1	:s(l)
	R =R * l :(return)

Try it online!
Assuming that the function p is defined somewhere, this takes a,b,n,k,(name of p), with k=0 for right and l=1 for left.
catspaw's SNOBOL4+ supports REALs but doesn't have builtin trig functions. However, I suppose one could come up with a reasonable sin function using a taylor series.
I'm not 100% sure this is the "right" way to pass a black-box function in SNOBOL (which, to my knowledge, doesn't have first-class functions), but it seems reasonable-ish to me.
I suppose that assuming the function is defined as f would be shorter, as line l could be
l	R =R + f(a + l * (i - k))
but then it's not passed as an argument, which feels a bit like "cheating".
Note that the TIO link has a :(e) after the DEFINE statement, which is so that the code will actually run properly.

Julia 0.6, 50 bytes
R(f,a,b,n,k)=(c=(b-a)/n;sum(f.(a+[k:n+k-1...]c))c)

Try it online!
A normalized range is constructed, collected into a vector and then scaled. Collecting the range into a vector using [X...] is necessary to avoid the inexact error when multiplying the range directly with 0 when a=b. Similarly, constructing a range directly with : or range() is not possible when a=b.
The usage of k is very similar to the solution of Guiseppe, with k=1 for right and k=0 for left.

f. vectorizes f over its argument(s)?

@Giuseppe: Exactly. f. is element-wise application of f.

Haskell, 73 67 bytes
Thanks to H.PWiz and Bruce Forte for the tips!
(f&a)b n k|d<-(b-a)/realToFrac n=d*sum(f<$>take n(drop k[a,a+d..]))

Try it online!
Pretty straightforward solution.
k is 0 for left and 1 for right.

If your are taking n, you don't need to go up to b

Jelly, 21 bytes
ƓḶ+Ɠ÷
IḢ×¢A+ṂɠvÐ€Æm×I

Try it online!
Take a,b from arguments, and
n
right
f

from stdin.

If you are not familiar with Jelly, you can use Python to write the black box function f:
f(x) = 2x + 1; a = 5; b = 13; n = 4; k = right
f(x) = √x; a = 1; b = 2.5; n = 3; k = left
f(x) = -3x + 4 + 1/5 * x2; a = 12.5; b = 2.5; n = 10; k = right
f(x) = 9 - 4x + 2/7 * x2 ; a = 0; b = 15; n = 3; k = left
f(x) = 6; a = 1; b = 4; n = 2; k = right
f(x) = x * sin(1 / x); a = 0; b = 1; n = 50; k = right

Explanation:

ƓḶ+Ɠ÷     Helper niladic link.
Ɠ         First line from stdin. (n). Assume n = 4.
 Ḷ        Lowered range (unlength). Get [0, 1, 2, 3].
  +Ɠ      Add second line from stdin (k). Assume k = 1 (right).
            Get [1, 2, 3, 4].
    ÷     Divide by (n). Get [0.25,0.5,0.75,1].

IḢ×¢A+ṂɠvÐ€Æm×I   Main monadic link. Take input `[a, b]`, assume `a=2,b=6`.
IḢ                `a-b`. Get `-4`.
  ×¢              Multiply by value of niladic link above. Get `[-1,-2,-3,-4]`.
    A             Absolute value. Get `[1,2,3,4]`.
     +Ṃ           Add min(a, b) = 2. Get `[3,4,5,6]`.
        vÐ€       For each number, evaluate with...
       ɠ            input line from stdin.
           Æm     Arithmetic mean.
             ×I   Multiply by `a-b`.

Python 2, 99 94 bytes
A bit of a naive solution.
def R(f,a,b,n,k):s=cmp(b,a);d=s*(b-a)/n;return s*sum(d*f([0,a,b][s]+i*d)for i in range(k,n+k))

Try it online!

94 bytes in Python 2

For some reason I thought we had to handle integer input. Thanks.

JavaScript (Node.js), 73 71 59 bytes
(a,b,n,k,f)=>(g=i=>i--&&g(i)+f(a+k++/n)/n)(n,k^=a>b,n/=b-a)

Try it online!

Perl 6, 65 bytes
{my \d=($^b-$^a)/$^n;sum ($a,*+d...*)[($^k+^0>d)+ ^$n]».&^f X*d}

Try it online!
Relatively straightforward.  The only complication is handling the a > b case, which I do by xor-ing the input flag $^k with 0 > d, which inverts it when a > b.

05AB1E, 22 bytes
L<+¹/I`α©*³ß+Iδ.VÅA®*Ä

Inputs in the order \$n\$, \$k\$, \$[a,b]\$, \$f\$, with \$k\$ being 1 for right and 0 for left.
Try it online or verify all test cases.
Explanation:
L                      # Push a list in the range [1, (implicit) input n]
 <                     # Decrease each by 1 to make the range: [0, n)
  +                    # Add the (implicit) input k to each
   ¹/                  # Divide each by the first input n
     I                 # Push the next input [a,b]
      `α               # Push both separated to the stack, and take their absolute difference
        ©              # Store this in variable `®` (without popping)
         *             # Multiply it to each value in the list
          ³ß           # Push the third input [a,b] again, and pop and push its minimum
            +          # Add it to each value in the list
              δ        # Apply to each value in the list,
             I         # using the next input f:
               .V      #  Evalutate the it as 05AB1E code
                 ÅA    # Then pop and push the arithmetic mean of the list
                   ®*  # Multiply it by |a-b| from variable `®`
                     Ä # And take the absolute value of this result
                       # (after which it is output implicitly)

APL (Dyalog Classic), 37 bytes
{(a b n k)←⍵⋄l←n÷⍨b-a⋄l×+/⍺⍺a+l×k+⍳n}

Try it online!
APL NARS, 37 chars
The function has the argument in the left the function, in the right numeric argument a b n k.
In the question k=left here it means k=¯1; k=right here it means k=0. Test:
  f←{(a b n k)←⍵⋄l←n÷⍨b-a⋄l×+/⍺⍺a+l×k+⍳n}
  {1+2×⍵} f 5 13 4 0
168
  {√⍵} f 1 2.5 3 ¯1
1.819479217
  {4+(¯3×⍵)+0.2×⍵×⍵} f 12.5 2.5 10 0
55.5
  {9+(¯4×⍵)+7÷⍨2×⍵×⍵} f 0 15 3 ¯1
13.57142857
  {6-0×⍵} f 1 4 2 0
18
  {1+(165×⍵)+⍵*7} f 7 7 4 ¯1
0
  {⍵×1○÷⍵} f 0 1 50 0
0.3857239529

Submissions are counted in bytes, not characters. I don't remember if NARS has a custom code page (so it would be also 37 bytes) or uses UTF16.

@Uriel It is 37 bytes in Dyalog APL classic follow the link; possibly 35x2 bytes for Nars Apl...

So why do you write it as NARS? Does NARS even has dfnss? By the way you can drop the first parents for 35 bytes

APL NARS, 37 chars means it should run in NARS APL too

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Rhombus sequence
Imagine enumerating the elements of rhombi which grow [1],[1,3,1],[1,3,5,3,1],… (only odd numbers such that they align nicely). This would look like as follows, note that you always begin enumerating with 1:
                   01
       1        02 03 04
 1   2 3 4   05 06 07 08 09          …
       5        10 11 12
                   13
(1) (1,3,1)    (1,3,5,3,1)    (1,3,5,7,5,3,1)   …

Now if you start summing the columns ([1],[2],[1,3,5],[4],[5],[2,6,10],…) you get the rhombus sequence. These are the first 100 elements of said sequence:
1,2,9,4,5,18,35,24,9,10,33,60,91,70,45,16,17,54,95,140,189,154,115,72,25,26,81,140,203,270,341,288,231,170,105,36,37,114,195,280,369,462,559,484,405,322,235,144,49,50,153,260,371,486,605,728,855,754,649,540,427,310,189,64,65,198,335,476,621,770,923,1080,1241,1110,975,836,693,546,395,240,81,82,249,420,595,774,957,1144,1335,1530,1729,1564,1395,1222,1045,864,679,490,297,100

IO
You are free to choose one of these three input/output methods (you won't need to handle invalid inputs):

Given an integer n output the nth element in that sequence (0- or 1-indexed, your choice)
Given an integer n output first n elements of that sequence
Print/return the sequence indefinetely

Testcases
Please refer to the first 100 terms above, here are some larger examples (1-indexed):
101 -> 101
443 -> 1329
1000 -> 49000
1984 -> 164672
2017 -> 34289
2018 -> 30270
3000 -> 153000

Snowman, 72 bytes
((}1vn2nD#`nPnCdU!*2nM1`nR:#nSNaB#`nS2nMNdE;aM|#NdE2nP+#`nSNdE`|aA#nM*))

This is a subroutine that takes 1-indexed input and returns the corresponding output via the permavar +.
Try it online!
((        // begin subroutine
 }        // we'll only need 3 variables - b, e, g
 1vn2nD   // b = 0.5
 #`       // retrieve input and swap, now b = input and e = 0.5
 nP       // power, resulting in b=sqrt(input)
 nC       // ceiling - this gives the index i of the rhombus we want
 dU!*     // keep a copy of i in the permavar ! for later use
 2nM1`nR  // generate the range [1, 2i)
 :        // map the following block over the range...
  #nS     // subtract i, resulting in e.g. [-3 -2 -1 0 1 2 3] for i=4
  NaB     // absolute value - [3 2 1 0 1 2 3]
  #`nS    // subtract from i, giving [1 2 3 4 3 2 1]
  2nMNdE  // double and decrement, [1 3 5 7 5 3 1]
 ;aM      // map
 |        // shove the rhombus columns into g
 #NdE2nP  // b = (i-2)^2
 +#`      // move b into e and replace it with the original input
 nSNdE    // subtract the two and decrement, giving input-(i-2)^2-1
 `|aA     // this is the index into the rhombus columns that we want
 #nM*     // multiply by the original input and return
))

This uses basically the same algorithm as Mr. Xcoder's answer—the only difference is that here we only generate the columns of the rhombus we need, which is the ceil(sqrt(n))th one. To illustrate why this works, here are the inputs that correspond to each rhombus:
rhombus #   inputs
1           1
2           2 3 4
3           5 6 7 8 9
4           10 11 12 13 14 15 16
...

Note that the left column corresponds exactly to the ceiling of the square root of each element in the right column. To get the 1-based index from here, we simply subtract the square of the index of the previous rhombus.

Jelly, 10 bytes
Ḥ€€’ŒBFị@×

Try it online!
A full program / monadic link returning the Nth term (1-indexed).

 I noticed that each sum is the index of that column in the overall list of columns (the input itself) multiplied by the index of that column in the corresponding Rhombus, so no need to actually generate the rows.

How?

Ḥ€€’ŒBFị@× ~ Full program. I'll call the input N.

  €        ~ For each integer X in the range [1, N].
Ḥ€         ~ Double each integer in the range [1, X].
   ’       ~ Decrement (subtract 1).
    ŒB     ~ Bounce (element-wise). Palindromize each.
      F    ~ Flatten.
       ị@  ~ Get the element at the index N in our list.
         × ~ Multiply by N.

Alternative.

JavaScript (ES7), 42 41 bytes
Saved 1 byte thanks to @ovs
0-indexed. A closed-form expression derived from A004737.
n=>((k=n**.5|0)-Math.abs(n+k*~k))*2*++n+n

Test cases

let f =

n=>((k=n**.5|0)-Math.abs(n+k*~k))*2*++n+n

console.log(f(101-1))  // 101
console.log(f(443-1))  // 1329
console.log(f(1000-1)) // 49000
console.log(f(1984-1)) // 164672
console.log(f(2017-1)) // 34289
console.log(f(2018-1)) // 30270
console.log(f(3000-1)) // 153000

Befunge, 62 60 bytes
&:1>:00p:*`|
00:-\*:g00:<>2-\-0v!`\g
*.@v+1<g00:<^*2g00_2*1+

Try it online!
Explanation

 We start by reading the one-based element number, n, from stdin, and saving a duplicate.
 Then we determine which rhombus we're in, by counting up an integer, r, until r*r >= n.
 The column offset from the right hand side of the rhombus, c, is r*r - n.
 To get that offset reflected around the centre axis, we check if c >= r.
 And if it is, then the reflected c becomes r*2 - 2 - c.
 Once we have the reflected c, the sum of the column is simply (c*2 + 1) * n.

APL (Dyalog), 18 bytes
{⍵×2×⌊/|⍵-.5+×⍨⍳⍵}

Try it online!

Jelly, 8 bytes
_.ạ²€ṂḤ×

Try it online!
How it works
_.ạ²€ṂḤ×  Main link. Argument: n

_.        Subtract 0.5; yield (n - 0.5).
   ²€     Square each; yield [1², 2², ..., n²].
  ạ       Take the absolute differences of (n - 0.5) and each of the squares.
     Ṃ    Take the minimum.
      Ḥ   Unhalve; double the minimum.
       ×  Multiply the result by n.

Husk, 13 bytes
*¹D▼mo≠-.¹m□ḣ

Try it online!
Similar to the existing Jelly and APL answers.

Japt, 12 bytes
Ñ*UÇ²a½nUÃrm

Try it
Ñ*UÇ²a½nUÃrm     :Implicit input of integer U
Ñ                :Multiply by 2
 *               :Multiply by
  UÇ             :  Map the range [0,U)
    ²            :    Square
     a           :    Absolute difference with
      ½          :      0.5
       nU        :      Subtracted from U
         Ã       :  End map
          r      :  Reduce by
           m     :    Minimum


text:
Disentangle doubly linked data
A doubly linked list is a data structure in which each node has a value as well as "links" to both the previous and next nodes in the list. For example, consider the following nodes with values 12, 99, and 37:

Here, the nodes with values 12 and 99 point to their respective next nodes, with values 99 and 37. The node with value 37 has no next pointer because it's the last node in the list. Likewise, the nodes with values 99 and 37 point to their respective previous nodes, 12 and 99, but 12 has no previous pointer because it's the first node in the list.
The setup
In practice, a node's "links" are implemented as pointers to the previous and next node's locations in memory. For our purposes, the "memory" will be an array of nodes and a node's location will be its index in the array. A node can be thought of as a 3-tuple of the form ( prev value next ). The above example, then, might look like this:

But it might look like this, instead:

Starting at any node, you can follow previous links (shown as the origins of the red arrows) to get to the nodes that precede it and next links (green arrows) to find subsequent nodes in order to get all of the nodes' values in order: [12, 99, 37].
The first diagram above could be represented in an array as [[null, 12, 1], [0, 99, 2], [1, 37, null]]. The second, then, would be [[2, 99, 1], [0, 37, null], [null, 12, 0]].
The challenge

Write a program that takes as input an array of nodes and the index of a node and returns, in list order, the values of the nodes in the same doubly linked list.

A complication
The "memory" won't always contain the nodes of just one list. It might contain several lists:

The above array contains three doubly linked lists, color-coded for your convenience:

The nodes at indexes 7, 10, 1, 4, 3, 12 (showing only next links to reduce clutter; click to enlarge):

Given this array and any of these indexes, your program should return, in order, the values [0, 1, 1, 2, 3, 5, 8].
The node at index 9:

Given the index 9, your program should return [99].
The nodes at indexes 11, 8, 0, 6, 2:

Given one of these indexes, it should return [2, 3, 5, 7, 11].

Rules
Input
Your program will receive as input:

A list of  nodes (3-tuples as described above), where 1 ≤  ≤ 1,000, in any convenient format, e.g. an array of arrays, a "flat" array of integers with length 3, etc.
The 3-tuples' elements may be in any order: ( prev value next ), ( next prev value ), etc. For each node, prev and next will be null (or another convenient value, e.g. -1), indicating the first or last node in a doubly linked list, or a valid index of the list, either 0- or 1-based as is convenient. value will be a signed 32-bit integer or the largest integer type your language supports, whichever is smaller.
The index  of a node in the list (1). The indicated node may be the first node in a doubly linked list, the last node, a middle node, or even the only node.

The input list (1) may contain pathological data (e.g. cycles, nodes pointed to by multiple other nodes, etc.), but the input index (2) will always point to a node from which a single, well-formed output can be deduced.
Output
Your program should output the values of the nodes of the doubly linked list of which the node at index  is a member, in list order. Output can be in any convenient format, but its data must include only the node values.
Winning
This is code-golf. Shortest answer in bytes wins. Standard loopholes apply.
Test cases
Below, each test case is of the form:
X)
prev value next, prev value next, ...
index
value value value ...

...where X is a letter to identify the test case, the second line is the input list, the third line is the 0-based input index, and the fourth line is the output.
A) null 12 1, 0 99 2, 1 37 null
   1
   12 99 37

B) 2 99 1, 0 37 null, null 12 0
   1
   12 99 37

C) 8 5 6, 10 1 4, 6 11 null, 4 3 12, 1 2 3, 12 8 null, 0 7 2, null 0 10, 11 3 0, null 99 null, 7 1 1, null 2 8, 3 5 5
   4
   0 1 1 2 3 5 8

D) 8 5 6, 10 1 4, 6 11 null, 4 3 12, 1 2 3, 12 8 null, 0 7 2, null 0 10, 11 3 0, null 99 null, 7 1 1, null 2 8, 3 5 5
   0
   2 3 5 7 11

E) 8 5 6, 10 1 4, 6 11 null, 4 3 12, 1 2 3, 12 8 null, 0 7 2, null 0 10, 11 3 0, null 99 null, 7 1 1, null 2 8, 3 5 5
   9
   99

F) 13 80 18, 18 71 null, 5 10 19, 12 1 8, 19 21 null, 31 6 2, 17 5 26, 26 0 30, 3 -1 25, null 1 23, 27 6 17, 14 1 24, 28 -1 3, null 80 0, 20 4 11, 33 6 29, 24 9 33, 10 7 6, 0 67 1, 2 15 4, 32 1 14, null 1 31, 29 3 null, 9 -1 28, 11 5 16, 8 1 null, 6 3 7, null 8 10, 23 1 12, 15 5 22, 7 9 null, 21 3 5, null 3 20, 16 2 15
   18
   80 80 67 71

G) 13 80 18, 18 71 null, 5 10 19, 12 1 8, 19 21 null, 31 6 2, 17 5 26, 26 0 30, 3 -1 25, null 1 23, 27 6 17, 14 1 24, 28 -1 3, null 80 0, 20 4 11, 33 6 29, 24 9 33, 10 7 6, 0 67 1, 2 15 4, 32 1 14, null 1 31, 29 3 null, 9 -1 28, 11 5 16, 8 1 null, 6 3 7, null 8 10, 23 1 12, 15 5 22, 7 9 null, 21 3 5, null 3 20, 16 2 15
   8
   1 -1 1 -1 1 -1 1

H) 13 80 18, 18 71 null, 5 10 19, 12 1 8, 19 21 null, 31 6 2, 17 5 26, 26 0 30, 3 -1 25, null 1 23, 27 6 17, 14 1 24, 28 -1 3, null 80 0, 20 4 11, 33 6 29, 24 9 33, 10 7 6, 0 67 1, 2 15 4, 32 1 14, null 1 31, 29 3 null, 9 -1 28, 11 5 16, 8 1 null, 6 3 7, null 8 10, 23 1 12, 15 5 22, 7 9 null, 21 3 5, null 3 20, 16 2 15
   4
   1 3 6 10 15 21

I) 13 80 18, 18 71 null, 5 10 19, 12 1 8, 19 21 null, 31 6 2, 17 5 26, 26 0 30, 3 -1 25, null 1 23, 27 6 17, 14 1 24, 28 -1 3, null 80 0, 20 4 11, 33 6 29, 24 9 33, 10 7 6, 0 67 1, 2 15 4, 32 1 14, null 1 31, 29 3 null, 9 -1 28, 11 5 16, 8 1 null, 6 3 7, null 8 10, 23 1 12, 15 5 22, 7 9 null, 21 3 5, null 3 20, 16 2 15
   14
   3 1 4 1 5 9 2 6 5 3

J) 13 80 18, 18 71 null, 5 10 19, 12 1 8, 19 21 null, 31 6 2, 17 5 26, 26 0 30, 3 -1 25, null 1 23, 27 6 17, 14 1 24, 28 -1 3, null 80 0, 20 4 11, 33 6 29, 24 9 33, 10 7 6, 0 67 1, 2 15 4, 32 1 14, null 1 31, 29 3 null, 9 -1 28, 11 5 16, 8 1 null, 6 3 7, null 8 10, 23 1 12, 15 5 22, 7 9 null, 21 3 5, null 3 20, 16 2 15
   17
   8 6 7 5 3 0 9

K) 4 11 0, null 22 3, null 33 3, 1 44 4, 3 55 null, 7 66 7, 6 77 6
   3
   22 44 55

L) null -123 null
   0
   -123

Sandbox link: https://codegolf.meta.stackexchange.com/a/14451/11261

Related: https://codegolf.stackexchange.com/questions/32687/convert-binary-search-tree-into-ordered-linked-list

Is input as three arrays (one containing all predecessor nodes in order, one values, and one successor nodes) allowed, or is that too far from the concept of tuples?

@Sanchises Sorry, too far for me.

That's all right! I thought so, but I wanted to be ahead of any comments on my answer saying I could shave off two bytes taking separate arrays.

05AB1E, 25 bytes
è[¬D0‹#Isè]\[`sˆD0‹#Isè]¯

Try it online!
Explanation
è[¬D0‹#Isè]\[`sˆD0‹#Isè]¯   # Arguments n, a
è                           # Get element at index n in a
 [¬D0‹#Isè]                 # Find the first element in the list
 [                          # While true, do
  ¬                         #   Head (get index of previous element)
   D0‹#                     #   Break if lower than 0
       Isè                  #   Get the element at that index
          ]                 # End loop
           \                # Delete top element of stack
            [`sˆD0‹#Isè]    # Iterate through list
            [               # While true, do
             `sˆ            #   Add value to global array and keep next index on stack
                D0‹#Isè     #   Same as above
                       ]    # End loop
                        ¯   # Push global array

Haskell, 79 65 59 55 bytes
-6 bytes thanks to Brute Force.
x#i|let-1!d=[];i!d=i:x!!i!!d!d=[x!!i!!1|i<-last(i!0)!2]

Defines function # that accepts a list of lists of integers, where null is represented as -1, and returns list of node values.
Try it online!
Explanation
let-1!d=[];i!d=i:x!!i!!d!d

Define function ! that iterates through the nodes starting at node i and returns a list visited indexes.
It accepts the second argument d that specifies which index of the "tuple" use as the index of the next node (d==2 to iterate forwards, d==0 to iterate backwards).
(i!0)

Iterate backwards starting from the given index and return visited indexes.
last(i!0)

Take last visited index, which is the beginning of the list.
last(i!0)!2

Iterate from the beginning of the list.
[x!!i!!1|i<-last(i!0)!2]

Replace each visited index with the value of the node.

You could almost write x!!i!!1 as i!1!!1, but it breaks because of -1 in the outputs. If you just choose another sentinel value to represent null (say, -9), it’ll work, but it’ll always break for some input, which is quite annoying.

Python 2, 60 bytes
l,n=input()
while~n:m=n;n=l[n][0]
while~m:p,v,m=l[m];print v

Try it online!
This is pretty much Chas Brown's answer, minus these golfs:

I reuse n, saving an assignment
I store the last valid n in m, allowing me to
place the print after the assignment in line 3, saving me the final print
I use only ~n instead of -~n, because negative values are just as truthy as positive ones, saving me 2 characters.

Clean, 94 90 88 bytes
import StdEnv
$l[_,u,v]|v<0=[u]=[u: $l(l!!v)]
?l= $l o until((>)0o hd)((!!)l o hd)o(!!)l

Try it online!

MATL, 39 bytes
XHx`HwI3$)t]x6Mt`Hwl3$)tbhwt]x4L)Hw2I$)

Try it online!
Almost a direct port of my Octave answer, but this version finds the end first, and then works it way back, rather than the other way round, which saved one byte.
XHx           % Store array in H.
`HwI3$)t]     % Work to the end of the array
x6Mt          % Delete the end of array delimiter, and push the array end index twice
`Hwl3$)    t] % Work to the beginning of the array
       tbhw   % Append all indices found.
Hw2I$)        % Index into original array.

Python 2, 81 77 bytes
a,n=input()
u=a[n][0]
while-~u:u,v,w=a[u]
while-~w:print v;u,v,w=a[w]
print v

Try it online!
EDIT: Thx to Mr. Xcoder for 4 bytes...
Takes a list of tuples [u,v,w] where u and w are -1 to represent the beginning/end of the linked list segment.

77 bytes Try it online!. Booleans are subclasses of int so only 0 is Falsy, and therefore u>=0 can be golfed to u+1 and this can be further shortened to -~u to remove the whitespace.

@Mr. Xcoder - Yes, quite right!

PHP, 132 bytes
<?list(,$x,$y)=$argv;parse_str($x);while(($q=$x[$y*3+1])>=0)$y=$q;do{$n[]=$x[$y*3+2];$y=$x[$y*3];}while($x[$y*3]);echo join(' ',$n);

Try it online!
Input is taken as a querystring x[]=-1&x[]=1&x[]=1... (all nodes in a flat array), in the order of next, prev, then value for each node with -1 used for ending nodes.

Octave, 81 78 76 bytes
function o=f(a,n)while q=a(n,1)o=a(n=q,2);end
while n=a(n,3)o=[o a(n,2)];end

Try it online!
Rather straightforward version. Explanation is left as an exercise to the reader. A much more fun version is presented below:
Octave, 142 99 92 bytes
@(a,n)[(p=@(b,c,z){q=a(z,2),@()[b(b,c,a(z,c)),q]}{2-~a(z,c)}())(p,1,n),p(p,3,n)(end-1:-1:1)]

Try it online!
Yo, I heard you liked anonymous functions...
Takes a nx3 array, with the first column the predecessor, second column the value, and third value the successor nodes. All the node indices are 1-based, which is the default in Octave.
% Create an anonymous function, taking an array a and first node n
@(a,n)
% Returns an array containing the predecessor and sucessor nodes
      [                                                                     ,                     ]
% Defines an recursive anonymous function (by supplying itself to the local namespace)
% which looks at the first column (c=1) or last column (c=3) of the input array to get the next nodes
       (p=@(p,c,z)                                                   )(p,1,n)
% Create a cell array, either containing the end node,
                    {q=a(z,2),
% ...or an array with all next  next nodes and the current node
% (note the use of an anonymous function taking no parameters to defer array access, in case of the last node)
                              @()[p(p,c,a(z,c)),q]}
% depending whether the next node number is nonzero (followed by () to execute the deferred array access)
                                                    {2-~a(z,c)}()
% Do the same with c=3, reverse (function p builds the array right-to-left) and drop the current node to prevent a duplicate.
                                                                             p(p,3,n)(end-1:-1:1)

Kotlin, 85 bytes
{g,S->generateSequence(generateSequence(S){g[it][0]}.last()){g[it][2]}.map{g[it][1]}}

Beautified
{g,S->
    generateSequence(generateSequence(S){g[it][0]}.last()){ g[it][2]}.map { g[it][1] }
}

Test
typealias Node=Triple<Int?,Int?,Int?>
data class Test(val input: List<Node>, val start:Int, val result: List<Int>)
val TEST = listOf<Test>(
Test(
listOf(Node(null, 12, 1), Node(0, 99, 2), Node(1, 37, null)),
1,
listOf(12, 99, 37)
),
Test(listOf(
Node(2, 99, 1), Node(0, 37, null), Node(null, 12, 0)),
1,
listOf(12, 99, 37)
),
Test(
listOf(Node(8, 5, 6), Node(10, 1, 4), Node(6, 11, null), Node(4, 3, 12), Node(1, 2, 3), Node(12, 8, null), Node(0, 7, 2), Node(null, 0, 10), Node(11, 3, 0), Node(null, 99, null), Node(7, 1, 1), Node(null, 2, 8), Node(3, 5, 5)),
4,
listOf(0, 1, 1, 2, 3, 5, 8)
),
Test(
listOf(Node(8, 5, 6), Node(10, 1, 4), Node(6, 11, null), Node(4, 3, 12), Node(1, 2, 3), Node(12, 8, null), Node(0, 7, 2), Node(null, 0, 10), Node(11, 3, 0), Node(null, 99, null), Node(7, 1, 1), Node(null, 2, 8), Node(3, 5, 5)),
0,
listOf(2, 3, 5, 7, 11)
),
Test(
listOf(Node(8, 5, 6), Node(10, 1, 4), Node(6, 11, null), Node(4, 3, 12), Node(1, 2, 3), Node(12, 8, null), Node(0, 7, 2), Node(null, 0, 10), Node(11, 3, 0), Node(null, 99, null), Node(7, 1, 1), Node(null, 2, 8), Node(3, 5, 5)),
9,
listOf(99)
),
Test(
listOf(Node(13, 80, 18), Node(18, 71, null), Node(5, 10, 19), Node(12, 1, 8), Node(19, 21, null), Node(31, 6, 2), Node(17, 5, 26), Node(26, 0, 30), Node(3, -1, 25), Node(null, 1, 23), Node(27, 6, 17), Node(14, 1, 24), Node(28, -1, 3), Node(null, 80, 0), Node(20, 4, 11), Node(33, 6, 29), Node(24, 9, 33), Node(10, 7, 6), Node(0, 67, 1), Node(2, 15, 4), Node(32, 1, 14), Node(null, 1, 31), Node(29, 3, null), Node(9, -1, 28), Node(11, 5, 16), Node(8, 1, null), Node(6, 3, 7), Node(null, 8, 10), Node(23, 1, 12), Node(15, 5, 22), Node(7, 9, null), Node(21, 3, 5), Node(null, 3, 20), Node(16, 2, 15)),
18,
listOf(80, 80, 67, 71)
),
Test(
listOf(Node(13, 80, 18), Node(18, 71, null), Node(5, 10, 19), Node(12, 1, 8), Node(19, 21, null), Node(31, 6, 2), Node(17, 5, 26), Node(26, 0, 30), Node(3, -1, 25), Node(null, 1, 23), Node(27, 6, 17), Node(14, 1, 24), Node(28, -1, 3), Node(null, 80, 0), Node(20, 4, 11), Node(33, 6, 29), Node(24, 9, 33), Node(10, 7, 6), Node(0, 67, 1), Node(2, 15, 4), Node(32, 1, 14), Node(null, 1, 31), Node(29, 3, null), Node(9, -1, 28), Node(11, 5, 16), Node(8, 1, null), Node(6, 3, 7), Node(null, 8, 10), Node(23, 1, 12), Node(15, 5, 22), Node(7, 9, null), Node(21, 3, 5), Node(null, 3, 20), Node(16, 2, 15)),
8,
listOf(1, -1, 1, -1, 1, -1, 1)
),
Test(
listOf(Node(13, 80, 18), Node(18, 71, null), Node(5, 10, 19), Node(12, 1, 8), Node(19, 21, null), Node(31, 6, 2), Node(17, 5, 26), Node(26, 0, 30), Node(3, -1, 25), Node(null, 1, 23), Node(27, 6, 17), Node(14, 1, 24), Node(28, -1, 3), Node(null, 80, 0), Node(20, 4, 11), Node(33, 6, 29), Node(24, 9, 33), Node(10, 7, 6), Node(0, 67, 1), Node(2, 15, 4), Node(32, 1, 14), Node(null, 1, 31), Node(29, 3, null), Node(9, -1, 28), Node(11, 5, 16), Node(8, 1, null), Node(6, 3, 7), Node(null, 8, 10), Node(23, 1, 12), Node(15, 5, 22), Node(7, 9, null), Node(21, 3, 5), Node(null, 3, 20), Node(16, 2, 15)),
4,
listOf(1, 3, 6, 10, 15, 21)
),
Test(
listOf(Node(13, 80, 18), Node(18, 71, null), Node(5, 10, 19), Node(12, 1, 8), Node(19, 21, null), Node(31, 6, 2), Node(17, 5, 26), Node(26, 0, 30), Node(3, -1, 25), Node(null, 1, 23), Node(27, 6, 17), Node(14, 1, 24), Node(28, -1, 3), Node(null, 80, 0), Node(20, 4, 11), Node(33, 6, 29), Node(24, 9, 33), Node(10, 7, 6), Node(0, 67, 1), Node(2, 15, 4), Node(32, 1, 14), Node(null, 1, 31), Node(29, 3, null), Node(9, -1, 28), Node(11, 5, 16), Node(8, 1, null), Node(6, 3, 7), Node(null, 8, 10), Node(23, 1, 12), Node(15, 5, 22), Node(7, 9, null), Node(21, 3, 5), Node(null, 3, 20), Node(16, 2, 15)),
14,
listOf(3, 1, 4, 1, 5, 9, 2, 6, 5, 3)
),
Test(
listOf(Node(13, 80, 18), Node(18, 71, null), Node(5, 10, 19), Node(12, 1, 8), Node(19, 21, null), Node(31, 6, 2), Node(17, 5, 26), Node(26, 0, 30), Node(3, -1, 25), Node(null, 1, 23), Node(27, 6, 17), Node(14, 1, 24), Node(28, -1, 3), Node(null, 80, 0), Node(20, 4, 11), Node(33, 6, 29), Node(24, 9, 33), Node(10, 7, 6), Node(0, 67, 1), Node(2, 15, 4), Node(32, 1, 14), Node(null, 1, 31), Node(29, 3, null), Node(9, -1, 28), Node(11, 5, 16), Node(8, 1, null), Node(6, 3, 7), Node(null, 8, 10), Node(23, 1, 12), Node(15, 5, 22), Node(7, 9, null), Node(21, 3, 5), Node(null, 3, 20), Node(16, 2, 15)),
17,
listOf(8, 6, 7, 5, 3, 0, 9)
),
Test(
listOf(Node(4, 11, 0), Node(null, 22, 3), Node(null, 33, 3), Node(1, 44, 4), Node(3, 55, null), Node(7, 66, 7), Node(6, 77, 6)),
3,
listOf(22, 44, 55)
),
Test(
listOf(Node(null, -123, null)),
0,
listOf(-123)
)
)

var f:(List<List<Int?>>,Int)-> Sequence<Int?> =
{g,S->generateSequence(generateSequence(S){g[it][0]}.last()){g[it][2]}.map{g[it][1]}}

fun main(args: Array<String>) {
    for ((input, start, result) in TEST) {
        val out = f(input.map { it.toList() }, start).toList()
        if (out != result) {
            throw AssertionError("$input $start $result $out")
        }
    }
}

TIO
TryItOnline

I just wish generateSequence was shorter

JavaScript ES6, 70 63 Bytes
(x,i,a)=>(h=_=>i&&h(a(x[i].v),i=x[i].n))(x.map(_=>i=x[i].p||i))

Test case:
F([undefined,{p:0,v:12,n:2},{p:1,v:99,n:3},{p:2,v:37,n:0}],1,alert)

The alert needs to be in the main body of your function and counted towards your byte total.

https://codegolf.meta.stackexchange.com/a/11324/76323

+10 / -9 is not a consensus.

I don't see the exact + and - s. Also, it's javascript's intended output way, and only way when output have some delay


text:
Tuple addition in pointfree
What is the shortest way we can express the function
f(a,b)(c,d)=(a+c,b+d)

in point-free notation?
pointfree.io gives us
uncurry (flip flip snd . (ap .) . flip flip fst . ((.) .) . (. (+)) . flip . (((.) . (,)) .) . (+))

which with a little bit of work can be shortened to
uncurry$(`flip`snd).((<*>).).(`flip`fst).((.).).(.(+)).flip.(((.).(,)).).(+)

for 76 bytes.  But this still seems really long and complex for such a simple task.  Is there any way we can express pairwise addition as a shorter point-free function?
To be clear by what I mean by point-free,  a point-free declaration of a function involves taking existing functions and operators and applying them to each other in such a way that the desired function is created.  Backticks, parentheses and literal values ([],0,[1..3], etc.) are allowed but keywords like where and let are not.  This means:

You may not assign any variables/functions
You may not use lambdas
You may not import

Here is the same question when it was a CMC

I never understood why it is called “point-free” when it is actually full of points. :P

@Mr.Xcoder "A common misconception is that the 'points' of pointfree style are the (.)
operator (function composition, as an ASCII symbol), which uses the same identifier as the decimal point. This is wrong. The term originated in topology, a branch of mathematics which works with spaces composed of points, and functions between those spaces. So a 'points-free' definition of a function is one which does not explicitly mention the points (values) of the space on which the function acts."

What's considered an external library? Are imports from base allowed?

I think so. So no keywords are allowed at all? I'd suggest explicitly allowing literal values like  0 and the empty tuple. Also, your example uses backticks, it should be clear then that's allowed.

@xnor Literals are allowed, keywords are not.  Thanks for asking for clarifications, hopefully everything is clear.

It's a shame we're not allowed to import the best Haskell package, or else the solution would just be (+)***(+).

An idea: (+)<$>([1],2)<*>([3],4) gives ([1,3],6).

@SilvioMayolo Please add this to the tips for golfing in haskell! (and I invite you to join of monads and men :)

I spent some time trying to craft a fine solution utilizing xnor's tip... but I ended up with this garbage. I don't even know why I try sometimes...

@flawr What is the meta consensus on using external packages? The package I referenced isn't part of base so it would have to be installed.

@SilvioMayolo You are allowed to use packages.  If it's not in base its a different language, that's all.

If not for the import ban, I'd say Biapplicative was the way to go.

44 bytes
Got this from \x y -> (fst x + fst y, snd x + snd y)
(<*>).((,).).(.fst).(+).fst<*>(.snd).(+).snd

Try it online!
Or, 42 bytes using do:
do a<-fst;((,).(a+).fst<*>).(.snd).(+).snd

Try it online!

44 bytes
-8 bytes thanks to Ørjan Johansen. -3 bytes thanks to Bruce Forte.
(.).flip(.)<*>(zipWith(+).)$mapM id[fst,snd]

Try it online!
Translates to:
f t1 t2 = zipWith (+) (mapM id [fst, snd] $ t1) (mapM id [fst, snd] $ t2)

67 bytes
-8 bytes thanks to Ørjan Johansen. -1 byte thanks to Bruce Forte.
If tuple output is required:
(((,).head<*>last).).((.).flip(.)<*>(zipWith(+).)$mapM id[fst,snd])

Try it online!
Yup, me manually doing it doesn't produce ripe fruit. But I am happy with the [a] → (a, a) conversion.
listToPair ∷ [a] → (a, a)
listToPair = (,) . head <*> last
-- listToPair [a, b] = (a, b)

Now if there was a short function with m (a → b) → a → m b.

Hate to break it to you, but mapM id[fst,snd] is shorter.

Sadly, mapM id is the golfed version of the function you're probably looking for, sequence.

Yeah, that's true. I'm just looking at (<*>)'s signature which is m (a → b) → m a → m b. So close...

There's also Control.Lens.??, which may have been proposed for inclusion in base at some point.

I want to extract the repeated (.mapM id[fst,snd]) like let r=(.mapM id[fst,snd]) in r(r.zipWith(+)), but I haven't been able to get the typechecker to accept a pointfree version.

@xnor It's monotyped if you drop the ..

60 bytes
I'm not seeing any uncurry love here, so I figured I'd pop in and fix that.
uncurry$(uncurry.).flip(.)(flip(.).(+)).(flip(.).((,).).(+))

I thought, with all of the fst and snd, that unpacking the arguments with uncurry might yield some results. Clearly, it was not as fruitful as I had hoped.

uncurry is so verbose. :( But you can replace the outermost parentheses with $.

Yeah, and that's unfortunately the issue with a lot of function names in Haskell. Just too long for golfing. But thanks for the 1-character savings!

54 bytes
I honestly doubt that we'll beat @H.PWiz's 44 bytes solution, but nobody was using the fact that (,) implements the type class Functor, so here's another interesting one which isn't too bad:
((<*>snd).((,).).(.fst).(+).fst<*>).flip(fmap.(+).snd)

Try it online!
Explanation
The implementation of the type class Functor for 2-Tuples are very similar to that of Either (from base-4.10.1.0):
instance Functor ((,) a) where
    fmap f (x,y) = (x, f y)

instance Functor (Either a) where
    fmap _ (Left x) = Left x
    fmap f (Right y) = Right (f y)

What this means for this challenge, is that the following function adds the second elements while keeping the first element of the second argument:
λ f = fmap.(+).snd :: Num a => (a, a) -> (a, a) -> (a, a)
λ f (1,-2) (3,-4)
(3,-6)

So if only we got some little helper helpPlz = \a b -> (fst a+fst b,snd b) we could do (helpPlz<*>).flip(fmap.(+).snd) and would be done. Luckily we have the tool pointfree which gives us:
helpPlz = (`ap` snd) . ((,) .) . (. fst) . (+) . fst

So by simply plugging that function back in we arrive at the above solution (note that (<*>) = ap which is in base).