text:
BigNum Bakeoff Reboot
Some of you may be familiar with the BigNum Bakeoff, which ended up quite interestingly. The goal can more or less be summarized as writing a C program who's output would be the largest, under some constraints and theoretical conditions e.g. a computer that could run the program.
In the same spirit, I'm posing a similar challenge open to all languages. The conditions are:

Maximum 512 bytes.

Final result must be printed to STDOUT. This is your score. If multiple integers are printed, they will be concatenated.

Output must be an integer. (Note: Infinity is not an integer.)

No built-in constants larger than 10, but numerals/digits are fine (e.g. Avogadro's constant (as a built-in constant) is invalid, but 10000 isn't.)

The program must terminate when provided sufficient resources to be run.

The printed output must be deterministic when provided sufficient resources to be run.

You are provided large enough integers or bigints for your program to run. For example, if your program requires applying basic operations to numbers smaller than 101,000,000, then you may assume the computer running this can handle numbers at least up to 101,000,000. (Note: Your program may also be run on a computer that handles numbers up to 102,000,000, so simply calling on the maximum integer the computer can handle will not result in deterministic results.)

You are provided enough computing power for your program to finish executing in under 5 seconds. (So don't worry if your program has been running for an hour on your computer and isn't going to finish anytime soon.)

No external resources, so don't think about importing that Ackermann function unless it's a built-in.

All magical items are being temporarily borrowed from a generous deity.
Extremely large with unknown limit

Steven H, Pyth f3+B³F+ω²(25626)

where B³F is the Church-Kleene ordinal with the fundamental sequence of
B³F[n] = B³F(n), the Busy Beaver BrainF*** variant
B³F[x] = x, ω ≤ x < B³F

Leaderboard:

Simply Beautiful Art, Ruby fψ0(X(ΩM+X(ΩM+1ΩM+1)))+29(999)

Binary198, Python 3 fψ0(εΩω+1)+1(3) (there was previously an error but it was fixed)

Steven H, Pyth fψ(ΩΩ)+ω²+183(25627!)

Leaky Nun, Python 3 fε0(999)

fejfo, Python 3 fωω6(fωω5(9e999))

Steven H, Python 3 fωω+ω²(99999)

Simply Beautiful Art, Ruby fω+35(9999)

i.., Python 2, f3(f3(141))

Some side notes:
If we can't verify your score, we can't put it on the leaderboard. So you may want to expect explaining your program a bit.
Likewise, if you don't understand how large your number is, explain your program and we'll try to work it out.
If you use a Loader's number type of program, I'll place you in a separate category called "Extremely large with unknown limit", since Loader's number doesn't have a non-trivial upper bound in terms of the fast growing hierarchy for 'standard' fundamental sequences.
Numbers will be ranked via the fast-growing hierarchy.
For those who would like to learn how to use the fast growing hierarchy to approximate really large numbers, I'm hosting a Discord server just for that. There's also a chat room: Ordinality.
Similar challenges:
Largest Number Printable
Golf a number bigger than TREE(3)
Shortest terminating program whose output size exceeds Graham's number
For those who want to see some simple programs that output the fast growing hierarchy for small values, here they are:
Ruby: fast growing hierarchy
#f_0:
f=->n{n+=1}

#f_1:
f=->n{n.times{n+=1};n}

#f_2:
f=->n{n.times{n.times{n+=1}};n}

#f_3:
f=->n{n.times{n.times{n.times{n+=1}}};n}

#f_ω:
f=->n{eval("n.times{"*n+"n+=1"+"}"*n);n}

#f_(ω+1):
f=->n{n.times{eval("n.times{"*n+"n+=1"+"}"*n)};n}

#f_(ω+2):
f=->n{n.times{n.times{eval("n.times{"*n+"n+=1"+"}"*n)}};n}

#f_(ω+3):
f=->n{n.times{n.times{n.times{eval("n.times{"*n+"n+=1"+"}"*n)}}};n}

#f_(ω∙2) = f_(ω+ω):
f=->n{eval("n.times{"*n+"eval(\"n.times{\"*n+\"n+=1\"+\"}\"*n)"+"}"*n);n}

etc.
To go from f_x to f_(x+1), we add one loop of the n.times{...}.
Otherwise, we're diagonalizing against all the previous e.g.
f_ω(1) = f_1(1)
f_ω(2) = f_2(2)
f_ω(3) = f_3(3)

f_(ω+ω)(1) = f_(ω+1)(1)
f_(ω+ω)(2) = f_(ω+2)(2)
f_(ω+ω)(3) = f_(ω+3)(3)

etc.

Do numerals count as built-in constants?

@PyRulez Nope, they don't count as built-ins

@CloseVoters How can this be too broad... Well, asking the user to output one number in infinitely many numbers is not the same as asking the user to choose one of infinitely many tasks to do. To be fair this question ask the user to do the same thing too. 4 close votes as too broad already...

@user202729 Actually, that's false. There's only finitely many valid programs outputting finitely many numbers, so it's one out of x, for some very large x.

So the other question is even more broad. This question only have <256⁵¹³ × (number of programming languages) possible answers, which is way less than infinity.

@user202729 I suppose one would say that it's broader to have an unknown limit to aim for as opposed to having a specific value one is trying to beat.

Since the program finishes in under 5 seconds, can we assume the tick rate scales accordingly? That is: the speed of computation is raised, instead of made more efficient?

@Οurous Yes, you may assume that. But realize that when your program is given more resources, including faster computation, the output must still be deterministic.

I stated in the other comment section why I think the bounded Brainfuck Busy Beaver function will be exponential, but I'd like to add that more generally, I don't think the Church-Kleene ordinal will be the appropriate level for any computer program. A function one can code with a program are computable, and so should fall into the provably recursive functions of some sufficiently strong recursive sound theory. That theory will have a recursive proof theoretic ordinal, and that function will be below that ordinal in the FGH, assuming reasonable fundamental sequences.

Of course the actual Busy Beaver function cannot be coded into program (hypercomputational languages aside), and restricted Busy Beaver functions that can be programmed must by necessity be much slower growing.

Ruby, fψ0(X(ΩM+X(ΩM+1ΩM+1)))+29(999)
where M is the first Mahlo 'ordinal', X is the chi function (Mahlo collapsing function), and ψ is the ordinal collapsing function.
f=->a,n,b=a,q=n{c,d,e=a;!c ?[q]:a==c ?a-1:e==0||e&&d==0?c:e ?[[c,d,f[e,n,b,q]],f[d,n,b,q],c]:n<1?9:!d ?[f[b,n-1],c]:c==0?n:[t=[f[c,n],d],n,c==-1?[]:d==0?n:[f[d,n,b,t]]]};(x=9**9**9).times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{h=[];x.times{h=[h,h,h]};h=[[-1,1,[h]]];h=f[h,p x*=x]until h!=0}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

Try it online!
Code Breakdown:
f=->a,n,b=a,q=n{          # Declare function
                c,d,e=a;          # If a is an integer, c=a and d,e=nil. If a is an array, a=[c,d,e].compact, and c,d,e will become nil if there aren't enough elements in a (e.g. a=[1] #=> c=1,d=e=nil).
                        !c ?[q]:          # If c is nil, return [q], else
                                a==c ?a-1:          # If a==c, return a-1, else
                                          e==0||e&&d==0?c:          # If e==0 or e is not nil and d==0, return c, else
                                                          e ?[[c,d,f[e,n,b,q]],f[d,n,b,q],c]:          # If e is not nil, return an array inside an array, else
                                                                                n<1?9:          # If n<1, return 9, else
                                                                                !d ?[f[b,n-1],c]:          # If d is nil, return [f[b,n-1],c], else
                                                                                c==0?n:          # If c==0, return n, else
                                                                                [t=[f[c,n],d],n,c==-1?[]:d==0?n:[f[d,n,b,t]]]          # t=[f[c,n],d]. If c==-1, return [t,n,[]], else if d==0, return [t,n,n], else return [t,n,[f[d,n,b,t]]].
                                                                                };          # End of function
                                                                                (x=9**9**9)          # Declare x
                                                                                x.times{...}          # Looped within 33 x.times{...} loops
                                                                                h=[];          # Declare h
                                                                                x.times{h=[h,h,h]};          # Nest h=[h,h,h] x times
                                                                                h=f[h,p x*=x]          # Apply x*=x, print x, then h=f[h,x]
                                                                                until h==0          # Repeat previous line until h==0

Math Breakdown:
f reduces a based on n,b,q.
The basic idea is to have an extremely nested a and reduce it repeatedly until it reduces down to a=0. For simplicity, let
g[0,n]=n
g[a,n]=g[f[a,n],n+1]

For now, let's only worry about n.
For any integer k, we get f[k,n]=k-1, so we can see that
g[k,n]=n+k

We then have, for any d, f[[0,d],n]=n, so we can see that
g[[0,d],n]
= g[f[[0,d],n],n+1]
= g[n,n+1]
= n+n+1

We then have, for any c,d,e, f[[c,0,e],n]=f[[c,d,0],n]=c. For example,
g[[[0,d],0,e],n]
= g[f[[[0,d],0,e]],n+1]
= g[[0,d],n+1]
= (n+1)+(n+1)+1
= 2n+3

We then have, for any c,d,e such that it does not fall into the previous case, f[[c,d,e],n]=[[c,d,f[e,n]],f[d,n],e]. This is where it starts to get complicated. A few examples:
g[[[0,d],1,1],n]
= g[f[[[0,d],1,1],n],n+1]
= g[[[0,d],1,0],0,[0,d]],n+1]
= g[f[[[0,d],1,0],0,[0,d]],n+1],n+2]
= g[[[0,d],1,0],n+2]
= g[f[[[0,d],1,0],n+2],n+3]
= g[[0,d],n+3]
= (n+3)+(n+3)+1
= 2n+7

#=> Generally g[[[0,d],1,k],n] = 2n+4k+3

g[[[0,d],2,1],n]
= g[f[[[0,d],2,1],n],n+1]
= g[[[[0,d],2,0],1,[0,d]],n+1]
= g[f[[[[0,d],2,0],1,[0,d]],n+1],n+2]
= g[[[[[0,d],2,0],1,n+1],0,[[0,d],2,0]]],n+2]
= g[f[[[[[0,d],2,0],1,n+1],0,[[0,d],2,0]]],n+2],n+3]
= g[[[[0,d],2,0],1,n+1],n+3]
= ...
= g[[[0,d],2,0],3n+6]
= g[f[[[0,d],2,0],2n+6],3n+7]
= g[[0,d],3n+7]
= (3n+7)+(3n+7)+1
= 6n+15

It quickly ramps up from there. Some points of interest:
g[[[0,d],3,[0,d]],n] ≈ Ack(n,n), the Ackermann function
g[[[0,d],3,[[0,d],0,0]],63] ≈ Graham's number
g[[[0,d],5,[0,d]],n] ≈ G(2^^n), where 2^^n = n applications of 2^x, and G(x) is the length of the Goodstein sequence starting at x.

Eventually introducing more arguments of the f function as well as more cases for the array allows us to surpass most named computable notations. Some particularly known ones:
g[[[0],3,[0,d]],n] ≈ tree(n), the weak tree function
g[[[[0],3,[0,d]],2,[0,d]],n] ≈ TREE(n), the more well-known TREE function
g[[[[0,d]],5,[0,d]],n] >≈ SCG(n), sub-cubic graph numbers
g[[[0]],n] ≈ S(n), Chris Bird's S function

Ordinal explanation?

Is this your largest defined number yet? It appears so!

This looks quite powerful, but can you prove your supposed growth rate of $\psi_0(\chi(\Omega_{M+\chi(\Omega_{M+1}^{\Omega_{M+1}}))})+29$? That seems quite high in my opinion. But I might be wrong, your program might actually be that strong!

Also, which OCF are you using? The analysis seems ill-defined.

Pyth, fψ(ΩΩ)+ω2+183(~25627!)
=QC`.pGL&=^QQ?+Ibt]0?htb?eb[Xb2yeby@b1hb)hbXb2yeb@,tb&bQ<b1=Y_1VQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQ.v%%Fms["*s[.v"*\\^2d"\"%s"*\\^2d"\"")Qs["=Y.v+*"*\\^2Q"\"*3]"*\\^2Q"\"Q\YuyFYHpQ)

Requires any non-empty input, but the value thereof is not used.
Explanation (for the new and actually-reasonably-scoring version):
=QC`.pG                   Sets the value of the autofill variable to app. 256^27!
                                  27! ~= the number of characters in the string
                                  containing all permutations of the alphabet.
                                  We interpret that string as a base-256 number.
       L                  Define a function y(b,global Q):
        &=^QQ             Set Q to Q^Q and:
        ?+Ibt]0           If (?) the variable (b) is (I)nvariant on (+)adding itself
                             to the empty array (i.e. if it's an array itself):
               ?htb        If the second element of b is not 0:
                   ?eb         If the last element is not 0
                       [Xb2yeby@b1hG)   return [b with its last element replaced with y(b[-1]), y(b[1]), b[0]]
                     hb                 else return b[0]
                 Xb2yeb     else return b with its last element replaced with y(b[-1])
           @,tb&bQ<b1      If b isn't an array,return:
                               either b-1 if it's a standard ordinal (1 or more)
                               or Q if b is ω
                               or 0 if b is 0
 =Y_1                          Set the global variable Y to -1 (representing ω)
 VQ                        Q times, do (the rest of the explanation):
  VQVQ....VQ               Iterate from 0 to Q-1 183 times, each subiteration
                              reading the most recent value of Q when it starts:
  .v%%Fms["*s[.v"*\\^2d"\"%s"*\\^2d"\"")Q
                            Iterate from 0 to Q-1 Q times, each subiteration
                               reading the most recent value of Q when it starts:
 s["=Y.v+*"*\\^2Q"\"*3]"*\\^2Q"\"Q
                             Y = [Y,Y,Y] Q times, stacking with previous iterations.
 uyFYHpQ)                    Run y_x(Y) for x incrementing until y_(x-1)(Y)=0

It's very hard for me to compute the size of this, mostly because it's late in the day and I'm not super familiar with fast-growing hierarchies or how I'd even go about trying to figure out how many times Q goes through the y() wringer.  While I now know more about ordinals, I still have no idea how to calculate the value of the ordinal represented by the recursive definition in my program. I'd join the Discord server, but that's under a pseudonym I'd rather not be linked to my real name.
Unfortunately, because I know relatively little about said fast-growing hierarchies, I'm likely to have already lost to the Ruby answer.  It's hard for me to tell. I may have beaten the Ruby answer, but I'm not 100% sure. ¯\_(ツ)_/¯

If I understand correctly, your score is probably somewhere in the ballpark of 27^^^27^^27^^4, or f4(27^^27^^4)) ≈ f4(f3(f3(19))).

I made a small change that I should have thought of yesterday, but somehow didn't - making y recurse to operate on y(Q-1) instead of operating just on Q.  How does this affect the score?

I'm not entirely sure what's going on. Does y(Q) = L(y(Q-1)), per se?

I think we'll have better luck doing this in a chatroom.

@SimplyBeautifulArt Its probably best not to use fast growing hierarchy notation for this, since its kind of small.

@PyRulez Are you replying to my first comment? If so, note that the answer has been revised since then and is larger than Graham's number.

@SimplyBeautifulArt Oh, I didn't notice that he threw it an ackerman function at the end. Nvm.

@PyRulez I'm using the Hardy Hierarchy, but I haven't updated the explanation yet.  No Ackermann functions anymore.

@PyRulez The new explanation is up!

Pyth, f3+σ-1+ω2(25626)
Where σm[n] is the Busy Beaver function Σ of order m called on n: σm[n] = Σm(n).  The order -1 is to denote that the Busy Beaver here is not being called on a true Turing Machine, but rather an approximation with a finite wrapping tape of Q elements.  This allows the halting problem to be solvable for these programs.
=QCGM.x-Hlhf!-/T4/T5.__<GH0M.x+Hlhf!-/T4/T5._>GHlGL=.<QC`m.uX@[XN2%h@N2l@N1XN2%t@N2l@N1XN1X@N1@N2%h@@N1@N2l@N1XN1X@N1@N2%t@@N1@N2l@N1XW!@@N1@N2N2nFKtPNXW@@N1@N2N2gFK)@hNeN3%heNlhNd)bLym*F[]d^UQQUQUld)^U6QJ"s*].v*\mQ"
.v+PPPP*JQ"+*\mQ\'

The TL;DR is that this creates all possible BrainF**k programs of length Q, runs them in an environment where the maximum value of an integer is Q and the tape length is Q, and compiles all the states from these operations together to append (that's the 3+) to Q, repeating the above on a scale of fω2.
I still have ~half the characters to work with if I wanted to do something more, but until we figure out where this is I'll just leave it as is.

I made a sorta better explanation of σ in the leaderboard.

It doesn't look to me like this particular Busy Beaver function an be that fast growing. With a limit of Q integers between 0 and Q, there are only (Q+1)^Q possible tapes, and Q possible positions in the program, so there can be at most Q*(Q+1)^Q possible states of a running program. So a program must halt within Q*(Q+1)^Q steps or not at all. The number of possible programs is also limited by an exponential upper bound. So it looks to me like this Busy Beaver function has an exponential upper bound, and the final function will be on the order of $f_{\omega^2}$.

Python 3, probably fε0(99) I have no idea
def f(n,d,a,i):
 if d < 0 or i >= len(a):
  return n

 k = a[i]
 if type(k) == int:
  if k < 0:
   a[i] = [-2]*n
   a = f(n,d,a,i+k+2)
  else:
   a[i] -= 1
 else:
  a[i] = f(n,d-1,k,0)
 return a

def g(n):
 d=n
 a=[-2]*n
 while type(a) != int:
  a = f(n,d,a,0)
  n += 1

print(g(99))

Edit: Accidentally left d=2 from the slower-growing format, fixed and it's now d=n.
Try it online!
First, this is my first CGSE post (and my first SE post in general) so this definitely looks weird. Second, I'm not sure it's fε0(99) I have no idea what this is. Third, I did no golfing on this, just trying to get something out there that I can understand (and build upon in later edits). I consider this to be "v0.1",
Equivalent equation
Fourth, I'm not sure that g(n) grows at fε0. I sent it to the mathematics stackex discord, and ended up making an approximation of this program.
\$g(n) = f(n,n,\{-2,-2,\cdots\ n\ times\},0)\\a=\{a_0,a_1,\cdots a_k\}\$
\$f(n,d,a,i) =\left\{ \begin{array}{cl} n & : \ d < 0 \\ n & : \ i > k\\ f(n,d,\{a_0,\cdots a_{i-1},\{-2,-2,-2,\cdots n\ times\},a_{i+1}\cdots a_k \},i+k+2) & : \ a_i \in \mathbb{Z}\ \cap\ a_i<0\\ f(n+1,d-1,\{a_0\cdots a_{i-1},a_i-1,a_{i+1},\cdots a_k\},0) & : \ a_i \in \mathbb{Z}\ \cap\ a_i\geq 0 \\  \{a_0,a_1\cdots a_{i-1},f(n,d-1,a_i,0),a_{i+1},\cdots a_k\}&:\ a_i\notin\mathbb{Z} \end{array}  \right.\$
If f(n,d,a,i) is cutting off on the side of the screen, then use these links to an image of the equation, both with a White background and with a Discord Dark Mode background.
Slower growing formats
Lastly, while testing it, to make sure it worked, I made a version that grows significantly slower.
Slower growing function. For this, it increments an unrelated q variable instead of incrementing n directly, then outputs q. With n=2 and d=2, it outputs 714025. With n=3 and d=2 or n=2 and d=3, tio.run gives me a "Program has exceeded the 60 second time limit."
def f(n,d,a,i):
 if d < 0 or i >= len(a):
  return n

 k = a[i]
 if type(k) == int:
  if k < 0:
   a[i] = [-2]*n
   a = f(n,d,a,i+k+2)
  else:
   a[i] -= 1
 else:
  a[i] = f(n,d-1,k,0)
 return a

n=3
d=2
a=[-2]*n
q=0

while type(a) != int:
 a = f(n,d,a,0)
 q += 1

print(q)

Welcome to Code Golf, and nice answer!

We have matjax enabled so you can embed the equation in the post without the weird discord coloured background.  Just put it between \$s :)

Python 3, Greater than fSVO(Z)≈fψ0(ΩΩω)(Z)
Where Z = (...((9^9)^(9^9))^((9^9)^(9^9))...) with about 9^9 parenthesis
def R(a,n):
    if type(a)==int:return a-1
    if n<1:return 0
    if not a:return n
    if a[-1]==0:return a[:-1]
    if a[0]!=0:a[0]=R(a[0],n);return a
    i=0
    while a[i]==0:i+=1
    a[i-1]=R(a[:],n-1);a[i]=R(a[i],n);return a
def G(a,n,m=0):
    A='\t'
    if a==0:return n+1
    if m:
        prgm='';b=G(a,n)
        for i in range(b):prgm+=A*i+'for _ in range(n):\n'
        prgm+=A*b+'n=G(R(a,n),n,m-1)';exec(prgm)
    m=0
    if type(a)==list:m=n
    for i in range(n):n=G(R(a,n),n,m)
    return n+1
z=Z=9**9
for i in range(z):Z=Z**Z
Z=G([Z]*Z,Z)
print(Z)

I wrote this mess a while back but didn't upload it because I was thinking I should just go for First Place Or Bust. Turns out: First Place is hard. So here's my 4th place submission.
Ungolfed program: https://github.com/cpaca/BignumReboot/blob/main/VeblenMethod.py
Website to minify a python program: https://python-minifier.com/
Unfortunately, because I wrote it so long ago, I've forgotten most of what I wrote. I remembered what my goal was, I remembered finishing it, but I don't remember the mathematics behind the mess very well. The ungolfed program has comments (lots of them, actually, looking at it) but there are a few hints that I do remember:

G(a,n,m) accepts either a list, int, int or an int, int, int. If the last variable isn't given, it's defaulted to 0.
All integers are positive. Negative integers should be inaccessible.
G(a,n,0) for int, int, 0 should be equivalent to fa(n) under the fast growing hierarchy. This evidently isn't the case, as it's calculating G(1,1) = 3, G(1,2) = 5, G(1,5) = 11, G(2,2) = 12. (Best guess, it's actually f0(fa(n)) but I can't really confirm.)
G([],n,0) - in other words, for empty list - should be equivalent to G(n,n,0)
R(a,n) is φ(a)[n] under the Veblen hierarchy.
G(a,n,0) should be greater than fφ(a)(n), where φ is the veblen function.
However, there is one thing that could make this function less than what I expect. In the analysis of the FGH, and the Veblen function, I made one assumption which MIGHT not be true:
$$f_{\alpha+\beta}(n) < f_{\alpha+f_\beta(n)}(n)$$

Welcome to Code Golf, and great answer!

python, f3(f3(141)), 512 bytes
import math
def f(x):
    return math.factorial(x)
x=9
for j in range(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(x))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))):
    x=f(x)
print x

This isn't really a valid answer, but I wanted to post it anyway. A quick rundown:
import math # imports the factorial function
def f(x):
    return math.factorial(x) # shortens the factorial operation
x=9 # sets x to highest available number
for j in range(f(...f(x)...)): # repeats * A LOT *
    x=f(x) # does the factorial of x
print x # outputs the result

Anyway, I don't know if this answer technically legal, but it was fun to write. Feel free to edit any errors you find in the code.

I think this is f_3(9), and it is definitely legal. You'd get a far larger number by nesting even for j in range(f(x)): for j in range(f(x)): x = f(x), though. Join us in chat to discuss why!

Why isn't it a valid answer?

I didn't quite get the question, so I just made what I thought was right.

Ruby, probably ~ fω+35(9999)
G=->n,k{n<1?k:(f=->b,c,d{x=[]
c<G[b,d]?b-=1:(x<<=b;c-=G[b,d])while c>=d
x<<[c]}
x=f[n-1,k,b=1]
(b+=1;*u,v=x;x=v==[0]?u:v==[*v]?u<<[v[0]-1]:u+f[n-1,G[v,b]-1,b])while x[0]
b)};(n=9**9**99).times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n.times{n=G[n,n]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}};p n

Try it online!
Approximate Math Explanation:
The below is approximately equal to the program above, but simplified so that its easier to understand.
G(0,k) = k is our base function.
To evaluate G(n,k), we take k and write it as G(n-1,1) + ... + G(n-2,1) + ... + G(0,1).
Then change all of the G(x,1)'s into G(x,2)'s and subtract 1 from the entire result.
Rewrite it in the above form using G(x,2), where x<n, and leave the remainder at the end. Repeat, changing G(x,2) to G(x,3), etc.
When the result reaches -1, return the base (the b that would be in G(x,b).)
Examples:
G(1,1):
1: 1 = G(0,1)
2: G(0,2) - 1 = 1
3: 1 - 1 = 0
4: 0 - 1 = -1      <----- G(1,1) = 4

G(1,2):
1: 2 = G(0,1) + G(0,1)
2: G(0,2) + G(0,2) - 1 = G(0,2) + 1
3: G(0,3) + 1 - 1 = G(0,3)
4: G(0,4) - 1 = 3
5: 3 - 1 = 2
6: 2 - 1 = 1
7: 1 - 1 = 0
8: 0 - 1 = -1      <----- G(1,2) = 8

G(1,3):
1: 3 = G(0,1) + G(0,1) + G(0,1)
2: G(0,2) + G(0,2) + G(0,2) - 1 = G(0,2) + G(0,2) + 1
3: G(0,3) + G(0,3)
4: G(0,4) + 3
5: G(0,5) + 2
6: G(0,6) + 1
7: G(0,7)
8: 7
9: 6
10:5
11:4
12:3
13:2
14:1
15:0
16:-1      <----- G(1,3) = 16

G(2,5):
1: 5 = G(1,1) + G(0,1)
2: G(1,2) + 1
3: G(1,3)
4: G(0,4) + G(0,4) + G(0,4) + G(0,4) + G(0,4) + G(0,4) + G(0,4) + 3
5: G(0,5) + G(0,5) + G(0,5) + G(0,5) + G(0,5) + G(0,5) + G(0,5) + 2
6: G(0,6) + G(0,6) + G(0,6) + G(0,6) + G(0,6) + G(0,6) + G(0,6) + 1
...
1024: -1      <----- G(2,5) = 1024

Doing some math, I found that
G(1,n-1) = 2ⁿ
G(2,n+6) ~ 2^G(2,n),  large enough n.

And beyond that it tends to get a bit hairy.
In general, we have
G(n,k+G(n-1,1)) ~ G(n-1,G(n,k)), large enough n.

Python 3, fωω+ω*ω(99999)
from functools import*
h=lambda a,x,b:h(h(a,x,b-1),x-1,a)if x*b else a+b
def f(*x):
    if(any(x[:2]):return reduce(lambda y,z:h(z,y,f(x[0],x[1]-1,*x[2:])),x[::-1])if x[0]*x[1]else(f(x[0]-1,f(x[0]-1,x[0],*x[2:]))if x[0]>x[1]else(f(x[1]-1,f(*([x[1]-1]*2+x[2:])),*x[2:])))
    for a,k in enumerate(x):if k:return f(*[f(*[k]*a,k-1,*x[a+1:])]*a,k-1,*x[a+1:])
    return 0
x,s,g,e,r,z=9**9**9**99,"f(*[%s]*%s)",lambda a,b:a%((b,)*a.count("%")),"x*=eval(\"%s\");","x","x=g(e,g(reduce(g,[s]*x,s),r));"
print(exec(z*x)or eval(r))

I'll get an explanation up soon.

This looks soo complicated, but I will trust your analysis.

Python 3, ~ fε0(999)
N=9**9**9
def f(a,n):
 if a[0]==[]:return a[1:]
 if a[0][0]==[]:return[a[0][1:]]*n+a[1:]
 return [f(a[0],n)]+a[1:]
a=eval("["*N+"]"*N)
n=2
while a:a=f(a,n);n+=1
print(n)

Try it online!

N=9**9e99 should be slightly larger

than whose answer?

I mean that if you replace the first like with N=9**9e99 the output should be slightly larger because 9e99>9**9. Ofcourse It is still your answer.

@fejfo I mean it wouldn't change my ranking.

Does that matter?

Python 3, 323 bytes, g9e9(9)
exec("""a=`x:9**x
n=`a,f:`x:a and n(a-1,f)(f(x))or x
c=`n:`l:l[~n](l)
e=`x:n(x,c(0))([x,`l:[a(l[0]),n(*l)],c(0),`l:[a(l[0]),l[2](l[:2])[1]]+map(`i:l[1]((l[0],i))[1],l[2:])]+list(map(c,range(a(x),1,-1))))[1]
f=`l:[l[1](l[0]),e(l[1](l[0]))(l)[1]]
g=`x:e(x)((x,f))[1]((x,a))[1](x)
print(n(9e9,g)(9))""".replace('`','lambda '))

Try it online!
Explanation
Python 3 is a truly recursive language, this means that not only can a function call itself, a function can also take other functions as input or output functions. Using functions to make themselves better is what my program is based on.
f=lambda x,a:[a(x),e(x)((x,a))[1]]
Definition
a(x)=9^x
b(x,f)=a(x), f^x
c(n)(*l)=l[~n](l)
c(0)=c0 <=> c0(…,f)=f(…,f)
d(x,b,c,*l)=a(x), c0(x,b), b(x,c0), b(x,f) for f in l
e(x)=c0^x(x,b,c0,d,c(a(x)),c(a(x)-1),c(a(x)-2),…,c(3),c(2),c(1))[1]
f(x,a)=a(x),e(a(x))(x,a)[1](x)
g(x)=e(x)(x,f)[1](x,a)[1](x)
myNumber=g^9e9(9)

Definition explained
a(x)=9^x a is the base function, I chose this function because x>0=>a(x)>x`  which avoids fixed points.
b(x,f)=a(x), f^x b is the general improving function, it takes in any function and outputs a better version of it.
b can even be applied to itself: b(x,b)[1]=b^x b(x,b^x)[1]=b^(x*x)
but to fully use the power of b to improve b you need to take the output of b and use it as the new b, this is what c0 does:
c0(…,f)=f(…,f)
c0(x,b^x)=b^x(x,b^x)[1]>b^(9↑↑x)
the more general c(n) function takes the n last argument (starting from 0) so
c(1)(…,f,a)=f(…,f,a) and c(2)(…,f,a,b)=f(…,f,a,b). *l means l is an array and l[~n] takes the n last argument
d(x,b,c,*l)=a(x), c0(x,b), b(x,c0), b(x,f) for f in l d uses c0 to upgrade b and b to upgrade all of the other input functions (of which there can be any amount because of the list)
d(x,b,c,d)>9^x,b^x,c^x,d^x and d²(x,b,c,d)>a²(x), b^(9↑↑x), c^(9↑↑x), d^(9↑↑x)
but d gets even better if you combine it with c:
c0²(x,b,c0,d)=d^x(9^x,b^x,c0^x,d^x)=…
c0(x,b,c0,d,c1)=c1(x,b,c0,d,c1)=d(x,b,c0,d,c1)=9^x,b^x,c0^x,d^x,c1^x
c0²(x,b,c0,d,c1)=c0(9^x,b^x,c0^x,d^x,c1^x)=c1^x(9^x,b^x,c0^x,d^x,c1^x)=…
the more c(x) you add at the end the more powerful it becomes. The first c0 always remains d: c0(x,b,c0,d,c4,c3,c2,c1)=c1(…)=c2(…)=c3(…)=c4(…)=d(x,b,c0,d,cX,cX-1,…,c3,c2,c1)=…
But the second leaves iterated versions behind:
c0²(x+1,b,c0,d,c4,c3,c2,c1)
=c0(9^x+1,b^x+1,c0^x+1,d^x+1,c4^x+1,c3^x+1,c2^x+1,c1^x+1)
=c1^x(c2^x(c3^x(c4^x(d^x(9^x+1,b^x+1,c0^x+1,d^x+1,c4^x+1,c3^x+1,c2^x+1,c1^x+1)))))

When d^x is finally calculated c4 will take a much more iterated version of d the next time. When c4^x is finally calculated c3 will take a much more iterated version of c4,…
This creates a really powerful version of iteration because d:

Improves b using c0
Improves c0 using b
Improves all the layers of nesting using b
The improves themselves improve, this means d becomes more powerful when it is iterated more.

Creating this long chain of c is what what e(x)=c0^x(x,b,c0,d,c(a(x)),c(a(x)-1),c(a(x)-2),…,c(3),c(2),c(1))[1] does.
It uses c0^x to bypass that c0 would just give d.
The [1] means that it will eventually return the second output of d^…. So b^….
At this point I couldn't think of any thing to do with e(x) to significantly increase it's output except increasing input.
So f(x,a)=a(x),e(a(x))(x,a)[1](x) uses the b^… generated by e(x) to output a better base function and uses that base function to call e(x) with a bigger input.
g(x)=e(x)(x,f)[1](x,a)[1](x) uses a final e(x) to nest f and produces a really powerful function.
Fgh approximation
I will need help approximating this number with any sort of fgh.
Old version: fωω6(fωω5 (9e999)), Try it online! Revision history of explanation

Actually, f_1(x) = x+x, but in the long run, this doesn't matter too much.

Could you explain your fundamental sequences a bit more?

@SimplyBeautifulArt ow yes I forgot to update that after I changed it from x*x.

@SimplyBeautifulArt My answer doesn't use any ordinals so it's hard for me to explain it with ordinals. All I really can do is give the definition of my functions and an approximation of the effect in the fgh. Example: a2(f_n)~=f_{n+1}

Ruby, fε02(5), 271 bytes
m=->n{x="";(0..n).map{|k|x+="->f#{k}{"};x+="->k{"+"y=#{n<1??k:"f1"};k.times{y=f0[y]};y";(2..n).map{|l|x+="[f#{l}]"};eval x+(n<1?"":"[k]")+"}"*(n+2)}
g=->z{t="m[#{z}]";(0...z).map{|j|t+="[m[#{z-j-1}]]"};eval t+"[->n{n+n}][#{z}]"}
p m[5][m[4]][m[3]][m[2]][m[1]][m[0]][g][6]

Try it online!
This is based off of the m(n) map.
Explanation:
m[0][f0][k] = f0[f0[...f0[k]...]] with k iterations of f0.
m[1][f0][f1][k] = f0[f0[...f0[f1]...]][k] with k iterations of f0.
m[2][f0][f1][f2][k] = f0[f0[...f0[f1]...]][f2][k] with k iterations of f0.
In general, m[n] takes in n+2 arguments, iterates the first argument, f0, k times onto the second argument, and then applies the resulting function onto the third argument (if it exists), then applies the resulting function onto the fourth argument (if it exists), etc.
Examples
m[0][n↦n+1][3] = (((3+1)+1)+1 = 6
In general, m[0][n↦n+1] = n↦2n.
m[0][m[0][n↦n+1]][3] = m[0][n↦2n][3] = 2(2(2(3))) = 24
In general, m[0][m[0][n↦n+1]] = n↦n*2^n.
m[1][m[0]][3]
= m[0][m[0][m[0][n↦n+1]]][3]
= m[0][m[0][n↦2n]][3]
= m[0][n↦n*2^n][3]
= (n↦n*2^n)[(n↦n*2^n)[n↦n*2^n(3)]]
= (n↦n*2^n)[(n↦n*2^n)[24]]
= (n↦n*2^n)[402653184]
= 402653184*2^402653184

In general, m[1][m[0]][n↦n+1] = f_ω in the fast-growing hierarchy.

g[z] = m[z][m[z-1]][m[z-2]]...[m[1]][m[0]][n↦2n][z]

and the final output being
m[5][m[4]][m[3]][m[2]][m[1]][m[0]][g][6]

Python 2, 181 bytes
def B(s):
 D=range(1,s);B=[[A]for A in D]+[[0]]
 for C in B[::-1]:
  for F in D:C+=[B[C[-1]][C[0]]]
 A=1;E=B[0]
 while s//A*E[:A]!=E:A*=2
 return A
A=0
while B(2**A)<99:A+=1
print A

Try it online!
Much, much larger than Loader’s number. It is well defined.
Nothing new. This is known as the Inverse Laver function.

What is the proof-theoretic strength here, both upper and lower bounds? To turn into a function, replace 99 with an input variable, I presume. Then what is the strength of the statement that the function is total?

Googling a bit, I could not find a clear statement, but it appears the situation is something like: The program constructs finite approximations to an (infinite) left-distributive algrebra, and the termination proof for the program depends on that (or rather some subset) being infinite. Originally, the properties of left-distrib algrebras used a very large cardinal (rank-in-rank). However, Dehornoy later gave an algebraic construction avoiding the set theoretic machinery. The latter makes me skeptical that the function is particularly fast growing - please correct me if I'm wrong!

Ok, https://arxiv.org/abs/1812.02761 appears to have a summary as of 2018 - the growth rate is uncertain, above primitive recursive and provably total given some very large cardinals - i.e., completely wide open.

Javascript, 483 bytes
So, I'm just reusing a program I wrote for "Golf a number bigger than TREE(3)". The program results in \$f_{TFBO+1}(3) = f_{TFBO}(f_{TFBO}(f_{TFBO}(3)))\$ in the fast-growing hierarchy (3rd place), where \${TFBO}\$ is the Takeuti-Feferman-Buchholz Ordinal \$\psi(\Omega_{\omega+1})\$. It uses Buchholz hydras and implements the BH function. Here is my compressed code, which was done with Naruyoko's Javascript compressor:
_="69{%t.length-1D*6m#{%B]}*6s#{t.splice(m#,14*@n=1;*6e#{7==0/s#;if(9>1/$i=0;i<n;i:t'B-1]4}}7>0&&typeof t==\"number\"/$i=98t[i]<m#8i--/}@s;$j5i8j <= 98j:s't[j]4@?5s;?[j]=?[i]-1;?[l(?)]=0;s#;$k508k <= l(?)8k:t'?[k]4}7==A/B]=n+1Dn += 1;%tD*6b(k/i5[\"+\",0];$l508l < k-28l:i'A)}while(l(i)>=0/i=e(i4%nD*Console.log(b(b(b(3))));#(t)$for(let %return '.push(*\n    /){4)D5 = 6function 7if(m#8; 9l#:++/?sa@var A\"w\"Bt[9D;}";for($ of"DBA@?:987654/*'%$#")with(_.split($))_=join(pop());eval(_)

This is basically incomprehensible, with only fragments of the original code revealing themselves, so here is the original code:
function l(t){return t.length-1;}
function m(t){return t[l(t)]}
function s(t){t.splice(m(t),1);}
var n=1;
function e(t){if(m(t)==0){s(t);if(l(t)>1){for(let i=0;i<n;i++){t.push(t[l(t)-1]);}}}if(m(t)>0&&typeof t=="number"){for(let i=l(t); t[i]<m(t); i--){}var s;for(let j = i; j <= l(t); j++){s.push(t[j]);}var sa = s;sa[j]=sa[i]-1;sa[l(sa)]=0;s(t);for(let k = 0; k <= l(sa); k++){t.push(sa[k]);}}if(m(t)=="w"){t[l(t)]=n+1;}n += 1;return t;}
function b(k){i = ["+",0];for(let l = 0; l < k-2; l++){i.push("w")}while(l(i)>=0){i=e(i);}return n;}
Console.log(b(b(b(3))));

Explanation
This program, as I mentioned earlier implements Buchholz hydras, which are stored as arrays. The program has functions l, m and s, which just serve as shorthand for commonly repeated chunks of code. The function e takes a given hydra and expands it using rules.
It was proven by Buchholz that you can always kill a hydra in a very large, yet finite, amount of steps, so this is what the program uses. The function b(n) produces the hydra [+,0] and then a string of n-2 \$\omega\$s, and returns the number of steps it took to be killed.
The number which it returns is \$BH^3(3)\$, which is around \$f_{\psi_0(\varepsilon_{\Omega_\omega+1})+1}(3)\$ in the FGH.
Size
The function \$BH(n)\$ which this program implements is proven to eventually dominate (overtakes) any function which is provably total in \$\Pi^1_1\$-comprehension with bar induction (\$\Pi^1_1-CA+BI\$).
In fact, even if I replaced "chain of n-2 \$\omega\$s" with "chain of n-2 ones", I would still get third place.
However, I have to say, Simply Beautiful Art, your achievement of second place is simply beautiful, and I could never beat it just by trivially this program. Since \$TFBO = \psi_0(\varepsilon_{\Omega_\omega + 1})\$, I could say that \$TFBO_2 = \psi_0(\varepsilon_{\Omega_{TFBO} + 1})\$, and so on, if I allowed labels up to \$TFBO_{TFBO_{...}}\$ instead of just \$\omega\$, my new growth rate would fall around \$\psi_0(\chi(\Omega))+1\$, which is tiny compared to \$\psi_0(\chi(\Omega_{M+\chi(\Omega_M+1^{Ω_{M+1}})}))+29\$

The function b takes a parameter n and returns n without modifying it (the global variable n is distinct from this parameter and has no effect on it), so b(b(b(3))) returns 3, which may be slightly smaller than what you intended. Also, writing to a variable is not one of the allowed output methods.

Ooh sorry, that's not what I intended to happen. I will fix it


text:
Length of a Sumac sequence
A Sumac sequence starts with two integers: t1 and t2.
The next term, t3, = t1 - t2
More generally, tn = tn-2 - tn-1
The sequence ends when tn < 0.
Your challenge: Write a program or function that prints the length of a Sumac sequence, starting with t1 and t2.

t1 and t2 are integers within your language's range.
Standard loopholes apply.

Test cases
t1  t2       sumac_len(t1,t2)

120  71      5
101  42      3
500  499     4
387  1       3

Bonus street cred:
3    -128    1
-314 73      2

This is code-golf, so shortest answer in bytes wins.

Closely related, if not a duplicate

This seems to be a good challenge, but is a little unclear. Are we supposed to take t1 and t2 as input? And what is i in the test cases?

Is it guaranteed that t1 and t2 are >= 0?

@cairdcoinheringaahing The "Your challenge" statement clearly states: starting with t1 and t2. - Also see the test cases

Updated test cases to be a little more clear what's input and what's output.

Not a dupe; we're printing the length, and we're starting with two arbitrary numbers instead of 1 & 2. Editing to clarify that they're integers.

Can we have a test case where t_1 is negative? That is, if it can be...

Sure, why not. @totallyhuman.

Putting the ones with negatives under "bonus street cred" to avoid the problem.

@Blacksilver Huh? What's that bonus exactly? Bonus are generally discouraged anyway

Do we have to handle t_1 = t_2 = 0? Does "bonus street cred" mean we don't have to handle t_1 < 0 or t_2 < 0?

Husk, 8 bytes
→V<¡oG-↔

Takes input as a 2-element list.
Try it online!
Explanation
→V<¡oG-↔  Implicit input, say p=[101,42]
   ¡      Iterate on p:
       ↔    Reverse: [42,101]
    oG-     Cumulative reduce by subtraction: [42,59]
          Result is infinite list [[101,42],[42,59],[59,-17],[-17,76],[76,-93]...
 V<       Find the first index where adjacent pairs are lexicographically increasing.
          In our example [42,59] < [59,-17], so this gives 2.
→         Increment: 3

Haskell, 22 bytes
a#b|b<0=1|c<-a-b=1+b#c

Try it online!
I really wish there was a way to pattern match for a negative number...
Explanation
a#b|b<0=1|c<-a-b=1+b#c

a#b                     -- define a function (#) that takes two arguments a and b
   |b<0                 -- if b is negative...
       =1               -- return 1
         |              -- otherwise...
          c<-a-b        -- assign a-b to c...
                =  b#c  -- and return the result of (#) applied to b and c...
                 1+     -- incremented by 1

I think the explanation is less clear than the code itself for once. :P

@WheatWizard That's most probably because I suck at explanations. :P

Husk, 12 11 bytes
V<0t¡ȯF-↑2↔

Try it online!
Takes the bonus street cred for whatever that's worth.
Explanation
    ¡ȯ       Repeatedly apply the function to the right to the list of all
             previous values and collect the results in an infinite list.
          ↔  Reverse the list of previous results.
        ↑2   Take the first two values (last two results).
      F-     Compute their difference (using a fold).
   t         Discard the first element.
V<0          Find the first index of a negative value.

MATL, 13 bytes
`yy-y0<~]N2-&

This handles negative inputs (last two test cases).
Try it online! Or verify all test cases.
Explanation
`        % Do...while
  yy     %   Duplicate top two elements. Implicit inputs first time
  -      %   Subtract
  y      %   Duplicate from below: push previous term
  0<~    %   Is it 0 or greater? This is the loop condition
]        % End. Proceed with next iteration if top of the stack is true
N        % Push number of elements in stack
2-       % Subtract 2
&        % Specify that the next function, namely implicit display, should
         % only display the top of the stack

Ruby, 29 bytes
->a,b{(1..a).find{a<b=a-a=b}}

Try it online!

a<b=a-a=b ...How does Ruby parse that..?

Brain-Flak, 142 90 bytes
((()){{}<(({}({}))[({}[{}])({})])([(({})<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}>}<>)

Try it online!
Not very short. Takes input backwards.
Explanation
(
 (())   #Push 1
 {      #Until 0
  {}    #Pop (+1 to counter)
  <(({}({}))[({}[{}])({})])  #tn = tn-1 - tn-2
  ([(({})<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}>  #Greater than 0?
 }      #End loop
 <>     #Get rid of everything
)       #Push result

05AB1E, 11 bytes
[DŠ-D0‹#]NÌ

Try it online!
Explanation
Takes input as t2, t1
[             # start a loop
 DŠ           # duplicate top of stack and move it down 2 positions
   -          # subtract the top 2 values
    D0‹#      # if a copy of the top value is negative, break loop
        ]     # end loop
         NÌ   # push iteration index+2

C (gcc), 32 27 26 bytes
-5 bytes thanks to totallyhuman's abuse of gcc (seems to work on tcc too)
-1 byte thanks to PrincePolka
f(a,b){a=b<0?:1+f(b,a-b);}

Try it online!

26 bytes since, b<0 evaluates to 1, change ?1:1 to ?:1

Mathematica, 55 bytes
(t=1;While[Last@LinearRecurrence[{-1,1},#,t++]>0];t-2)&

Try it online!
and now the regular boring approach by @totallyhuman
Mathematica, 25 bytes
If[#2<0,1,1+#0[#2,#-#2]]&

Try it online!

FYI, the regular boring approach is less than half as long.

@totallyhuman boring indeed... you can save a byte #1 to #

J, 22 bytes
[:#({:,-/)^:(0<{:)^:a:

How it works:
                  ^:a: - Repeat until the result stops changing, store the results in a list
          ^:(0<{:)     - repeat if the second term is positive
   ({:,-/)             - makes a tuple (second, first minus second)
[:#                    - number of elements in the list ([: caps the fork)

Try it online!

APL (Dyalog), 23 bytes
2∘{0>-/⍵:⍺⋄(⍺+1)∇-⍨\⌽⍵}

Try it online!
How?
2∘ - with an initial accumulator of 2,
-/⍵ - if the next term
0> - is below 0,
⍺ - return the accumulator. otherwise,
(⍺+1) - increase the accumulator
∇ - and recurse with
-⍨\⌽⍵ - the last two items reversed and differenced.
      {⍵} 8 2
8 2
      {⌽⍵} 8 2
2 8
      {-⍨\⌽⍵} 8 2
2 6

Pyth, 11 bytes
This is a recursive function that takes two arguments, G and H. The link is slightly modified in order to actually call the function on the given input.
M|<H0hgH-GH

Test suite.

Java (OpenJDK 8), 85 75 bytes
(b,c)->{int d,k=1;for(;;){if(c<0)break;else{d=c;c=b-c;b=d;k++;}}return k;};

Try it online!
ungolfed:
(b,c)->{
    int d,k=1;
    for(;;){
        if(c<0)
            break;
        else{
            d=c;
            c=b-c;
            b=d;
            k++;
        }
    }
    return k;
};

I believe this would be shorter as a lambda.

@Potato44 indeed, but I did not have time yesterday to do it, but I did it now and saved 10 bytes.

59 bytes

Perl 6, 24 19 bytes
-5 bytes thanks to Brad Gilbert b2gills.

{+(|@_,*-*...^0>*)}

Try it online!
Explanation: The whole thing in the parentheses is exactly the sequence in question (|@_ are the first 2 terms (= the two parameters), *-* is a function that takes two arguments and returns their difference, and * <0 is the stopping condition (term less than 0). We omit the last term with ^ after the ...). We then force the numerical context by the + operator, which yields the length of the sequence.

{+(|@_,*-*...^0>*)}

@BradGilbertb2gills: Thank you. I had a large break with golfing, so I'm a bit rusty. What I don't get, though, is why you must put the space in * <0*, but why you don't need it in 0>*`...

The space is needed so it doesn't get confused with %h<a>

Java (OpenJDK 8), 44 bytes
int f(int a,int b){return b<0?1:1+f(b,a-b);}

Try it online!
Shortest iterative I found (50 bytes)
(a,b)->{int c=1;for(;b>=0;c++)b=a-(a=b);return c;}

Try it online!

dc, 24 bytes
?[dsb-1rlbrd0<a]dsaxz1-p

Try it online!
Explanation
?                         # read input                | 71 120
 [dsb-1rlbrd0<a]          # push string               | [string] 71 120
                dsa       # copy top to register a    | [string] 71 120
                   x      # execute the string        | -5 27 1 1 1 1
                    z     # push length of stack      | 6 -5 27 1 1 1 1
                     1-   # decrement top by 1        | 5 -5 27 1 1 1 1
                       p  # print top

 # string in register a:

  dsb                     # copy top to register b    | 71 120
     -                    # subtract                  | 49
      1                   # push 1                    | 1 49
       r                  # swap top two elements     | 49 1
        lb                # load register b           | 71 49 1
          r               # swap top two elements     | 49 71 1
           d0<a           # if top < 0 execute register a

Z80 Assembly, 10 bytes
This version attempts to do the "street cred" version of the task. However, for  the suggested test case where t1=-314, t2=73 this program produces answer "0", which, frankly, makes a little bit more sense than "2".
SumacLen:
        xor a           ; HL = t[1], DE = t[2], A is the counter
Loop:   bit 7,h
        ret nz          ; stop if HL is negative
        inc a
        sbc hl,de       ; HL = t[3], DE = t[2]
        ex de,hl        ; HL = t[2], DE = t[3]
        jr Loop

The test program for ZX Spectrum 48K written using Sjasmplus assembler can be downloaded here. A compiled snapshot is also available.

Presumably the non-bonus version uses Loop: ret c instead?

Yes, checking the sign bit of H would no longer be needed. "bit 7,h" can be removed and "ret nz" replaced by "ret c", with "inc a" moving just in front of it. 8 bytes altogether.

Yeah; the 2 result is really just a thing with my program.

Do you mean that 0 is an acceptable answer for that test case? Or do you mean that it would be better to modify my program to output 2?

Common Lisp, 59 42 bytes
(defun f(a b)(if(< b 0)1(1+(f b(- a b)))))

Try it online!

JavaScript (ES6), 24 bytes
Returns true instead of 1.
f=(a,b)=>b<0||1+f(b,a-b)

Test cases

f=(a,b)=>b<0||1+f(b,a-b)

console.log(f(120,  71  )) //    5
console.log(f(101,  42  )) //    3
console.log(f(500,  499 )) //    4
console.log(f(387,  1   )) //    3

console.log('Bonus street cred:')
console.log(f(3,    -128)) //    1
console.log(f(-314, 73 ))  //    2

@totallyhuman Then you would need f(b)(a-b) so no saving.

What if a<0? (1 more to go)

Update: you are no longer required to support negative input, but it's cool if you do.

Python 2, 29 bytes
f=lambda a,b:b<0 or-~f(b,a-b)

Try it online!
Returns True instead of 1.

source: Stack Exchange

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

sort: votes


text:
Is my kids' alphabet mat properly grouped by colors?
My kids have an alphabet mat to play with, something like this:

After months with the tiles of the mat randomly placed, I got tired and placed all the tiles of the mat grouped by sections according to their background colors. So, if the letters represent the background color, I got a mat like this:
AABBCDDDE
ABBCCCDEE
ABCCCCDDE
AACCCDDEE
AAAACCCCE
AAAAAACCC

So, for colors A, B, C, D and E there is always a way to connect all the tiles with the same background color either horizontally or vertically in the mat. That's what I call a mat properly grouped by colors. You can see the groups for the previous example in the following tables:
AA
A
A
AA
AAAA
AAAAAA

  BB
 BB
 B

    C
   CCC
  CCCC
  CCC
    CCCC
      CCC

     DDD
      D
      DD
     DD

        E
       EE
        E
       EE
        E

Also, there is only one group for every color, so this would not be valid:
ABA
ABA

Because color A tiles are not grouped in only one group. This also would not be valid because the tiles do not connect either horizontally or vertically:
AB
BA

The challenge
Given a 2-dimensional array of characters in the printable ASCII range (does not need to be a square one as long as the size of both dimensions are equal to or greater than 1), check if the array represents a mat properly grouped by colors (each different character in the array represents a different color). Input may be in any reasonable format as long as it represents a 2-dimensional array of characters (2D char array, array of strings of the same length, and so on), and output must be a pair of truthy and falsey values (0/1, 't'/'f', true/false, whatever as long as something is returned and the return values are consistent across inputs).
This is code-golf, so may the shortest program/function/method/lambda for each language win!
Examples
A    truthy

AB
AB   truthy

AB
BA   falsey

ABCDE    truthy

ABCDC    falsey

**::dd22
***:d222
*:::::22    truthy

$$$%%%&&
$$%%&&&&
&&$$$%&&    falsey

AABBCDDDE
ABBCCCDEE
ABCCCCDDE
AACCCDDEE
AAAACCCCE
AAAAAACCC   truthy

AABB
ABBA
AAAA    truthy

AAAB
AAAA
AAAA    truthy

My mat properly grouped by colors

(I still have to fix those borders...)

Related: 1D version

Out of curiosity, why wouldn't you arrange the mat in alphanumerical order? Nothing to do with the challenge of course, just wondering

@cairdcoinheringaahing because then my particular OCD would not be satisfied. :-)

Your kids continue to be a source of inspiration for code golf challenges :-)

@LuisMendo yes, the pair of values must be consistent across inputs, and you can choose any two values as long as they are consistent (you may choose 0 for true and 1 for false if you want).

Why do the colours have to be represented by characters rather than some other input (like integers or even pixels maybe)?

So we need to be able to support 95 different colours?

speaking of ocd, this challenge won’t be complete without a picture of the mat properly grouped

@JonathanAllan sorry, the tiles have a background color and an alphanumeric character in another color, so I immediately thought about representing color with chars, but you are right, it could be done with numbers as inputs.

Suggested test case: AABB, ABBA, AAAA / truthy. The rightmost A of the 2nd row is connected only with the last row. This pattern doesn't appear in the existing test cases.

@Jonah I included an image of my mat. :-)

@Charlie it is bothering me that you didn't take the color of the letters into account... For example bring the yellow tile with the purple 6/9 adjacent to the purple tiles, swap the purple tile with the green "W" with the tile on top of that... So much wasted potential! :P

@LucaH I hadn't noticed that! Now I feel the urge to leave my office and ran home to swap those tiles!!

@Charlie do it after work, I don't want you to lose your job :D

I could swear we've had this before. Or am I (mis)remembering another, completely different challenge involving one of those mats?

@Shaggy you are probably remembering this other challenge but it has nothing to do with this.

I count 6 background colors in the pix...?

MATL, 16 15 bytes
1e"G@=4&1ZI1>vzg

Input is a 2D char array (with rows separated by ;). Output is 0 if input qualifies, or 1 otherwise.
Try it online! Or verify all test cases.
Explanation
The code essentialy checks if each char in the input has only one connected component, considering 4-connectivity (that is, no diagonals).
Repeated chars are processed repeatedly (which is golfier than deduplicating).
1e       % Implicit input. Reshape into a row vector of chars
"        % For each char
  G      %   Push input again
  @      %   Push current char
  =      %   Equal (element-wise)? Gives a matrix of zeros and ones, where one
         %   represents the presence of the current char
  4      %   Push 4. This will indicate 4-connectivity
  &1ZI   %   Matrix with labels of connected componnents. Inputs are a number (4)
         %   to indicate connectivity, and a binary matrix. The output is a matrix
         %   the same size as the input where each connected componnent of ones
         %   in the input is replaced by a different integer starting at 1
  1>     %   Greater than 1 (element-wise)? The result is a matrix. If the result
         %   is true for some entry the input doesn't qualify
  v      %   Concatenate vertically with results from previous iterations
  z      %   Number of nonzero/true values
  g      %   Logical. Converts nonzero to true
         % Implicit end. Implicit display. False / true are displayed as 0 / 1

Befunge-93, 317 bytes
Edit: Fixed for proper byte-count. Also could be golfed further
93+:10pv  +93p01+1g01_  v@.1<
gp00g1+>00p~1+:93+`!#^_1-00g10
50p93+:vv_v#!:gg03:p02:<>40p#
!`g01: <>\ 1+:vvp05:+<@^p03_^#
v93$_v# !- g00<4v04g<^1<vp06:<
>+\!\>\ 3v> 40v0>g-v^<.g>:70vp
07_v#:<^ >#+0# g#\<  10\v4gg<^
!#v _$^  g03p <\ v1_#:^5>0g  -
   <    ^ g02p1< >-:#^_^#:g05
-1<   ^p\g06\0\+1:\g06\-1:\g06:\+1g06:g07

Prints 1 as the truthy, 0 as the falsey
Try It Online
Here's a visualisation of the path the pointer takes

Note: this is for an old version

How it works
Here's some quick and dirty pseudocode
a = 2Darray() # from 12,12 down and to the right
arrayLocation = 12
x = arrayLocation #stored at 0,0
y = arrayLocation #stored at 1,0
i = input()       #stored in the stack
while (i != 0):
    if (i == 10):
        y++
        x = init
    else
        a[x][y] = i
        x++
    i = input

new.x = init    #stored at 2,0
new.y = init    #stored at 3,0

currentChar = 0    #stored at 4,0
chars = array()    #stored at 1,1 onwards
charnum = 0        #stored 5,0
ToCheck = array()  #stored in the stack

current.x = null   #stored at 6,0
current.y = null   #stored at 7,0

while (new.y < y):
    if (a[new] != 0)
        currentChar = a[new]
        toCheck[] = new
        while (toCheck)
            current = toCheck.pop()
            if (a[current] == currentChar)
                toCheck.append(adjacent(current))
                a[current] = 0
        foreach (chars as char)
            if (char == currentChar)
                return 0
        charNum++
        chars[charNum] = char
    new.x++
    if (new.x > x)
        new.x = init
        new.y++

return 1

Basically, after storing the input, it goes through the whole thing, checking each space. When it finds a space with a character in it it adds the coordinates to the stack. Then it checks the spaces around it for the same character recursively, setting each space to 0. When it has exhausted that character's section, it checks whether that character has already had a section. If so, return 0. If not, add it to the array of characters. Once it has gone through the whole grid with no duplicates, it returns 1.
For people familiar with Befunge, here's a spaced out version of the code
96+:10p    v    +69p01+1g01_v
`+96:+1~p00<+1g00pg01g00-1_^#
v                           <
>40p50p96+:v                ^
v    @.1<  >
>:10g `#^_30p:20p:30gg:#v_$>1+:00g-!#v_0   >30g+
v                       <  ^         >$96+1^
>40p30gv                   ^
       >:!#v_70p:60p:70gg40 g-!#v_$>
           v               ^     > ^
1:\g06\+1:g 07\g07\-1:\g07\ +1: <^p\g06\0\-
v          <               ^
>50gv   >5\g1+:50p40g\1p20g^
    >:!#^_:1g40g-!#v_1-
                   >0.@

to be honest, I feel like you should count it as 337 bytes. Otherwise, how do you specify the dimensions of the code within the file itself? The newlines should count too.

@NieDzejkob Yeah, I’ve since changed how I count bytes and conformed to whatever TIO says. Also I had the line count wrong anyway? Maybe tomorrow I’ll have a go at shortening it a bit further

J, 66 bytes
c=.1=+/@,+.]-:]*[:*@+/((,|."1)0,.1 _1)&(|.!.0)
[:*/[:c"2[="_ 0~.@,

c defines a verb that tells you if a matrix of ones and zeros is connected.  It treats singleton ones as a special case of true.  Otherwise it takes an orthogonal neighbor count of every cell, then the signum of that count, then multiplies that with the original matrix: if that product equals the original matrix, then it's connected.
The neighbor count is achieved by shifting in all 4 directions, then summing.  The 4 direction shift is achieved using the "x-arg can by a table" feature of rotate/shift |.
Finally, the answer itself achieved by creating a ones/zeros matrix for every unique ~. element of the input, and then ensuring that all of those matrices are connected.  This is the verb in the second line.
Try it online!

JavaScript (ES6), 114 bytes
Takes input as an array of strings. Returns 0 or 1.
a=>(C={},F=x=>!C[c=a[y][x]]|(g=v=>(a[y+v]||[])[x]==c)(-1)|g(1)|g(0,x--)|g(0,x+=2)?a[y+=!c]?F(C[c]=c?x:0):1:0)(y=0)

Test cases

let f =

a=>(C={},F=x=>!C[c=a[y][x]]|(g=v=>(a[y+v]||[])[x]==c)(-1)|g(1)|g(0,x--)|g(0,x+=2)?a[y+=!c]?F(C[c]=c?x:0):1:0)(y=0)

console.log(f([ // 1
  "A"
]))

console.log(f([ // 1
  "AB",
  "AB"
]))

console.log(f([ // 0
  "AB",
  "BA"
]))

console.log(f([ // 1
  "ABCDE"
]))

console.log(f([ // 0
  "ABCDC"
]))

console.log(f([ // 1
  "**::dd22",
  "***:d222",
  "*:::::22"
]))

console.log(f([ // 0
  "$$$%%%&&",
  "$$%%&&&&",
  "&&$$$%&&"
]))

console.log(f([ // 1
  "AABBCDDDE",
  "ABBCCCDEE",
  "ABCCCCDDE",
  "AACCCDDEE",
  "AAAACCCCE",
  "AAAAAACCC"
]))

console.log(f([ // 1
  "AABB",
  "ABBA",
  "AAAA"
]))

console.log(f([ // 1
  "AAAB",
  "AAAA",
  "AAAA"
]))

Formatted and commented
a => (                            // given an array of strings a
  C = {},                         // C = object holding encountered characters
  F = x =>                        // F = recursive function taking x:
    !C[c = a[y][x]]               //   c = current character; is it a new one?
    | (g = v =>                   //   g = helper function taking v
        (a[y + v] || [])[x] == c  //       and testing whether a[y + v][x] == c
      )(-1)                       //   test a[y - 1][x]
    | g(1)                        //   test a[y + 1][x]
    | g(0, x--)                   //   test a[y][x - 1]
    | g(0, x += 2) ?              //   test a[y][x + 1]; if at least one test passes:
      a[y += !c] ?                //     increment y if c is undefined; if a[y] exists:
        F(C[c] = c ? x : 0)       //       update C, update x and do a recursive call
      :                           //     else:
        1                         //       all characters have been processed -> success
    :                             //   else:
      0                           //     invalid character detected -> failure
)(y = 0)                          // initial call to F, starting with x = y = 0

JavaScript (ES6), 181 bytes
(d,o={})=>{f=(i,j,c,l=d[i])=>{if(c&&l&&l[j]==c){l[j]='';f(i-1,j,c);f(i+1,j,c);f(i,j-1,c);f(i,j+1,c);o[c]=1}};d.map((e,i)=>e.map((c,j)=>o[c]||f(i,j,c)));return!d.some(e=>e.join(''))}

Whenever a new color tile is found, fill the connected ones with empty strings.  If the mat is properly grouped by colors, all tiles should be filled with empty strings.
Test Code

const t =
(d,o={})=>{f=(i,j,c,l=d[i])=>{if(c&&l&&l[j]==c){l[j]='';f(i-1,j,c);f(i+1,j,c);f(i,j-1,c);f(i,j+1,c);o[c]=1}};d.map((e,i)=>e.map((c,j)=>o[c]||f(i,j,c)));return!d.some(e=>e.join(''))}
;

const mat = s=>s.split('\n').filter(l=>l).map(l=>l.split(''));
console.log('true?', t(mat(`
A
`)));
console.log('true?', t(mat(`
AB
AB
`)));
console.log('false?', t(mat(`
AB
BA
`)));
console.log('true?', t(mat(`
ABCDE
`)));
console.log('false?', t(mat(`
ABCDC
`)));
console.log('true?', t(mat(`
**::dd22
***:d222
*:::::22
`)));
console.log('false?', t(mat(`
$$$%%%&&
$$%%&&&&
&&$$$%&&
`)));
console.log('true?', t(mat(`
AABBCDDDE
ABBCCCDEE
ABCCCCDDE
AACCCDDEE
AAAACCCCE
AAAAAACCC
`)));
console.log('true?', t(mat(`
AABB
ABBA
AAAA
`)));
console.log('true?', t(mat(`
AAAB
AAAA
AAAA
`)));

How does your program take input?

Wolfram Language (Mathematica), 96 bytes
And@@(ConnectedGraphQ@Subgraph[GridGraph@Dimensions[t],Tr/@Position[c,#]]&/@(c=Join@@(t=#)))&

Try it online!
Takes input as a 2D list of characters: for example, {{"A","B"},{"C","D"}}.
The  character is \[Transpose].
How it works
For each character c in the input, takes the Subgraph of the GridGraph of the same Dimensions as the input which corresponds to every Position in which c occurs, and checks if it's a ConnectedGraphQ.

Python 2, 247 bytes
def f(a):
 b=map(list,a.split('\n'));l=len(b[0])
 for c in set(a):i=a.find(c);g(b,i/l,i%l,c)
 print all(set(l)<={0}for l in b)
def g(a,i,j,c):
 if len(a)>i>-1<j<len(a[0])and a[i][j]==c:
	for x,y in(0,1),(0,-1),(1,0),(-1,0):g(a,i+x,j+y,c);a[i][j]=0

Try it online!

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


text:
Garden architecture - ASCII style
We have a square 10x10 meter garden outside our house. We want to plant grass and make a terrace. We have decided how to divide the garden, but we haven't decided the ratio between amount of grass vs terrace.
We need help visualizing it, and ASCII-art is clearly the best way to do so.

Challenge:
Take an integer in the inclusive range [0, 100] (or optionally decimal [0, 1]) representing how many percent of the garden should be terrace.
One square meter of terrace will be represented by either a dash - or a bar |. One square meter of grass will be represented by a hash mark #.

If the amount of terrace is less than or equal to 50%, then the garden should be covered with bars, starting in the bottom left corner, and fill vertically, then horizontally.
If the amount of terrace is more than 50% then we want the decking to be the other way (dashes instead of bars), and starting in the bottom left corner, and fill horizontally, then vertically.

Examples:
N = 25%
||########
||########
||########
||########
||########
|||#######
|||#######
|||#######
|||#######
|||#######

N = 75%
##########
##########
-----#####
----------
----------
----------
----------
----------
----------
----------

N = 47%
||||######
||||######
||||######
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####

N = 50%
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####

N = 51%
##########
##########
##########
##########
-#########
----------
----------
----------
----------
----------

N = 0%
##########
##########
##########
##########
##########
##########
##########
##########
##########
##########

N = 100%
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------

This is code-golf so the shortest code in bytes win. Standard rules regarding I/O. This is ASCII-art, so the output should look like the examples above. I.e. outputting ["|", "|" ...] is not OK.
Explanations are encouraged as always :)

My first impression was that the two cases would just mean solving two separate golfing tasks, but there's common structure to be found that makes it worth sharing code between them.

APL (Dyalog), 34 bytes
Anonymous prefix function expecting integer in range 0–100. Assumes ⎕IO (Index Origin) to be 0, which is default on many systems.
{'#-|'[⊖⍉⍣s⊢10 10⍴100↑⍵⍴1+s←50≥⍵]}

Try it online!
{…} lambda; ⍵ is argument:
 '#-|[…] index the string with the following array:
 50≥⍵ 1 if 50 is greater than or equal to argument, else 0
 s← store in s (for small)
 1+ increment
 ⍵⍴ cyclically reshape to argument-length
 100↑ take the first hundred of that, padding with zeros
 10 10⍴ reshape to ten rows and ten columns
 ⊢ yield that (separates s from 10 10)
 ⍉⍣s transpose if small
 ⊖ flip upside-down

{'#-|'[⊖(⍉+⍨)⍣(⍵≤50)⊢⍵>⍎¨∘.,⍨⎕d]}

Very close to my approach: {⊖⍉⍣c⊢10 10⍴(⍵/'-|'⊃⍨c←⍵≤50),100/'#'}

@EriktheOutgolfer you only need 99/'#'

@ngn oh right, ⍴

@EriktheOutgolfer Also '#' → ⍕#

@ngn That's quite different. Why don't you post it?

@Adám because I'm too lazy to explain it and I'm here only for the thrill of finding shorter answers :)

@ngn If you're OK with my explanation style then post and ping me, then I'll add an explanation.

@Adám I like how you explain things (seriously). Feel free to improve what I've just posted.

J, 39, 38 37 bytes
[:|.>&50|:'#-|'"0{~_10]\100{.]$1+51>]

How it works:
                     _10]\100{.]$1+51>] - prepares a 10x10 array of 0, 1 or 2
                                 1+51>] - 1 if N<=50 otherwise 2
                               ]$       - list of N copies of the above (1 or 2)
                          100{.         - the above list filled to 100 items with 0
                     _10]\              - reshape the list to a 10x10 array
           '#-|'"0                      - constant array of chars
                   {~                   - replaces each digit 0, 1 or 2 with #, - or |
     >&50                               - is N>50 ?
         |:                             - if not, transpose the array
                                          (in fact |: here is rearrange axes
                                           0 - transpose
                                           1 - leave it intact)
 |.@                                    - reverse the order ot the rows

Try it online!

{. with an over the bounds argument is a nice trick.

31 bytes: (]|.@|:_10{&'#|-'\100{.1+$)>&50

@ FrownyFrog - Great code!

@Jonah - Yes, it's very handy sometimes. I also tried  _100{.  which puts the fills at the beginning, but then I needed to reverse each row, so I gave it up.

JavaScript (ES6), 84 bytes
Takes input as an integer in [0...100].
n=>(y=9,g=x=>~y?'|-#'[[x,y][k=n/51|0]*9+x+y<n?k:2]+[`
`[x-9]]+g(x++-9?x:!y--):'')(0)

Test cases

let f =

n=>(y=9,g=x=>~y?'|-#'[[x,y][k=n/51|0]*9+x+y<n?k:2]+[`
`[x-9]]+g(x++-9?x:!y--):'')(0)

;[25, 75, 47, 50, 51, 0, 100]
.forEach(n => O.innerText += n + '%:\n' + f(n) + '\n')

Formatted and commented
n => (                          // given the terrace percentage n
  y = 9,                        // and starting with y = 9
  g = x =>                      // g = recursive function taking x:
    ~y ?                        //   if y is greater than or equal to 0:
      '|-#'[                    //     pick the relevant character:
        [x, y][k = n / 51 | 0]  //       using k = 1 if n > 50, 0 otherwise
        * 9 + x + y             //       and comparing either 10 * x + y or 10 * y + x
        < n ?                   //       with n; if we're located over the terrace area:
          k                     //         append either '|' or '-'
        :                       //       else:
          2                     //         append '#'
      ] +                       //     end of character insertion
      [`\n`[x - 9]] +           //     append a linefeed if x == 9
      g(x++ - 9 ? x : !y--)     //     update (x, y) and do a recursive call
    :                           //   else:
      ''                        //     stop recursion
)(0)                            // initial call to g with x = 0

Python 2, 121 117 116 bytes
def f(n):
 s=[('-|'[n<51]*n+'#'*100)[i*10:][:10]for i in range(10)]
 for l in[s,zip(*s)][n<51][::-1]:print''.join(l)

Try it online!

I think [i*10:-~i*10] can be [i*10:][:10].

@JonathanFrech Thanks :)

Jelly, 23 bytes
<©51ị⁾|-ẋḷ"”#ẋ³¤s⁵Z®¡ṚY

Try it online!
Change the number before Ç in the footer to change the input. Works as a monadic link in a program without command-line arguments, which is allowed.

Very nice answer +1. 23 bytes as a monadic link (ȷ2 -> ³)

I managed to get 24 bytes too, thought it might be a source of inspiration here too.

@Mr.Xcoder I did think of that, but I'm not really sure if I can assume such a thing (would only work in niladic programs? hmm...)

See this discussion I had with Dennis.

MATL, 26 bytes
'|-#'100:i>~o10eG50>?!E]P)

Try it online! Or verify all test cases.
Explanation
'|-#'     % Push this string
100:      % Push array [1 2 ... 100]
i         % Input a number and push it
>~        % Less than or equal (element-wise)? This transforms the
          % array into [true ... true false ... false]
o         % Convert to double. True becomes 1, false becomes 0
10e       % Rehaspe into 10-row matrix, in column-major order
G         % Push input
50>       % Greater than 50?
?         % If so
  !       %   Transpose
  E       %   Multiply by 2 (element-wise). So 0 remains as 0, and
          %   1 becomes 2
]         % End
P         % Flip vertically
)         % Index into string, modularly. So 1 corresponds to '|',
          % 2 to '-', and 0 to '#'
          % Implicitly display

SWI Prolog, 249 bytes
p(X):-write(X).
r(X,Y,G):-G=<50,10*X-Y+1=<G,p('|').
r(_,_,G):-G=<50,p('#').
r(X,Y,G):-(10-Y)*10+X>G,p('#').
r(_,_,_):-p('-').
l(_,11,_):-nl.
l(X,Y,G):-r(Y,X,G),Z is Y+1,l(X,Z,G).
a(10,G):-l(10,1,G).
a(Y,G):-l(Y,1,G),Z is Y+1,a(Z,G).
s(G):-a(1,G),!.

The solution is pretty straightforward. Procedure a creates rows, l writes chars to columns in a row and r decides what character should be printed out.

G<51 should work instead of G<=50.

Python 2, 85 bytes
T=j=10
n=input()+T
while j:print([(n-j)/T*'|',min(n-T*j,T)*'-'][n>60]+'#'*T)[:T];j-=1

Try it online!
In both cases each line is padded on the right by # to length 10, which lets us share that code between the two cases. The number 10 was used often enough that aliasing T=10 saved a decent number of bytes.

Invalid! From input 51 and after, it misses a row.

@EriktheOutgolfer Those edge cases.

@EriktheOutgolfer Thanks, I think this fixes it?

Looks like it's fixed.

Charcoal, 25 bytes
ＮθＧTχ#↶Ｆ÷θχ⟦χ⟧﹪θχ¿›θ⁵⁰‖Ｔ↖

Try it online! Link is to verbose version of code. Explanation:
Ｎθ                          Input integer into q
  Ｇ                         Draw filled polygon
   T                        Directions Right, Down, Left
    χ                       Size 10
     #                      Filled with `#`
      ↶                     Rotate cursor left (now points up)
       Ｆ÷θχ                 Repeat q/10 times (integer divide)
           ⟦χ⟧              Print 10 `|`s and move to the next column
              ﹪θχ           Print (q mod 10) `|`s
                 ¿›θ⁵⁰      If q > 50
                      ‖Ｔ↖   Reflect diagonally

@StewieGriffin Oops, wrong diagonal. Sorry for not checking.

That's actually 25 characters, but 61 bytes, isn't it?

@ZeroOne Charcoal uses its own code page.

Oh, I see! Thanks for the explanation. :)

Ruby, 92 82 bytes
->n{puts (r=0..9).map{|y|r.map{|x|n>(n>50?100-y*10+x:x*10+9-y)?"|-"[n/51]:?#}*''}}

Try it online!
How it works:
Every cell in the grid has a progressive number starting from the bottom left corner and proceeding horizontally or vertically depending on the value of n:
If n>50, the number is 100-y*10+x otherwise it's x*10+9-y

Husk, 24 bytes
↔?T†▼'-≤50⁰S↑C10+R⁰'|∞'#

Try it online!
Explanation
↔?T†▼'-≤50⁰S↑C10+R⁰'|∞'#  Input is a number, say n=12
                     ∞'#  Infinite string of #s: "#######...
                +         Prepend to it
                   '|     the character |
                 R⁰       repeated n times: "||||||||||||####...
             C10          Cut to pieces of length 10: ["||||||||||","||##########","##..
           S↑             Take first 10 pieces.
 ?     ≤50⁰               If n is at most 50,
  T                       then transpose,
   †▼'-                   else take minimum with '-' for each character.
↔                         Reverse, implicitly print separated by newlines.

SOGL V0.12, 21 bytes
┐* #M*+Mm√H.M»>?H§┐┌ŗ

Try it Here!
Explanation:
┐*                     push a vertical bar repeated input times
   #M*                 push "#" repeated 100 times
      +                add the two together
       Mm              mold to a length of 100
         √             convert to a square
          H            rotate clockwise
           .M»>?       if the input is greater than 50
                H        rotate the array clockwise again
                 §       reverse it horizontally
                  ┐┌ŗ    replace "|" with "-"

dc, 210 197 bytes
[256r^1-255/]sx?dddI/dsT9r-sYI%ddIr-sqdsesm-I/sN[[lNlxx124*PIlN-lxx35*PIPlq1-dsq0<o]dsoxlN1+sNledsq0<oq]sJ50!<J[Ilxx35*PIPlY1-dsY0<E]sElY0<E[lmlxx45*PIlm-lxx35*PIP]sClTI>C[Ilxx45*PIPlT1-dsT0<Z]dsZx

Try it online!

APL (Dyalog Classic), 33 bytes
f←{'#-|'[⊖(⍉+⍨)⍣(⍵≤50)⊢⍵>⍎¨∘.,⍨⎕d]}

Try it online!
based on Adám's answer
⎕d is the string '0123456789'
∘., Cartesian product
⍨ with itself
⍎¨ evaluate each - get a 10x10 matrix of 0..99
⍵> boolean matrix for where the argument ⍵ is greater
⊢ acts as separator
(⍉+⍨)⍣(⍵≤50) if ⍵≤50 double the matrix (+ with itself) and transpose (⍉)
⊖ vertical reverse
'#-|'[ ] index the string '#-|' with each element of the matrix

This explanation is excellent, imho.

q, 51 bytes
{-1@'reverse$[i;::;flip]10 10#@[100#"#";til x;:;"|-"i:x>50];}

Retina, 72 62 bytes
.+
$*|
T`|`-`.{51,}
$
100$*#
M!10`.{10}
O$s`(?<!-.*)\S
$.%`
O`

Try it online! Link includes test cases. Edit: Saved 10 bytes with some help from @MartinEnder. Explanation:
.+
$*|

Repeat | the given number of times
T`|`-`.{51,}

But if the input was at least 51, change them to -s.
$
100$*#

Append 100 #s.
M!10`.{10}

Split into 10 groups of 10, discarding anything left over.
O$s`(?<!-.*)\S
$.%`

If the the input was at least 51, transpose the result.
O`

Sort the result.
Alternative solution, also 62 bytes:
.+
$*|
T`|`-`.{51,}
$
100$*#
M!10`.{10}
O`
O$^s`\S(?!.*-)
$.%`

Sorting before transposing allows a byte saving on the condition for the transposition but costs a byte to get the result in the correct order.

You don't need # on the first O stage, because $.%\`` will be at most 9. You can also save some byte by avoiding the loop at the cost of another sort stage at the end, like this: https://tio.run/##K0otycxL/K@q4Z7wX0@bS0WrhiskoSZBN0Gv2tRQp5YrjsvQwEBFS5nLV7HI0AAoamhQy@WvUpwQE6xhb6Ooq6elyaWip5rA5Q9EqnEJev//G5lymZtymZhzmRpwmRpyGYBMAAA There's probably even a shorter way to rearrange the result of that M` stage into the final shape.

Ah yeah, for example you can move the plain O stage to right after the M stage, so that you can keep using a lookahead instead of a lookbehind.

@MartinEnder Thanks for your hints; I was able to golf a few more bytes off.

R, 102 bytes
n=scan();m=matrix("#",y<-10,y);m[0:n]="if"(n<51,"|","-");write("if"(n>50,m[,y:1],t(m[y:1,])),"",y,,"")

Try it online!
Reads n from stdin and prints the garden to stdout.
Explanation:
n=scan()               # read from stdin
m=matrix("#",10,10)               # create 10x10 matrix of "#"
m[0:n]="if"(n<51,"|","-")         # set the first n entries in m to the appropriate character
m="if"(n>50,                      # prepare for printing using write
       m[,10:1],                  # reverse m left to right
       t(m[10:1,]))               # flip m top to bottom and transpose
write(m,"",10,,"")                # write m to stdout in 10 columns with no separator

Python 2, 106 103 bytes
n=input();x=n>50;k=x*81+10
while k>0:s='';exec"s+='|-##'[x::2][n<k];k+=x or 10;"*10;print s;k+=x*81-101

Try it online!

PHP, 119+1 bytes
$r=str_pad("",100,"#");for($x=50<$n=$argn;$n--;)$r[90+($x?$n%10*2-$n:$n/10-$n%10*10)]="|-"[$x];echo chunk_split($r,10);

Run as pipe with -nR or try it online.

Jelly, 24 bytes
³<51
ȷ2Ḷ<s⁵ZḤ$Ç¡Ṛị“-|#”Y

Try it online!
How it works
I use too many superscripts...
³<51 ~ Helper link.

³    ~ The input.
 <   ~ Is smaller than
  51 ~ 51?
     ~ Yields 1 for truthy, 0 for falsy.

ȷ2Ḷ<s⁵ZḤ$Ç¡Ṛị“-|#”Y ~ Main link.

ȷ2                  ~ 1e2 (i.e compressed 100).
  Ḷ                 ~ Lowered range. Yields [0, 100) ∩ ℤ.
   <                ~ Is smaller than the input? (element-wise).
    s⁵              ~ Split into sublists of length 10.
         Ç¡         ~ Repeat <last link as a monad> times (either 1 or 0 times).
      ZḤ$           ~ Zip (transpose) and unhalve element-wise.
           Ṛ        ~ Reverse.
            ị       ~ Modular, 1-based indexing into...
             “-|#”  ~ The literal string "-|#".
                  Y ~ Join by newlines.


text:
Build this pyramid
Your pyramid
The pyramid I want you to build is made entirely of cubes. It has 24 layers, and the Nth layer from the top contains N2 cubes arranged in an N by N square. The pyramid looks like this:

To build the pyramid, you will need a supply of cubes. You are given 4900 cubes arranged in a 70 by 70 square that looks like this:

(Okay, I admit that the picture of the square is entirely unnecessary.)
Since 12 + 22 + 32 + ... + 242 = 702, you have exactly the right number of cubes to build the pyramid. All you have to do is tell me where each cube should go.
Your task
You should pick an arbitrary bijection between the cubes in the square and the cubes in the pyramid. (It would be nice if your answer said which of the 4900! different bijections you're using.)
Then, write a function or program that does the following:

Given the location of a cube in the 70 by 70 square (as a pair of coordinates (X,Y)),
Output its location in the pyramid (as a triple of coordinates (A,B,C)).

The input and output coordinates can all be either 0-indexed or 1-indexed. Assuming 1-indexed, your input (X,Y) will be a pair of integers between 1 and 70. Your output (A,B,C) will be a triple of integers; A should be the layer counting from the top (between 1 and 24) and (B,C) should be the coordinates of that cube within that layer (between 1 and A).
For example:

the top cube of the pyramid has coordinates (1,1,1).
The four corners of the base of the pyramid have coordinates (24,1,1), (24,1,24), (24,24,1), and (24,24,24).
If you decide to place the corners of the square at the corners of the pyramid, then on input (70,1) you might give the output (24,24,1).

You may assume you will only be given valid coordinates (X,Y) as input. Correctness is entirely determined by the following rule: two different valid inputs should always give two different valid onputs.
This is code-golf: the shortest code wins.

Jelly, 15 14 bytes
24p;€$€Ẏ
ḅ70ị¢

Try it online!
This is fairly simple: we construct the list of coordinates of cubes within the pyramid as an actual list. Then all we need to do is biject the input coordinates within the square into an index within the list, which is trivial to do via base conversion.
This submission works either as a full program (taking the coordinates as [x, y] via the first command line argument and outputting on standard output), or as a function, implicitly named 2Ŀ.
Explanation
Constructing the list
We start with the number 24, which is interpreted as a range from 1 to 24 inclusive (because we're trying to use it as though it were a list). Then we iterate over it; that's what the last € in the program does. For each element n of the list:

We construct the list of pairs x, y where each element comes from 1..n; p constructs a list of pairs given two sets of elements, and because only one value is available here (n), it's implicitly used for both sets, which both therefore become a list from 1..n.
We append n (again, the only value we have available) to each element of the list (;€).
In order to make the second € apply both of these operations to each n (i.e. to create a loop containing two instructions), we use $ to group the two instructions into one.

Finally, we use Ẏ to flatten the list by one stage, in order to get a list that simply contains all the coordinates in order. It starts like this:

[1, 1, 1], [1, 1, 2], [1, 2, 2], [2, 1, 2], [2, 2, 2], [1, 1, 3], [1, 2, 3], [1, 3, 3], [2, 1, 3], [2, 2, 3], [2, 3, 3], [3, 1, 3], [3, 2, 3], [3, 3, 3], [1, 1, 4], [1, 2, 4], [1, 3, 4], [1, 4, 4], [2, 1, 4], [2, 2, 4], [2, 3, 4], [2, 4, 4], [3, 1, 4], [3, 2, 4], [3, 3, 4], [3, 4, 4], [4, 1, 4], [4, 2, 4], [4, 3, 4], [4, 4, 4], …

and ends with [24, 24, 24].
Indexing the list
We start by converting the input coordinates to a number by interpreting them as a base 70 integer: ḅ70. This gives us a value in the range 71 to 4970 inclusive; all these values are unique mod 4900. ị indexes into the list modulo the length of the list, so [1, 1] will give us the 71st element, [1, 2] the 72nd element, all the way up to [70, 70] which gives us the 70th element (i.e. the element before the answer for [1, 1]). Finally, we just need a ¢ to tell us which list to index (in this case, it's the list specified by the previous line; that's what ¢ does, run the previous line with no arguments).

14 bytes

PHP, 75 82 78 bytes
0-indexed:
set P=X*70+Y then reduce P by A2 while walking down to the correct layer. A-1; P/A; P%A - done.
(reversed: while incrementing A to the correct layer: P=P+A2 then P=P+A*B+C --> X=P/70, Y=P%70)
for($p=$argv[1]*70+$argv[2];$p>=++$a**2;$p-=$a**2);echo$a-1,_,$p/$a|0,_,$p%$a;

Run with php -nr '<code>' <X> <Y>; prints A_B_C.
1-indexed, 82 bytes:
for($p=$argv[1]*70+$argv[2]-71;$p>++$a**2;$p-=$a**2);echo$a,_,$p/$a+1|0,_,$p%$a+1;

Shouldn't you set P to X*70+Y instead?

Python, 80 73 72 bytes
First submission, don't be too harsh q:
0-indexed
lambda x,y:[(a-1,b//a,b%a)for a in range(25)for b in range(a*a)][70*x+y]

Creates a list of length 4900 with all pyramind coordinates and returns a different list entry for each input.
Try it online!

Welcome to the site and nice first post! There are plenty of Python golfers who'd be willing to try to golf your solution down around here, and I hope you enjoy PPCG!

You could shorten a**2 to a*a to save a byte.

Wow, thats a simple one. Thanks.

C 89 , 87 , 82 , 71 bytes
Took xnor's Python solution, and removed the linebreak
p(x,y){for(x=-70*y-x,y=1;x<0;x+=++y*y);printf("%d %d %d",~-y,x/y,x%y);}

0-indexed
z;p(x,y){for(x+=y*70+1,y=z=0;z<x;z+=++y*y);z-=x;printf("%d %d %d\n",y-1,z/y,z%y);}

1-indexed
z;p(x,y){for(x+=~-y*70,y=z=1;z<x;z+=++y*y);z-=x-y;printf("%d %d %d\n",y,z/y,z%y+1);}

I think it should be z/y+1 in the 1-indexed version.

@Titus I don't see why, it complies with OP's question as is

Python 2, 64 bytes
x,y=input()
n=-70*x-y
i=1
while n<0:i+=1;n+=i*i
print~-i,n/i,n%i

Try it online!

This also worked for C, thanks

Batch, 103 bytes
@set/an=%1*70+%2,i=0
:l
@set/an-=i*i,j=i,i+=1,k=n%%i,l=n/i
@if %l% geq %i% goto l
@echo %j% %k% %l%

0-indexed. Works through each layer starting from the top.

J, 37 bytes
-4 bytes thanks to FrownyFrog
(a:-.~,(<:,&.>{@;~&i.)"0 i.25){~70&#.

Fairly straightforward translation of the Jelly method into J.  Uses 0 indexing.  The top pyramid square is the first.  The bottom right corner of the base is the last.
The majority of the code is boilerplate to produce the triple indexed list as a constant.  Finding the correct element within that list based on the 2 element input is simply a matter of translating from base 70 with 70&#.
Try it online!

(#~~:&a:)->a:-.~

@FrownyFrog Thanks.  As happens often to me in J, I've used that trick before and forgot about it in this case.  Btw, you may be interested in this question, which was inspired by this problem.

Husk, 13 bytes
!foEG▲π3Π4B70

Try it online!
Indices start from 1.
Explanation
Like some other answers, I construct the full list of pyramid coordinates and simply index into it.
I do this by listing all triples [A,B,C] where the numbers are between 1 and 24 (expressed as 4! to save a byte) and keeping those for which A >= max(B,C).
!foEG▲π3Π4B70  Implicit input: a list of two numbers.
          B70  Interpret in base 70.
!              Modular index into the following list:
        Π4      Factorial of 4: 24
      π3        Take range and 3-fold Cartesian power: [[1,1,1],[1,1,2],..,[24,24,24]]
 f              Filter by
  oE            all values are equal
    G▲          in cumulative reduce by maximum.


text:
Different ways of defining primes
One of my favorite definitions of the prime numbers goes as follows:

2 is the smallest prime.
Numbers larger than 2 are prime if they are not divisible by a smaller prime.

However this definition seems arbitrary, why 2?  Why not some other number?
Well lets try some other numbers will define n-prime such that

n is the smallest n-prime.
Numbers larger than n are n-prime if they are not divisible by a smaller n-prime.

Task
The task here is to write a program that takes two inputs, a positive integer n and a positive integer a.  It will then decide if a is n-prime.
Your program should output two distinct values one for "yes, it is n-prime" and one for "no, it is not n-prime".
This is a code-golf question so answers will be scored in bytes with less bytes being better.
Tests
Here are lists of the first 31 primes for n=2 to n=12 (1 is the only 1-prime number)
n=2: [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127]
n=3: [3,4,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127]
n=4: [4,5,6,7,9,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113]
n=5: [5,6,7,8,9,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113]
n=6: [6,7,8,9,10,11,13,15,17,19,23,25,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107]
n=7: [7,8,9,10,11,12,13,15,17,19,23,25,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107]
n=8: [8,9,10,11,12,13,14,15,17,19,21,23,25,29,31,35,37,41,43,47,49,53,59,61,67,71,73,79,83,89,97]
n=9: [9,10,11,12,13,14,15,16,17,19,21,23,25,29,31,35,37,41,43,47,49,53,59,61,67,71,73,79,83,89,97]
n=10: [10,11,12,13,14,15,16,17,18,19,21,23,25,27,29,31,35,37,41,43,47,49,53,59,61,67,71,73,79,83,89]
n=11: [11,12,13,14,15,16,17,18,19,20,21,23,25,27,29,31,35,37,41,43,47,49,53,59,61,67,71,73,79,83,89]
n=12: [12,13,14,15,16,17,18,19,20,21,22,23,25,27,29,31,33,35,37,41,43,47,49,53,55,59,61,67,71,73,77]

n=6, a=15 is the first interesting test case.

@Neil Why do you consider that one interesting?

It's the first place where the non-pattern "a is n-prime iff n≤a<2n or (a≥2n and a is prime)" breaks down.

"Numbers larger than 2 are prime if they are not divisible by a smaller prime." - This definition allows any number to be prime. Maybe you want to say iff instead of if?

@ThePirateBay I don't mean the precise mathematical sense of the word if.  I am going to leave it.

@MishaLavrov It still appears that the n-primes are the same as the ordinary primes except for "a few" exceptions in the beginning. For example, the 10-primes includes the exceptions 10, 12, 14, 15, 16, 18, 21, 25, 27, 35, 49 (and of course the 10-primes miss the ordinary primes 2, 3, 5, 7). But after 50, any ordinary composite will be divisible by an ordinary prime or by one of the exceptional 10-primes. I think we can prove this in general, for n-primes.

@JeppeStigNielsen It's not very hard to prove this.  All composite numbers that are n-prime must have only prime factors that are smaller than n.  We also know that no subset of their factors can have a product larger than n because our number would be divisible by that.  Thus every n-prime is either 2-prime or the product of 2 numbers less than n.  There are only a finite number of pairings of numbers less than n, thus there are only a finite number of composite n-prime numbers.  Hopefully that makes sense, I had to abbreviate to fit it in a comment.

@JeppeStigNielsen A simple modification on that proof can be used to prove that the upper bound on n-prime composites is n^2-1.

Actually (n-1)^2 is a stronger upper bound.  Here is the proof: Any composite number can be represented as a*b where a and b are integers greater than 1.  If the larger one (lets call it a) is greater than n and is n-composite, ab is n-composite, because x | a -> x | ab, but if its n-prime then ab is still n-composite because ab | a.  Thus for ab to be n-prime a must be smaller than n.  Since the larger is smaller than n both must be smaller than n.  Since both a and b are smaller than n ab must be at most (n-1)^2.

Haskell, 45 bytes
n!a=not$any(n!)[x|x<-[n..a-1],mod a x<1]||n>a

Try it online!
I define a nice recursive function (!):
n!a checks if any factor of a, in the range [n,a-1], is an n-prime. Then it negates the result. It also makes sure that n>a

Here's a little bit of competition

@WheatWizard I was hoping someone would post the shorter solution :)

Python 2, 39 37 bytes
Thanks to Halvard Hummel for -2 bytes.

f=lambda n,i:n==i or i>i%n>0<f(n+1,i)

Try it online!

Python 3, 45 bytes
lambda i,k:(i>k)<all(k%r for r in range(i,k))

Try it online!
How it works
This takes two integers as input, i and k. First checks if k ≥ i. Then generates the range [i, k) and for each integer N in this range, checks if N is coprime to k. If both conditions are fulfilled, then k is an i-prime.

Can't you use & instead of and and >=i instead of >i-1?

@WheatWizard >=i  is still 4 bytes (because of the space).

@Neil If you change to & you don't need the space.

Husk, 6 5 bytes
εf≥⁰Ḋ

Try it online! or see results up to 80.
Thanks to Leo for -1 byte.
Explanation
εf≥⁰Ḋ  Inputs are n and k.
    Ḋ  Divisors of k.
 f     Keep those that are
  ≥⁰   at least n.
ε      Is the result a one-element list?

R, 44 37 bytes
function(a,n)a==n|a>n&all(a%%n:(a-1))

Try it online!
-7 bytes thanks to Giuseppe
Returns TRUE if

a is equal to n or (a==n|)
a is greater than n and (a>n&) for every number k from n to a-1, a is not evenly divisible by k (all(a%%n:(a-1)))

Returns FALSE otherwise

Welcome to PPCG! Great first answer!

Haskell, 30 bytes
2 bytes saved thanks to H.PWiz's idea which was borrowed from flawr's answer
n!a=[1]==[1|0<-mod a<$>[n..a]]

Try it online!
Ok since its been a while, and the only Haskell answer so far is 45 btyes, I decided to post my own answer.
Explanation
This function checks that the only number between n and a that a is divisible by is a itself.
Now the definition only mentions n-primes smaller than a, so why are we checking all these extra numbers?  Won't we have problems when a is divisible by some n-composite larger than n?
We won't because if there is an n-composite larger than n it must be divisible by a smaller n-prime by definition.  Thus if it divides a so must the smaller n-prime.
If a is smaller than n [n..a] will be [] thus cannot equal [1] causing the check to fail.

J, 30 bytes
>:*(-{1=[:+/0=[:|/~]+i.@[)^:>:

Try it online!
Takes starting value as the right argument and the value to check at the left argument.
I messed up originally and didn't account for left arguments less than the starting prime. I'm somewhat unhappy with the length of my solution now.
Explanation
Let x be the left argument (the value to check) and y be the right argument (the starting prime).
>:*(-{1=[:+/0=[:|/~]+i.@[)^:>:
                          ^:>:  Execute left argument if x >= y
                     i.@[         Create range [0..x]
                   ]+             Add y to it (range now: [y..x+y])
                |/~               Form table of residues
            0=                    Equate each element to 0
          +/                      Sum columns
      1=                          Equate to 1
    -{                            Take the element at position x-y
>:*                             Multiply by result of x >= y

Notes
The element at position x-y is the result of primality testing for x (since we added y to the original range).
Multiplying by x >: y ensures that we get a falsey value (0) for x less than y.

JavaScript (ES6), 33 32 30 bytes
Takes input in currying syntax (n)(a). Returns a boolean.
n=>p=(a,k=a)=>k%--a?p(a,k):a<n

Demo

let f =

n=>p=(a,k=a)=>k%--a?p(a,k):a<n

for(n = 2; n <= 12; n++) {
  for(a = n, P = []; P.length < 31; a++) {
    f(n)(a) && P.push(a);
  }
  O.innerText += 'n=' + n + ': ' + P.join(',') + '\n';
}

Jelly, 8 5 bytes
rḍṛċ<

Try it online!
This outputs 0 or 1 for "yes" and a positive integer greater than 1 for "no". This really stretches the "output two distinct values", so I've included a more reasonable 6 byte version:
rḍṛṖi<

Try it online!
Outputs 0 for "yes, it is \$n\$-prime" and a positive integer for "no it is not \$n\$-prime". +1 byte to use just 0 and 1.
How they work
rḍṛċ< - Main link. Takes n on the left and a on the right
r     - Range from n to a inclusive
  ṛ   - Right; Yield a
 ḍ    - For each element in the range, is it divisible by a?
    < - Is n < a?
   ċ  - Count the occurrences of (n < a) in the divisibility range

This works because in the range \$[n, a]\$, only one integer can be divisible by \$a\$ if \$a\$ is \$n\$-prime: \$a\$. Therefore, the range, after divisibility, would look like [0, 0, 0, ..., 1]. However, this doesn't check the condition that \$n\$ is the smallest \$n\$-prime, as r will generate a descending range if \$n < a\$. Therefore, we check that \$n  a\$, there will be more than one 0 in the range, and if \$a\$ is not \$n\$-prime, but \$n < a\$, there will be more than 1 in the range.
If \$n = a\$, then r will yield an empty list and ċ will return 0, no matter what the result of < is.
rḍṛṖi< - Main link. Takes n on the left and a on the right
r      - Range from n to a inclusive
  ṛ    - Right; Yield a
 ḍ     - For each element in the range, is it divisible by a?
   Ṗ   - Remove the final element, 1
     < - Is n < a?
    i  - Index of (n =a&$&b%(a,b)

Shortest method is a port of Mr. Xcoder's Python answer. Takes the smallest prime and the number to test as command-line arguments. Try it online!

C, 55 bytes
f(n,a,i){for(i=a;i-->n;)a%i||f(n,i)&&(i=0);return-1n;)a%i||f(n,i)&&(i=0);return~i;}

Try it online!

dc, 40 34 37 bytes
[0p3Q]sf?se[dler%0=f1+dle>u]sudle>u1p

I would have included a TIO link, but TIO seems to be carrying a faulty distribution of dc seeing as how this works as intended on my system but the Q command functions erroneously on TIO. Instead, here is a link to a bash testing ground with a correctly functioning version of dc:
Demo It!

APL (Dyalog), 24 bytes
{⍵∊o/⍨1=+/¨0=o|⍨⊂o←⍺↓⍳⍵}

Try it online!
How?
⍳⍵ - 1 to a
o←⍺↓ - n to a, save to o
o|⍨⊂o - modulo every item in o with every item in o
0= - check where it equals 0 (divides)
+/¨ - sum the number of divisions
1= - if we have only one then the number is only divided by itself
o/⍨ - so we keep these occurences
⍵∊ - is a in that residual array?

Add++, 20 bytes
L,2Dx@rBcB%B]b*!!A>*

Try it online!
L,   - Create a lambda function
     - Example arguments:  [5 9]
  2D - Copy below; STACK = [5 9 5]
  x  - Repeat;     STACK = [5 9 [9 9 9 9 9]]
  @  - Reverse;    STACK = [[9 9 9 9 9] 5 19]
  r  - Range;      STACK = [[9 9 9 9 9] [5 6 7 8 9]]
  Bc - Zip;        STACK = [[9 5] [9 6] [9 7] [9 8] [9 9]]
  B% - Modulo;     STACK = [4 3 2 1]
  B] - Wrap;       STACK = [[4 3 2 1]]
  b* - Product;    STACK = [24]
  !! - Boolean;    STACK = [1]
  A  - Arguments;  STACK = [1 5 9]
  >  - Greater;    STACK = [1 1]
  *  - Product;    STACK = [1]

JavaScript (Node.js), 27 bytes
i=>f=n=>i==n||i>i%n&&f(n+1)

Try it online!
Port of my Python answer, takes input in currying syntax: m(number)(first prime)

JavaScript ES5, 34 Bytes
for(a=i=(p=prompt)();a%--i;);i<p()

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