text:
Ternary Triangles
The idea of this is mainly from BIO 2017 q1. I got the idea for posting this challenge from my Binary Sequences challenge, since lots of people seemed to like it.
Also, this is the first challenge I've posted without posting on the sandbox. I'll delete it if no one likes it.
Rules
Take in a sequence of digits in ternary (base 3); this could be as a string, an array or the numerical value along with the number of preceding zeros.
For each row in the triangle, a row below is generated until there is only one digit in the last row. To find a digit below two other digits, the digit will be the same as two above it if these two other digits above are equal. Otherwise, it will be the digit that is not equal to either of them. Here is an example:
0 0 1 2 0 1 2 2
 0 2 0 1 2 0 2
  1 1 2 0 1 1
   1 0 1 2 1
    2 2 0 0
     2 1 0
      0 2
       1

You are only expected to return the last row.
Make your code short.
Test Cases
0 -> 0
11 -> 1
10 -> 2
000 -> 0
012 -> 1
21102 -> 2
201021 -> 1
111111 -> 1
1020202020 -> 2
0212121210 -> 0

Husk, 9 bytes
%3←ΩεẊo_+

Try it online!
Explanation
The main idea is to compute the mapping of two digits to one as f(a,b) = (-a-b) % 3. For golfing purposes we can delay the modulo until the very end.
   Ωε       Apply the following function until the list is only one
            element in length.
     Ẋo       Apply the following function to pairs of adjacent values.
       _+       Add the two values and negate the result.
  ←         Take the first (and only) element of this list.
%3          Take it modulo 3.

In principle, it's also possible to compute the result directly by multiplying each element by the corresponding binomial coefficient and multiplying the sum by -1 for even-length lists, but I don't know of a way to do that in fewer bytes.

MATL, 10 bytes
td"HYCEsI\

Try it online! Or verify all test cases.
Explanation
For each pair of digits, the code computes twice the sum modulo 3. The process is repeated as many times as the length of the input minus 1.
t        % Implicit input: array of length n. Duplicate
d        % Consecutive differences. Gives an array of length n-1
"        % For each (that is, do n-1 times)
  HYC    %   2-column matrix where each column is a sliding block of length 2
  E      %   Times 2, element-wise
  s      %   Sum of each column
  I\     %   Modulo 3
         % Implicit end. Implicit display

Python 2, 48 bytes
f=lambda a,*l:-(f(*l)+f(a,*l[:-1]))%3if l else a

Try it online!
Recurses on the sublists deleting the first and last elements respectively.
This would be cleaner in Python 3 if it could actually unpack f=lambda a,*b,c:....

Emojicode, 242 bytes
➡i⏩➖1 0j⏩0i❎j➕1jj➖➖3j➕1j0

Uses the same algorithm as my C answer. Try it online!

Jelly, 9 bytes
+2\N$Ḋ¿%3

Try it online!
Using Martin Ender's Husk algorithm.

C (gcc), 91 88 84 bytes
-1 byte thanks to @Mr.Xcoder!
j;f(a,l)int*a;{for(;l-->1;)for(j=0;j<l;)a[j++]=a[j]^a[j+1]?3-a[j]-a[j+1]:a[j];a=*a;}

Gets the array and the length. Try it online!

Haskell, 36 bytes
f[a]=a
f(h:t)=mod(-f t-f(h:init t))3

Try it online!
Saves 1 byte over the more symmetrical:
f[a]=a
f l=mod(-f(tail l)-f(init l))3

Try it online!
The idea is simple: recursively compute the function on the sublists deleting the first and last element respectively, and combine them with \a b -> mod(-a-b)3. This seems shorter than zipWith'ing this fuction .
Haskell, 44 bytes
f[a]=mod a 3
f l=f$zipWith((-).(0-))l$tail l

Try it online!

J, 23 15 Bytes
3&(|2+/\-)~<:@#

Thanks to @miles
Old Solution:
3|2&(-@+/\)^:(#>1:)^:_]

Inspired by Martin Ender's solution:
Explanation
3|2&(-@+/\)^:(#>1:)^:_]    | Whole program
                      ]    | Seperates the argument from the _ (infinity)
           ^:(#>1:)^:_     | Do while the length is greater than one
  2&(-@+/\)                | Inverse of the sum of adjacent elements
3|                         | Modulo 3

15 bytes with 3&(|2+/\-)~<:@#

@miles, ha, i was just about to post this for 19 bytes 3|((2<.#)-@+/\])^:_ -- yours is really nice.

APL (Dyalog), 17 bytes
{3|3-2+/⍵}⍣{1=≢⍺}

Try it online!
How?
2+/⍵ - sum each two adjacent items
3- - vectorized subtract from three
3| - vectorized modulo by three
⍣ - repeat until...
1=≢⍺ - only one item is left

Javascript (ES6), 58 bytes
f=s=>s[1]?f(s.replace(/.(?=(.?))/g,(a,b)=>b&&(6-a-b)%3)):s

Batch, 122 bytes
@set/an=2,s=i=l=0
@for %%e in (%*)do @set/al+=1,n^^=3
@for %%e in (%*)do @set/as+=%%e*n,s%%=3,n*=l-=1,n/=i+=1
@echo %s%

Uses binomial expansion. As @MartinEnder points out, the sum has to be negated (modulo 3) if the number of values (which are counted in the first loop) is even, so n is set to either 1 or 2 accordingly. The second loop then computes the sum via the binomial coefficients.

APL+WIN, 30 28 bytes
2 bytes saved courtesy of Uriel.
n←⎕⋄¯1↑∊⍎¨(⍴n)⍴⊂'n←3|3-2+/n'

Explanation:
n←⎕ Prompt for screen input of the form: 0 0 1 2 0 1 2 2

'n←3|3-2+/n' Successive rows are 3 mod 3 minus successive digit pairs.

(⍴n)⍴⊂ Create a nested vector of the row code, one element per row.

¯1↑∊⍎¨ Execute each element of row code, flatten result and take final value.

This is one way of writing looping code in APL on a single line.

You don't need the rightmost 3|


text:
Maximum Area of a Polygon with Vertices of a Polygon
Rules
Given a list of integer coordinates, l, with a length of at least 4, and an integer n such that n is smaller than the length of l (but at least 3), return the largest area of an n-sided polygon satisfies:

is simple (not self-intersecting).
has all the coordinates of its n vertices in the list l.
has no three consecutive collinear vertices.

Note that the polygon given in the input should comply to the three points above as well.
Test Cases
Here are a few test cases:
[(0,0), (0,-1), (-1,-1), (-1,0)], 3 -> 0.5
[(0,0), (1,0), (2,1), (2,2), (1,3), (0,3), (-1,2), (-1,1)], 3 -> 3
[(0,0), (1,0), (2,1), (2,2), (1,3), (0,3), (-1,2), (-1,1)], 5 -> 5.5
[(0,0), (1,0), (2,1), (2,2), (1,3), (0,3), (-1,2), (-1,1)], 6 -> 6

You can try any test cases you like here.
Make your code as short as possible.

This is a good challenge, but I would probably include some test cases in the body. Also, may we assume that no 3 points are collinear?

@Giuseppe What test cases would be useful?

I'd just pick a few at random, including one where n is small but |l| is much larger. The link to generate more test cases is useful for getting more should we need them. I don't have any good insight on this problem, other than that the likely algorithms are going to be the brute force O(|l|^n)

When you say the input coordinates are in anticlockwise order, does this imply that they are vertices of a convex polygon, i.e. all of them lie on the border of their convex hull?

@xnor Not necessarily convex (although I don't know much about the rigorous definitions; I just thought follow the vertices in anticlockwise order). Currently, I don't see any reason to specify convex, but, if it has advantages or makes the challenge less confusing, I'll add it.

Are you sure you implemented the shoelace formula correctly? The first example is a square with area 1, how could an inscribed triangle have an area of 1.5?

Found the problem: line 5 should be a-=.

@BolceBussiere Thanks; I'm an idiot. Fixed.

Your test program only considers polygons made from sequences of vertices in the given order, even if another order may yield a larger area. Also, it fails to exclude self-intersecting polygons, for which the shoelace formula may over- or under-count some regions depending on the winding number around them (how should self-intersecting polygons be handled?).

I think replacing combination with permutation will fix the issue. Also I think (but can't prove) that, using the formula in the example code, the area of any permutation of the points is no larger than the area of the polygon formed by the convex hull of those points.

@AndersKaseorg I think the polygons the algorithm considers are the largest ones by area given the subset of points. There's no point considering extra cases that you know will have less area if you're trying to find the max area.

@user202729 No; for example, the formula finds a larger area for the self-intersecting regular star polygon {7/2} (7 sin(4π/7)/2 ≈ 3.41225) than for its convex hull (7 sin(2π/7)/2 ≈ 2.73641).

@nog642 That very much depends on the order in which the points were passed in, which was previously ill-defined (it’s not clear and certainly not unique what “anticlockwise order” means for sets other than the vertices of a convex polygon), and in the current revision is no longer defined at all. If the given test code works under some assumption about this order, it’s not clear what that assumption is.

@J843136028 I edited the question to address AndersKaseorg's concerns. You can roll back and edit the question if that is not what you want.

@user202729 The test case generator is now fixed (though the test cases given in the problem were right).

@AndersKaseorg Is it clear enough now?

The test case generator remains inconsistent with the specification because it doesn’t check for self-intersections or for three consecutive collinear vertices. (I think the requirement to exclude polygons with three consecutive collinear vertices is arbitrary; that part of the inconsistency is perhaps best resolved by removing that requirement, or by guaranteeing that no three input points are collinear. The self-intersections issue is fundamental though, as explained above.)

@AndersKaseorg Changed.

@J843136028 That doesn’t address the problem. You can still form a self-intersecting polygon from a subset of the vertices of a non-self-intersecting polygon (or similarly with three consecutive collinear vertices).

Example polygon to demonstrate that. This time I'm not sure what you want to do so I won't edit the challenge.

@AndersKaseorg Surely, given certain vertices, the largest possible area with these vertices is a simple polygon, though. For example, if a square is ABCD, ABCD would have a bigger area than ACBD.

@user202729 "Note that the polygon given in the input should comply to the three points above as well." This means no three points are collinear.

@J843136028 “Surely…” No, I have already pointed out a counterexample. “This means no three points are collinear.” No, it means no consecutive three points are collinear. Non-consecutive vertices of the original polygon may become consecutive vertices of the small one, like I already said and like user202729 just demonstrated.

Python 2, 172 bytes
-1 byte thanks to J843136028
bug fix thanks to Jonathan Frech
from itertools import*
def f(l,n,L=()):
 for p in combinations(l,n):
  r=0;j=-1
  for i in range(n):r+=(p[j][0]+p[i][0])*(p[j][1]-p[i][1]);j=i
  L+=abs(r/2.),
 print max(L)

Try it online!

On the fourth line, you could do r,j=0,-1. On the sixth line, you could do L+=abs(r/2.),.

@J843136028 r,j=0,-1 doesn't save any bytes compared to r=0;j=-1, but thanks for your other suggestion.

Your test cases only work because they are in increasing order (TIO).

A proposed fix would be not to use a mutable object for your L default. Using a tuple instead of a list makes the function truly reusable (TIO).

@JonathanFrech Right, I forgot python functions save mutable default arguments between calls. Thanks.

134 bytes.

source: Stack Exchange

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

sort: votes


text:
Output the hours at 90 degrees
Today while playing with my kids I noticed that an apparently simple toy in the park hid a challenge.

The wheel has a triangle that points to a number, but also has three circles that point to the numbers every 90 degrees from the first one. So:
Challenge (really simple)
Given an integer between 1 and 12 (the one pointed by the triangle) in any acceptable form, output also in any acceptable form and order the three numbers pointed by the circles (the ones every 90 degrees).
Test cases
In       Out
1        4, 7, 10
2        5, 8, 11
3        6, 9, 12
4        7, 10, 1
5        8, 11, 2
6        9, 12, 3
7        10, 1, 4
8        11, 2, 5
9        12, 3, 6
10       1, 4, 7
11       2, 5, 8
12       3, 6, 9

This is code-golf, so may the shortest code for every language win!

May we take the input as 0-indexed? Like, 0 -> 4, 7, 10?

@Mr.Xcoder sorry, this time I'm going to say no.

Is this the fourth challenge now based on some activity involving your kids? :P

@FlipTack Perhaps we need an inspired-by-kids tag ;)

@FlipTack I've lost count. :-) But given that I spent most of my free time with my kids, guess where does my inspiration come from...

@Steadybox That would be a meta tag, which is BAD. But yes, we do. (Perhaps a meta question with links would suffice?)

Python 3, 33 bytes
lambda n:{*range(n%3,13,3)}-{n,0}

Try it online!

Python 2, 35 bytes
lambda n:[(n+c)%12+1for c in 2,5,8]

Try it online!

Jelly, 8 bytes
12Rṙ’m3Ḋ

A monadic link taking a number and returning a list of numbers.
Try it online! or see all cases.
How?
12Rṙ’m3Ḋ - Link: number, n   e.g. 5
12       - literal twelve         12
  R      - range                  [1,2,3,4,5,6,7,8,9,10,11,12]
    ’    - decrement n            4
   ṙ     - rotate left            [5,6,7,8,9,10,11,12,1,2,3,4]
      3  - literal three          3
     m   - modulo slice           [5,8,11,2]
       Ḋ - dequeue                [8,11,2]

Alternative solution: 12Rṙm-3Ḋ (output in reverse order)

Python 2, 35 bytes
lambda n:(range(1,13)*2)[n+2:n+9:3]

Try it online!

R,  29  28 bytes
Thanks to @Giuseppe for saving a byte!
function(n)(n+1:3*3-1)%%12+1

Try it online!

MATL, 9 bytes
I:I*+12X\

Try it online!
Explanation
Consider input 4 as an exmaple.
I:     % Push [1 2 3]
       % STACK: [1 2 3]
I      % Push 3
       % STACK: [1 2 3], 3
*      % Multiply, element-wise
       % STACK: [3 6 9]
+      % Add implicit input, element-wise
       % STACK: [7 10 13]
12     % Push 12
X\     % 1-based modulus. Implicit display
       % STACK: [7 10 1]

APL+WIN, 13bytes
(⎕⌽⍳12)[3×⍳3]

Explanation:
⎕ Prompt for screen input of indicated time t

⍳12 Create a vector of integers from 1 to 12

⌽ Rotate the vector by t elements front to back

[3×⍳3] Select 3rd, 6th and 9th elements.

Quite neat. I like that indexed rotation approach

C (gcc), 48 bytes
i;f(n){for(i=4;--i;printf("%d ",n%12?:12))n+=3;}

Try it online!

JavaScript (ES6), 29 bytes
Similar to xnor's answer.
n=>[2,5,8].map(k=>(n+k)%12+1)

Demo

let f =

n=>[2,5,8].map(k=>(n+k)%12+1)

for(n = 1; n <= 12; n++) {
  console.log(n + ' -> ' + f(n));
}

I had n=>[3,6,9].map(v=>(v+n)%12) then realized that it returns 0, not 12...

@ericw31415 Actually, my 1st approach was n=>[3,6,9].map(v=>(v+n)%12||12) (but that's 31 bytes).

Octave, 25 bytes
@(x)[a=1:12 a](3+x:3:9+x)

Try it online!
Fairly simple anonymous function.
We first create an array of [1:12 1:12] - so two copies of the full number set. Then we index in to select the values of x+3, x+6, x+9, where x is the number input.
Octave is 1-indexed, so we can simply select the array elements based on the input (although to be honest 0-indexed would use the same number of bytes here).
This seems to use a method that is unique to the other answers in that by having two copies of the array, we don't have to wrap the indices using modulo.

Very nice, but the "boring" mod approach is shorter! Try it online!

@Giuseppe lol, I'm sure I tried using mod and couldn't make it shorter. Well done! Feel free to post as an answer.

Befunge-93, 20 19 18 bytes
852<_@#:.+1%+66+&p

Try it online!
Explanation
852                   Push 8, 5 and 2 onto the stack - the offsets we're going to add.
   <                  Reverse direction, and start the main loop.
852                   Push 2, 5, and 8 onto the stack, but we don't actually want these.
                 p    So we use a "put" operation to drop the top three values.
                &     Read the hour from stdin.
               +      Add it to the topmost offset.
         +1%+66       Mod 12 and add 1 to get it in the range 1 to 12.
        .             Then output the result to stdout.
    _@#:              Exit if the next offset is zero (i.e. nothing more on the stack).
   <                  Otherwise start the main loop again.

This relies on behaviour specific to the reference interpreter: on end-of-file, the & operator returns the last value that was read. That's why we can safely re-read the hour from stdin on each iteration of the loop.

Neat. I didn’t know & did that

@JoKing Technically it's a bug in the interpreter, another related side-effect being that & can also be used as a kind of one-off random number generator. That is less reliable, though, since it depends on the compiler that was used to build it. It's working on TIO at the moment, but there was a time when Dennis changed to a different version of gcc and we lost that functionality for a while.

APL (Dyalog), 12 bytes
1+12|2 5 8∘+

Try it online!

05AB1E, 8 bytes
ƵžS+12%>

At the time of writing this, this submission has the lowest score submitted. Technically I am winning!
Try it online!
How?
ƵžS                   # Push the list [2, 5, 8]
   +                  # Add the input to each number
    12%               # Mod each result by 12
       >              # Increment each
                      # And print the ending list implicitly!

See this tip of Kevin to know why Ƶž is 258!

SOGL V0.12, 9 bytes
3{3+:6«‰P

Try it Here!

Clean, 44 bytes
import StdEnv
@n=[(n+i)rem 12+1\\i<-[2,5,8]]

Try it online!

C# (.NET Core), 42 bytes
h=>new[]{(2+h)%12+1,(5+h)%12+1,(8+h)%12+1}

Try it online!
Essentially just a port of many of the other answers to C#.

Japt, 11 bytes
3ÆU±3 uC ªC

Try it

Explanation
Implicit input of integer U. Generate a 3 element array (3Æ) and, for each element, increment U by 3 (U±3), modulo by 12 (uC) and, because 12%12=0, return the result OR 12 (ªC).

K (oK), 11 bytes
Solution:
1+12!2 5 8+

Try it online!
Examples:
1+12!2 5 8+1
4 7 10
1+12!2 5 8+2
5 8 11
1+12!2 5 8+3
6 9 12
1+12!2 5 8+4
7 10 1

Explanation:
This was the first solution that came to mind. Might not be the best or shortest.
1+12!2 5 8+ / the solution
     2 5 8+ / add 2, 5 and 8 to the input
  12!       / apply modulo 12 to the results
1+          / add 1

GolfScript, 46 bytes
~13,1>:x?:y;0:i;x y 3+12%=x y 6+12%=x y 9+12%=

This is the first time I'm doing code golf, so with my lack of experience I've probably not found the best solution, but I need to start somewhere, right?
Try it online or try all cases

Hello, welcome to the site! This looks like a nice first answer :) Unfortunately, I don't know anything about golfscript, but you might be able to get some tips here

Pyth, 12 bytes
%R12+LQ*R3S3

Try it online!

Welcome to the site! :)

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

Try it online!
At least I beat Doorknob's face solution...
Explanation:
LOOP 3 TIMES: (()()()){({}<

  n += 2:
   (()(){})
  push 12:
   (((()()()){}){}<>)
  n mod 12 + 1; pushing to both stacks:
   {(({})){({}[()])<>}{}}<>(([{}]{})<>)

END LOOP: >[()])}<>

Wolfram Language (Mathematica) 20 bytes
Mod[#+{3,6,9},12,1]&

The normal modulus operation, threaded over a list, offset by 1.
Try it online!

Vyxal, 8 bytes
⁺ẇf+12%›

Try it online! (All test cases)
Port of SunnyMoon's 05AB1E solution
How it works:
⁺ẇf+12%›
⁺ẇ        The number 258
  f       ...as a list of digits ⟨ 2 | 5 | 8 ⟩
   +      Add the input to each
    12%   Mod-12 each
       ›  Increment each
          (implicit output)

Piet + ascii-piet, 45 bytes (5×18=90 codels)
tAaaqreeumccsqqqijlVa rbiqaaueljnvea?_ t?B tt

Try Piet online!

My looping template is getting weirder and weirder... :P
inN 4    [n 4]; force toggle CC at the exit of 4 region
Loop:
  dup CC+    [n flag] switch CC on 3rd iteration so it will exit after the loop
  2 1 roll   [flag n]
  2 +        [flag n+2]
  3 dup dup * + %  [flag (n+2)%12]
  1 + d outN [flag next_n] compute and print the next number
  1 outC     [flag next_n] print the separator (ASCII 1)
  2 1 roll   [next_n flag]
  2 /        [next_n flag/2] divide flag by 2; flag becomes odd after two loops

Piet + ascii-piet, 62 bytes (46×2=92 codels)
TABdDTvVvVnNNFJAQUiIiIIAeEeEuUUMTJBCSBvVvVNMLnNnNfFFVBQIMEiCcc

Try Piet online!

Thunno 2, 8 bytes
ṇɗd+12%⁺

Try it online!
Explanation
ṇɗd+12%⁺  # Implicit input
ṇɗ        # Push compressed integer 258
  d+      # Add [2,5,8] to input
    12%   # Mod each by 12
       ⁺  # Increment each
          # Implicit output

Nekomata, 9 bytes
12Rᶠ{-Z3¦

Attempt This Online!
12Rᶠ{-Z3¦
12R         [1,2,...,12]
   ᶠ{       Filter by
     -          Subtract the input
      Z         Check if the result is non-zero
       3¦       Check if the result is divisible by 3

Nekomata, 10 bytes
258¢D+12%→

Attempt This Online!
258¢D+12%→
258¢D       Decimal digits of 258
     +      Add
      12%   Modulo 12
         →  Increment

Pushy, 12 bytes
258s{K+12%h_

Try it online!
258            \ Push 258
   s           \ Split into digits, yielding [2, 5, 8]
    {K+        \ Add input to each
       12%     \ Modulo each by 12
          h    \ Increment each
           _   \ Print (space separated)

12 bytes
An alternative for the same byte count:
12R{:{;$...#

Try it online!
12R            \ Push range(1, 12), inclusive
   {: ;        \ Input times do:
     {         \   Rotate left
       $       \ While there are items on stack:
        ...    \   Pop the top three
           #   \   Print top item

Haskell, 29 bytes
-2 bytes thanks to Laikoni.
f n=[mod(n+i)12+1|i<-[2,5,8]]

Try it online!
Not very original, no...

Tcl, 45 bytes
proc R i {lmap c {2 5 8} {expr ($i+$c)%12+1}}

Try it online!

Different approach using the command line arguments:
Tcl, 39 bytes
time {puts [expr [incr argv 3]%12+1]} 3

Try it online!

Swift, 30 bytes
{n in[2,5,8].map{($0+n)%12+1}}

Try it online!
Port of many other answers to Swift

Wolfram Language (Mathematica) 35 bytes
Range@12~RotateLeft~#~Take~{3,9,3}&

The above asserts, in infix notation, what can be expressed more clearly as
Function[Take[RotateLeft[Range[12],Slot[1]],List[3,9,3]]]

RotateLeft rotates Range[12], the sequence 1,2,...12, leftward by the input number.  Slot[1] or # holds the input number, n.
For example, with n = 4,
Function[RotateLeft[Range[12],4]]]

returns the list
{5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4}

Take...{3,9,3} returns every third element in that list from position 3 through position 9, namely
{7, 10, 1}

34 bytes

Pyt, 12 11 bytes
258á←+26*%⁺

Explanation:
258               Pushes 2,5,8 onto the stack
   á              Converts the stack to an array, and pushes the array onto the now-empty stack
    ←+            Adds input to [2,5,8]
      26*%⁺       Mod 12 plus 1 (the 'plus 1' allows for '12' to be output)

Try it online!

Perl 6, 23 bytes
{map ($_+*)%12+1,2,5,8}

Try it online!

PHP, 37+1 bytes
while($i++<3)echo(~-$argn+=3)%12+1,_;

Run as pipe with -nR or try it online.

face, 96 94 bytes
(%d
@)\$*,c'$ooiim%*m1*6%+%%%11m!*mn*m~*3!m&!r!&!is!&$pn3!:L+nn1+nn1%nn%+nn1p~>$inw~>~o-!!1?!L

This simply adds two, mods by 12, adds one more, and prints. Then it does that two more times.
Commented version:
(%d
@)

\$*,c'$ooii     ( store format string in $, ip in *, get stdin/out )
m%*m1*6%+%%%11  ( initialize constants, %=12, 1=1 )
m!*mn*m~*       ( malloc space for a counter, input var, and length )
3!m&!r!&!i      ( read into & )
s!&$pn          ( scan into n )
3!:L            ( start of main loop, executed thrice )
  +nn1+nn1      ( add 2 to n )
  %nn%+nn1      ( mod by 12 and add 1 more )
  p~>$in        ( sprintf n into > )
  w~>~o         ( output to stdout )
  -!!1          ( decrement counter )
?!L             ( conditional jump back to loop start )

Try it online! (The trailing newline is required on TIO due to a bug that's been fixed in a newer version of face.)

Creating a variable that holds the value 3 m3*33 allows you to replace the three +nn1s with one +nn3 https://tio.run/##BcE9DoMwDAbQPbf4pDiAKUNkiYGB9gAcoUvFj5TBTtQObLl6@t712c/Wejrca3h7fuydzzklJdbIM41EFKOC1ViFRbSyQAO@CEg/BF9MsGyjmZAZlbr6ZHdda56A@MTmWpv/

@Cowsquack Note that the output in your link is wrong.

Octave, 23 bytes
@(x)mod(x+[2 5 8],12)+1

Try it online!
Takes the same approach as most others; and it is golfier than Tom Carpenter's somewhat more unique solution.

Java 8, 46 45 bytes
n->new int[]{1-~-~n%12,(5+n)%12+1,(8+n)%12+1}

-1 byte thanks to @ceilingcat.
Try it online.

Perl 5, 30 bytes
sub{map{($_+$_[0])%12+1}2,5,8}

Try it online!

PowerShell, 30 bytes
param($a)2,5,8|%{($_+$a)%12+1}

Try it online!
Port of the other answers (e.g., xnor's Python 2 answer). Ho-hum.

Forth (gforth), 39 bytes
Input is taken from the stack and output is placed on the stack

: a 2 + 12 mod 1+ ; : f a dup a dup a ;

Try it online!
Explanation
 : a 2 + 12 mod 1+ ; \ helper word to handle adding the hours
    2 +              \ Add 2 to the input
    12 mod           \ get the result modulo 12
    1+               \ add 1

 : f a dup a dup a ; \ word that calculates and outputs the result
    a dup            \ add 3 hours to the input and then duplicate the result
    a dup            \ add 3 hours to the duplicate then duplicate the result
    a                \ add 3 hours to the duplicate

Perl 5 -a, 27 bytes
say+($_+"@F")%12+1for 2,5,8

Try it online!

Husk, 8 bytes
tĊ3ṙḣ12←

Try it online!

x86-16 machine code, 12 bytes
00000000: b903 0004 02d4 0c40 aae2 f8c3              ...........

Listing
B9 0003     MOV  CX, 3          ; loop counter CX = 3
        CLOOP:
04 02       ADD  AL, 2          ; AL = AL + 2
D4 0C       AAM  12             ; AL = AL % 12
40          INC  AX             ; AL = AL + 1
AA          STOSB               ; [DI++] = AL
E2 F8       LOOP CLOOP          ; if --CX > 0 goto CLOOP
C3          RET                 ; return to caller

Callable function, input in AL, output to buffer at [DI].

Windows Batch, 137 125 111 68 bytes
@set/ab=(%1+2)%%12+1,c=(%1+5)%%12+1,d=(%1+8)%%12+1
@echo %b% %c% %d%

Port of the add value to input and mod 12 + 1

Ruby, 29 bytes
->n{3.times{p 12+(n+=3)%-12}}

J, 24 bytes
{&((,])}.i.13)@+&(2 5 8)

Try it online!

Stax, 8 bytes
äÆL6C╪Θ♪

Run and debug it
Approach
3 times:
    add 2
    mod 12
    add 1
    print current value

Excel + Google Sheets Polyglot, 21 Bytes
An anonymous worksheet function that takes input from cell A1 and returns a 1x3 spilled array beginning at the calling cell.
=MOD(A1+{2,5,8},12)+1

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

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


text:
R[oman|everse] Polish Notation
It is the year MDLXVII in a world in which the Roman Empire never fell, and the collapse into the dark ages never occurred. Due to the extended period of Pax Romana, the empire's economic stability enabled technology to progress at a rapid rate.
The Romans have begun to dabble with circuitry, and have invented an ingenious calculator that doesn't require the use of an "equals" button. They call it "Roman Polish Notation"
To make a calculation, they enter their operands first, then the operation.
For example, 100 + 11 * 20 would be C XI XX * +.
Additionally
The Romans have found that they often need to make multiple calculations at the same time, and would prefer for the method to return every value "on the stack" in some sort of array/list/tuple-like structure. (e.g. X I + X I - CC II + would return [11, 9, 202])

The challenge is to develop a calculator program capable of making these computations.
Clarification: Subtractive Notation is required. I hadn't realized it wasn't recognized feature in the Ancient Roman empire. The task was therefore ambiguous, and I apologize.
Minimum Guidelines

Your output will be in Arabic Numerals.
You only need to convert from Roman Numerals up to 5000.
You will need to support +, -, /, * operations (addition, subtraction, division, and multiplication).
Whether division is floating point based or integer based is implementation specific. Either works for this challenge.
Your output will need to support numbers up to 4 Billion.
Shortest answer overall, AND in each language wins. This is a Code Golf Challenge but I love the variety.

In the event of a tie, factors like support for roman numerals above 5000 or additional operations will be considered the earliest submission will win.

Can we take input as a list of strings, each have either a Roman number or an operator?

can the input be taken in lowercase, or does it have to be uppercase?

@JesseDanielMitchell As a note... try not to change rules and invalidate existing answers. Also, (as usual) I suggest posting in the Sandbox.

Python 2 + roman, 118 bytes
from roman import*
s=[]
for i in input().split():s+=[eval(s.pop(-2)+i+s.pop())if i in"+-/*"else`fromRoman(i)`]
print s

Demo
It cannot be tested online because of the module it makes use of, but you can see how  to run this here (a full program accepting input from STDIN – an expression with quotes – and printing the output to STDOUT – in the form of a list, the stack). Uses a slightly older version, because I won't bother to create a new GIF for only a few bytes:

To install the package, you can run the following in the Terminal / Command Line:
pip install roman

pyTester/Py.py ಠ_ಠ

@totallyhuman It's just a dummy project that I made just for this...

Haskell, 217 bytes
-13 bytes thanks to Bruce Forte. -73 bytes thanks to Ørjan Johansen.
foldl(!)[].words
s@ ~(x:y:z)!n=last$(a n:s):[y`f`x:z|(f,c)<-zip[(+),(-),(*),(/)]"+-*/",n==[c]]
a s=last$0:[n+a(drop(length x)s)|(n,x)<-zip l$words"I IV V IX X XL L XC C CD D CM M",x<=s,x++"Y">s]
l=[1,4,5,9]++map(10*)l

Try it online!
Manual implementation, yay!

I cut that down a bit (so close to beating the new Python one...) Try it online!

The Python one got cut down too. But if his argument that subtractive notation doesn't need to be supported is upheld, then there are more savings here too.

In any case, another 3 bytes off with l=1:4:5:9:map(10*)l.

I remembered a remainder trick I once found for converting Roman numerals, which takes care of subtraction automatically. Try it online!

SOGL V0.12, 57 bytes
θ{:u=?F!!}F:u=‽0AøF{1"IVXLCDM”GWH∫2%3*⁽*}aa⁵<⌡±;A}a¹∑ι}}⁰

Try it Here!

JavaScript (Node) + romans + stk-lang, 74 bytes
s=>(R=require)("stk-lang")(s.replace(/\w+/g,R("romans").deromanize)).stack

Returns a list of bigintegers.
Execution
Run the following:
npm install romans
npm install stk-lang
node

Then paste the function. Example:
C:\Users\conorob\Programming\golf-new\roman
λ npm install romans
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\conorob\Programming\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\conorob\Programming\package.json'
npm WARN Programming No description
npm WARN Programming No repository field.
npm WARN Programming No README data
npm WARN Programming No license field.

+ romans@1.0.0
added 1 package in 0.801s

C:\Users\conorob\Programming\golf-new\roman
λ npm install stk-lang
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\conorob\Programming\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\conorob\Programming\package.json'
npm WARN Programming No description
npm WARN Programming No repository field.
npm WARN Programming No README data
npm WARN Programming No license field.

+ stk-lang@1.0.0
added 1 package in 0.847s

C:\Users\conorob\Programming\golf-new\roman
λ node
> s=>(R=require)("stk-lang")(s.replace(/\w+/g,R("romans").deromanize)).stack
[Function]
> f=_
[Function]
> f("X I + X I - CC II +").map(e => e.toString())
[ '11', '9', '202' ]
> f("C XI XX * +").map(e => e.toString())
[ '320' ]
> f("MMMM M I - +").map(e => e.toString())
[ '4999' ]

How many people use a lambda as prompt?

@StanStrum I like it, and it's the default for terminals like cmder

Didn't know that. Guess I've never deviated from $ and >. Honestly, I like it though

Dyalog APL, 93 bytes
⎕CY'dfns'
a←⍬⋄{0::{a,←⍵}roman⍵⋄f←⍎'+-÷×'⌷⍨'+-/*'⍳⍵⋄r←f/¯2↑a⋄a↓⍨←¯2⋄a,←r}¨{1↓¨⍵⊂⍨⍵∊' '}' ',⍞⋄a

Try it online!
116 bytes without the roman built-in

Woah, never saw modified assignment in a golf before

@Zacharý it's the only way I know to modify a variable out of its dfns scope, so it had to be used here.

Forgive my ignorance, but what is modified assignment?

@cairdcoinheringaahing var fn←arr - it's equivalent to var ← var fn arr. Here it's used in multiple places, a,←⍵ being one which appends ⍵ to the variable a

Python 3, 280 206 bytes
N=dict(I=1,V=5,X=10,L=50,C=100,D=500,M=1000)
def d(s):
	n=0
	for v in map(N.get,s):n+=v-n%v*2
	return n
def c(w):
	s=[]
	for t in w.split():s+=[str(d(t)if t[0]in N else eval(s.pop(-2)+t+s.pop()))]
	return s

Try it online!
This time with subtractive notation support. Method c is the main entry point; the other is support.
Edit log:

74 down thanks to Ørjan

You don't need the indentation blocks after if and else.

Actually, let me offer you this trick I once found: n+=v-n%v*2

You can also combine the two str uses. Try it online!

JavaScipt (ES6), 152 151 bytes
Saved 1 byte thanks to user202729
p=>p.split` `.map(c=>s.push(eval("+-/*".indexOf(c)+1?(T=s.pop(),s.pop())+c+T:c.replace(/./g,c=>"+"+{I:1,V:5,X:10,L:50,C:100,D:500,M:1e3}[c]))),s=[])&&s

Test cases

f=p=>p.split` `.map(c=>s.push(eval("+-/*".indexOf(c)+1?(T=s.pop(),s.pop())+c+T:c.replace(/./g,c=>"+"+{I:1,V:5,X:10,L:50,C:100,D:500,M:1e3}[c]))),s=[])&&s
console.log(f("C XI XX * +"))
console.log(f("X I + X I - CC II +"))

Explanation (less golfed)
V={I:1,V:5,X:10,L:50,C:100,D:500,M:1e3}     // Values of the roman numerals
p=>(
 s=[],                                      // Initialize the stack
 p.split` `.map(c=>                         // For every part in the input:
  "+-/*".indexOf(c)+1?                      //   If the input is an operator:
   s.push(eval((T=s.pop(),s.pop())+c+T))    //     Evaluate the operator on the top of the stack
  :                                         //   Else (if it is a roman numeral):
   s.push(eval(c.replace(/./g,c=>"+"+V[c])))//     Push the sum of the characters' values
 ),s)                                       // return the stack

I'm pretty sure that 1e3 also work and save some bytes.

Jelly, 82 bytes
ị“+-×÷”;”/v®ṫ-¤®ṖṖ¤;©
4Ḷ⁵*p1,5P€
“IVXLCDM”iÐ€ị¢µIN‘Ṡæ.µ®;©
Ḳµ“+-*/”W€i⁸Ñ⁸Ç¤¹?µ€ṛ®Ḋ

Try it online!
Originally posted in chat.

Explanation:
Because Jelly doesn't have a stack, I put the stack in the register.
When the program starts, the register value ® is 0, which is treated as [0] for the purposes of this program.

ị“+-×÷”;”/v®ṫ-¤®ṖṖ¤;©       Link 1: Given an operator index (an
                            integer in range 1..4), apply it.

ị“+-×÷”                     Index to the string "+-×÷"
       ;”/                  Concatenate with the character "/",
                            which is Jelly splat operator.
          v   ¤             Evaluate with parameter...
           ®                  the register's
            ṫ                 tail
             -                from -1. (2 last items)
               ®  ¤;        Concatenate with the register value,
                ṖṖ            pop twice.
                    ©       Store the result to register.

4Ḷ⁵*p1,5P€          Link 2: Niladic, generate [1,5,10,50,...]
4Ḷ                  Lowered range of 4, gives [0,1,2,3].
  ⁵*                Raise to power of 10. Value = 1,10,100,1000.
    p1,5            Calculate Cartesian product with [1,5].
                      Value = [1,1],[1,5],[10,1],[10,5],...
        P€          Calculate product of each item.

Alternatively, ×þ1,5F would also work instead of p1,5P€.

“IVXLCDM”iÐ€ị¢µIN‘Ṡæ.µ®;©   Link 3: Given roman number, push it
                            to the stack (register).
         i                  Find index of ...
          Ð€                  each character ...
“IVXLCDM”                     in "IVXLCDM".
            ị¢              Index to last link. (link 2)
              µ             With that value, (consider LIX ->
                            [50,1,10] for example)
               I
Ḳµ“+-*/”W€i⁸Ñ⁸Ç¤¹?µ€ṛ®Ḋ

[TODO complete explanation]

Python 3, 216 187 bytes
from operator import*
N=dict(I=1,V=5,X=10,L=50,C=100,D=500,M=1000)
def f(w):
	s=[]
	for t in w.split():s+=[str(sum(map(N.get,t)))if t[0]in N else str(eval(s.pop(-2)+t+s.pop()))]
	return s

Try it online!
Because it came up in the comments of both the question and this answer and likely led to down-votes: this submission doesn't support subtractive notation. Rationale: Subtractive notation was rarely used in the Roman Empire and only popularised later (see Subtractive Notation, paragraph 3, last sentence). The task presumes a Roman Empire that developed programmable integrated circuits, not one that underwent the same cultural changes as 13th century Europe. The description doesn't mention subtractive notation and none of the examples uses it.

Hm... you're not supporting numbers like CIV (104).

...can't fault your logic there. :P

Agh, you were right. I hadn't thought about the possible ambiguity, I wasn't aware subtractive notation wasn't a common feature in the Ancient Roman empire.

I did actually consider asking about subtractive notation under the OP (and noticed the lack of an example), but got distracted. If you think of definition ambiguities in future challenges, don't hesitate, just ask (answering with a caveat and a link to your comment should do if you want to post). Now a ruling is in you should attempt to fix it up :)


text:
Could They Be The Same Day Of The Week?
Challenge
Given a non-negative integer, output whether it is possible for two dates (of the Gregorian calendar) differing by exactly that many years to share a day of the week. A year is assumed to be a leap year either if it is divisible by 4 but not by 100, or if it is divisible by 400.
Output may be:

falsey/truthy (in either orientation)
any two distinct values
one distinct value and one being anything else
by program return code
by success/error
by any other reasonable means - just ask if you suspect it may be controversial

But not by two non-distinct sets of values, except for falsey/truthy (as this would allow a no-op!)
Detail
This is whether the input is a member of OEIS sequence A230995.
Members:
0, 5, 6, 7, 11, 12, 17, 18, 22, 23, 28, 29, 33, 34, 35, 39, 40, 45, 46, 50, 51, 56, 57, 61, 62, 63, 67, 68, 73, 74, 78, 79, 84, 85, 89, 90, 91, 95, 96, 101, 102, 106, 107, 108, 112, 113, 114, 117, 118, 119, 123, 124, 125, 129, 130, 131, 134, 135, 136, 140, 141, 142, 145, 146, 147, 151, 152, 153, 157, 158, 159, 162, 163, 164, 168, 169, 170, 173, 174, 175, 179, 180, 181, 185, 186, 187, 190, 191, 192, 196, 197, 198, 202, 203, 204, 208, 209, 210, 213, 214, 215, 219, 220, 221, 225, 226, 227, 230, 231, 232, 236, 237, 238, 241, 242, 243, 247, 248, 249, 253, 254, 255, 258, 259, 260, 264, 265, 266, 269, 270, 271, 275, 276, 277, 281, 282, 283, 286, 287, 288, 292, 293, 294, 298, 299, 304, 305, 309, 310, 311, 315, 316, 321, 322, 326, 327, 332, 333, 337, 338, 339, 343, 344, 349, 350, 354, 355, 360, 361, 365, 366, 367, 371, 372, 377, 378, 382, 383, 388, 389, 393, 394, 395
plus
400, 405, 406, 407, 411, ...

Non-members:
1, 2, 3, 4, 8, 9, 10, 13, 14, 15, 16, 19, 20, 21, 24, 25, 26, 27, 30, 31, 32, 36, 37, 38, 41, 42, 43, 44, 47, 48, 49, 52, 53, 54, 55, 58, 59, 60, 64, 65, 66, 69, 70, 71, 72, 75, 76, 77, 80, 81, 82, 83, 86, 87, 88, 92, 93, 94, 97, 98, 99, 100, 103, 104, 105, 109, 110, 111, 115, 116, 120, 121, 122, 126, 127, 128, 132, 133, 137, 138, 139, 143, 144, 148, 149, 150, 154, 155, 156, 160, 161, 165, 166, 167, 171, 172, 176, 177, 178, 182, 183, 184, 188, 189, 193, 194, 195, 199, 200, 201, 205, 206, 207, 211, 212, 216, 217, 218, 222, 223, 224, 228, 229, 233, 234, 235, 239, 240, 244, 245, 246, 250, 251, 252, 256, 257, 261, 262, 263, 267, 268, 272, 273, 274, 278, 279, 280, 284, 285, 289, 290, 291, 295, 296, 297, 300, 301, 302, 303, 306, 307, 308, 312, 313, 314, 317, 318, 319, 320, 323, 324, 325, 328, 329, 330, 331, 334, 335, 336, 340, 341, 342, 345, 346, 347, 348, 351, 352, 353, 356, 357, 358, 359, 362, 363, 364, 368, 369, 370, 373, 374, 375, 376, 379, 380, 381, 384, 385, 386, 387, 390, 391, 392, 396, 397, 398, 399
plus
401, 402, 403, 404, 408, ...

This is code-golf so the shortest answer in each language wins!

Can output be: program ends (within less than 30 seconds) if input belongs to the sequence, or runs indefinitely (infinite loop) otherwise?

@LuisMendo I'll allow a program that does that so long as it is accompanied with a program that provides the time limit (so one may acquire it prior for one's hardware). It is indeed controversial though :)

In which situation is a number divisible by 400 but is not divisible by 100?

@ATaco In none. The exception to the every fourth year rule are years that are divisible by 4 and 100, but not by 400.

@ATaco maybe the wording is clearer now

@Jonathan Thanks. Can you elaborate what you mean by “a program that provides the time limit”? You probably don’t mean just to print a number of seconds, or is that it?

@LuisMendo I do mean that - a guaranteed upper bound (otherwise I must accept a program whose author says "within 3 days" or whatever :p) TIO times things so maybe just wrap your program to run the most expensive input twice?

@JonathanAllan 30 seconds suffice in TIO. I've explained that in my answer; please let me know if it's enough and clear

MATL, 17 bytes
`0Gv@+5:YcYO8XOda

The program halts if the input belongs to the sequence, or runs indefinitely (infinite loop) otherwise.
Let n be the input. The code executes a loop that tests years 1 and 1+n; then 2 and 2+n; ... until a matching day of the week is found. If no matching exists the loop runs indefinitely.
The membership function for n is periodic with period 400. Therefore, at most 400 iterations are needed if n belongs to the sequence. This requires less than 20 seconds in Try It Online. As a proof of this upper bound, here's a modified program that limits the number of iterations to 400 (by adding @401<* at the end). Note also that this bound is loose, and a few seconds usually suffice.
Try it online!
Explanation
`           % Do...while
  0Gv       %   Push column vector [0; n], where n is the input number
  @+        %   Add k, element-wise. Gives [k; k+n]
  5:        %   Push row vector [1, 2, 3, 4, 5]
  Yc        %   Horizontal "string" concatenation: gives the 2×6 matrix
            %   [k, 1, 2, 3, 4, 5; k+n, 1, 2, 3, 4, 5]. The 6 columns
            %   represent year, month, day, hour, minute, second
  YO        %   Convert each row to serial date number. Gives a column
            %   vector of length 2
  8XO       %   Convert each date number to date string with format 8,
            %   which is weekday in three letters ('Mon', 'Tue', etc).
            %   This gives a 2×3 char matrix such as ['Wed';'Fri']
  d         %   Difference (of codepoints) along each column. Gives a
            %   row vector of length 3
  a         %   True if some element is nonzero, or false otherwise
            % End (implicit). The loop proceeds with the next iteration
            % if the top of the stack is true

Old version, 24 bytes
400:"0G&v@+5:YcYO8XOdavA

Output is 0 if the input belongs to the sequence, or 1 otherwise.
Try it online!
Explanation
400         % Push row vector [1, 2, ..., 400]
"           % For each k in that array
  0G&v      %   Push column vector [0; n], where n is the input number
  @+        %   Add k, element-wise. Gives [k; k+n]
  5:        %   Push row vector [1, 2, 3, 4, 5]
  Yc        %   Horizontal "string" concatenation: gives the 2×6 matrix
            %   [k, 1, 2, 3, 4, 5; k+n, 1, 2, 3, 4, 5]. The 6 columns
            %   represent year, month, day, hour, minute, second
  YO        %   Convert each row to serial date number. Gives a column
            %   vector of length 2
  8XO       %   Convert each date number to date string with format 8,
            %   which is weekday in three letters ('Mon', 'Tue', etc).
            %   This gives a 2×3 char matrix such as ['Wed';'Fri']
  d         %   Difference (of codepoints) along each column. Gives a
            %   row vector of length 3
  a         %   True if some element is nonzero, or false otherwise
  v         %   Concatenate vertically with previous results
  A         %   True if all results so far are true
            % End (implicit). Display (implicit)

Seems good, my request was really that I'd like to know the worst case input, or have a program which forces the 400 iterations -- that way one could get an upper bound wherever one chooses to run it. (BTW I think the infinite loop is, in practice, ended by an out of bounds error.)

@JonathanAllan Thanks. I see. I've added a modified program that limits the number of iterations to 400. It takes about 14 seconds, so I'm using 20 seconds as upper bound

Python 2, 58 bytes
u=-abs(200-input()%400)-4
print u/100+5>(u-8)*5/4%7>u%4/-3

Try it online!
A direct formula.

This is nice. I believe you can save 2 bytes with 5*u/4%7-3 instead of (u-8)*5/4%7.

Save 2 more by using the success/error option with 1/(...) instead of print ....

Jelly, 20 18 bytes
99R4ḍj`‘ṡ%4ȷ$S€P7ḍ

Outputs 1 for members, 0 for non-members.
Try it online!
How it works
99R4ḍj`‘ṡ%4ȷ$S€P7ḍ  Main link. Argument: n

99                  Set the return value to 99.
  R                 Range; yield [01, .., 99].
   4ḍ               Test each element in the range for divisibility by 4.
     j`             Join the resulting array, using itself as separator.
                    The result is an array of 9801 Booleans indicating whether the
                    years they represent have leap days.
       ‘            Increment the results, yielding 1 = 365 (mod 7) for non-leap
                    years, 2 = 366 (mod 7) for leap years.
         %4ȷ$       Compute n % 4000.
        ṡ           Take all slices of length n % 4000 of the result to the left.
             S€     Take the sum of each slice.
               P    Take the product of the sums.
                7ḍ  Test for divisibility by 7.

Python 2, 83 bytes
lambda i:all(c(y)-c(y-i)for y in range(401))
c=lambda n:(5*(n/4)+n%4-n/100+n/400)%7

Try it online!
Direct port of my Haskell answer.

Haskell, 76 bytes
-35 bytes thanks to Jonathan Allan. -2 bytes thanks to Lynn.
f i=or[c y==c$y+i|y<-[0..400]]
c n=(5*n#4+n%4-n#100+n#400)%7
(%)=mod
(#)=div

Try it online!
Using the OEIS PARI program's algorithm.

5*(n#4) can be 5*n#4 also!

Pyth, 32 bytes
iI7*FsM.:hMs.iKiIL4S99*98]K%Q400

Try it here! (Click "Switch to Test Suite" to verify more test cases at once)
How?
Uses a cool trick I just added to the "Tips for golfing in Pyth" thread.

iI7*FsM.:hMs.iKiIL4S99*98]K%Q400 | Full program. Reads from STDIN, outputs to STDOUT.

                   S99           | Generate the integers in 1 ... 99.
                 L               | For each integer N in that list...
               iI 4              | Check if 4 is invariant over applying GCD with N.
                                 | This is equivalent to checking if 4 | N.
              K                  | Store the result in a variable K.
            .i         *98]K     | And interleave K with the elements of K wrapped
                                 | into a list and repeated 98 times.
           s                     | Flatten.
         hM                      | Increment.
       .:                        | And generate all the substrings...
                           %Q400 | Of length  % 400.
     sM                          | Sum each.
   *F                            | And apply folded product.
iI7                              | Check if 7 is invariant when applied GCD with the
                                 | product (basically check whether 7 | product).
                                 | Implicitly output the appropriate boolean value.

Python 3, 110 107 bytes
from datetime import*
lambda n,d=date:0in[d(i,1,1).weekday()-d(i+n%400,1,1).weekday()for i in range(1,999)]

Try it online!
-3 bytes thanks to Mr. Xcoder.


text:
Uh, is it a haiku?
So you want to create a haiku, but you're not sure if it follows the syllable rules for a haiku.
I couldn't be bothered to write a proper blurb like I usually do, so you'll have to make do with this. Let's get stuck right in.
Finding a haiku out in the wild
For the purposes of this challenge, we will be checking if the given poem satisfies these criteria:

There are three lines.
The first line has 5 syllables.
The second line has 7 syllables.
The third line has 5 syllables.

Each line is composed of one or more words, separated by groups of spaces. These words are not necessarily valid English words.
Each word is split up into syllables, and then those syllables are counted to get the total syllable count of the line.
A syllable has either 2 or 3 parts to it: the beginning, the end, and possibly the middle. Each part is either a group of consonsants (also known as a consonant cluster, such as s, sk or spl) or a group of vowels (such as i, ea or oui).
If the beginning is a group of consonants, the middle will be a group of vowels and the end will be a group of consonants. If the beginning is a group of vowels, the end will be a group of consonants and there will be no middle.
For example, the word example is made up of three syllables, ex, am and ple. ple has no ending as it was cut short by the end of the word.
As another example, the word syllable also has three syllables, syll, abl and e, which also has no ending.
For one final example, the word word has one syllable, word, which ends with a group of consonants.
The challenge
Given a string, list of strings, list of lists or any other reasonable format representing a poem with at least one line, determine if it meets the criteria of a haiku outlined above and return the result.
You may return the result in any of these formats:

A truthy value if the poem is a haiku and a falsy one otherwise.
A falsy value if the poem is a haiku and a truthy one otherwise.
A value from a finite range of values specified in the submission if the poem is a haiku and a value from a mutually exclusive finite range of values also specified in the submission.

You may also assume the poem contains no non-alphabetical characters, but you may not assume that it is entirely in uppercase or lowercase.
For the purposes of this challenge, Y is a vowel.
Test cases
Truthy
This is a haiku
Yes it truly is one
See what I did man

I am so tired
of writing this already
when can I stop this

Writing another
Of these horrific things
Come on please

Consonant only
Counts as one syllable
ghjk tgh knmb wrts vbc

Falsy
oh boy writing non haiku is so much easier

This is
so good
on my
poor dear brain

The syllables do not match
at least I do not think so
I have not checked

It does not really matter
these test cases will help
At least I think they will

I am done here
This is enough
Goodbye

Scoring
Since this is code-golf
The shortest answer will win
Good luck to you all

Sandbox

Related

Jelly,  25  23 bytes
-2 thanks to Erik the Outgolfer (use a list of lines as input)
e€Øy0;ŒgP€
ḲLÐfÇ€ḣ8µ€ḣ4

A monadic link taking a list of lists of characters (the lines) and returning a list of lists of lists of zeros and ones. Valid haiku will be length 3 and once any of the deepest lists that are a single zero are replaced by a single one the sum of the flattened lists will be 5, 7, and 5 respectively. The formation (whether runs of letters are consonants and only taking the first 8 words of each of up to only 4 lines) ensures there are only finite of each of the valid and invalid ranges.
Try it online! or see the (even more confusing!) test-suite

Here is a much easier to use  32  30 byte version, simply outputting 1 or 0:
e€Øy0;ŒgP€SȯL$
ḲLÐfÇ€Sµ€⁼5,7,5

Try this one or see its test-suite.

I don't think the "range" of non-Haiku possibilities is finite - you can have an unbounded number of words/lines in those.

Oh damn when the change was made I thought it was only the haiku range that need be finite. That puts it back to the 32 byter I think.

OK addressed for four bytes by limiting words per line to eight and lines to four.

I think you can remove Ỵµ, as you can take a list of lines.

JavaScript (ES6), 84 75 bytes
Takes input as a list of lists of words. Returns true for haiku or false for non-haiku.
a=>a.map(s=>(s.map(w=>w.match(/[aeiouy]+/gi))+'').split`,`.length)=='5,7,5'

Test cases

let f =

a=>a.map(s=>(s.map(w=>w.match(/[aeiouy]+/gi))+'').split`,`.length)=='5,7,5'

console.log('[Truthy]');

console.log(f([
  ["This","is","a","haiku"],
  ["Yes","it","truly","is","one"],
  ["See","what","I","did","man"]
]));
console.log(f([
  ["I","am","so","tired"],
  ["of","writing","this","already"],
  ["when","can","I","stop","this"]
]));
console.log(f([
  ["Writing","another"],
  ["Of","these","horrific","things"],
  ["Come","on","please"]
]));
console.log(f([
  ["Consonant","only"],
  ["Counts","as","one","syllable"],
  ["ghjk","tgh","knmb","wrts","vbc"]
]));

console.log('[Falsy]');

console.log(f([
  ["oh","boy","writing","non","haiku","is","so","much","easier"]
]));
console.log(f([
  ["This","is"],
  ["so","good"],
  ["on","my"],
  ["poor","dear","brain"]
]));
console.log(f([
  ["The","syllables","do","not","match"],
  ["at","least","I","do","not","think","so"],
  ["I","have","not","checked"]
]));
console.log(f([
  ["It","does","not","really","matter"],
  ["these","test","cases","will","help"],
  ["At","least","I","think","they","will"]
]));
console.log(f([
  ["I","am","done","here"],
  ["This","is","enough"],
  ["Goodbye"]
]));

Retina, 49 bytes
i`[aeiouy]+
1
T`lL`2
2*12+
3
[12]+
3
%M`3
^5¶7¶5$

Try it online!
Outputs 1 for haiku,0 for non-haiku.

@FryAmTheEggman That worked, except I had to add ^ and $ because x haikus in a row would give x as a string.

I think this might work for 45 bytes.

Python 2, 126 125 120 121 bytes
lambda s:[len(split('\s+',sub('[aeiouy][^aeiouy ]+','X ',t,0,I).strip()))for t in s.split('\n')]==[5,7,5]
from re import*

Try it online!

Your last edit broke the requirement that consonant-only words count as 1 syllable.

@Ørjan Johansen: Fixed; thx!

in 116B

You can golf some easy bytes off by taking input as a list of lines, and replacing s.split() with just s

Perl 5, 63 + 1 (-p) = 64 bytes
$a[$.]=()=/([aeiouy]+|\b[^aeiouy ]+\b)\s*/ig}{$\="@a"eq" 5 7 5"

Try it online!

Mathematica 119 Bytes
Here is a version that conforms to the given rules for syllables:
Tr/@Map[Length@StringCases[#,("a"|"e"|"i"|"o"|"u"|"y")..]/. 0->1&,(s=StringSplit)/@s[ToLowerCase@#,"\n"],{2}]=={5,7,5}&

Here is an 83 byte version that actually counts syllables:
Tr/@Map[Length@WordData[#,"Hyphenation"]&,(s=StringSplit)/@s[#,"\n"],{2}]=={5,7,5}&

e.g.
%@"This is a haiku
Yes it truly is one
See what I did man"

returns False since the second line has six syllables rather than the required seven.

This fails because the challenge explicitly defines its own syllable count, which does not use ordinary English rules.

Well thanks for not downvoting.  I see an attempt at a definition of a syllable, but it's not clear.  I'm guessing "one" has two syllables by this definition.  Looks like people are just counting contiguous vowels.

Almost, but words with no vowels count as one syllable. See the question comments. I suppose it's just confusing about what to do about consonant groups, but that doesn't actually affect the final count.

"one" has two vowels, and they aren't contiguous.

Right, so they count as two syllables.

OK, I'll post an update with this

Clean, 162 ... 115 bytes
import StdEnv,StdLib
@t=[sum[max(sum(map hd(group[sum[1\\v<-:"AaEeIiOoUuYy"|c==v]\\c<-w])))1\\w<-l]\\l<-t]==[5,7,5]

Defines the function @, taking [[[Char]]] (list of list of words), and giving Bool.
Returns True when the input is a haiku, False otherwise.
Try it online!

Seems to fail on the consonant-only word corner case.

@ØrjanJohansen fixed


text:
Riffle shuffle a string - Cops
Robbers post
A riffle shuffle is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle shuffle a string:

Split the string into equal sections.
Reverse the strings, and starting from the start of each string.
Put runs of a uniformly random length between 1 and the number of characters left in the current string into the final string
Then remove these characters from the string.
Repeat for the other half, until both halves are empty.

An example
"Hello World!"      Output string = ""
"Hello ", "World!"  ""
"Hell", "World!"    " o"
"Hell", "World"     " o!"
"Hel", "World"      " o!l"
"Hel", "Wo"         " o!ldlr"
"H", "Wo"           " o!ldlrle"
"H", ""             " o!ldlrleoW"
"", ""              " o!ldlrleoWH"

The final product from Hello World! could be o!ldlrleoWH and that is what you would output.
Cops
Your task is to make a program (or function) that will riffle shuffle a string. If the inputted string is of odd length, just split it into two uneven length strings with a relative length of +1 and +0 (abc => [ab, c] or [a, bc]). You may take input in the normal fashion and produce output in the normal fashion.
Your Cops submission will consist of 4 things

The language you used
The length of your program in bytes
Your program, riffle shuffled.
Anything else you want to add

You are aiming to keep your code from being uncracked by the Robbers for 7 days. After that period, your program is safe and you should edit in your original program. Your submission may still be cracked until you reveal your solution. The shortest, safe solution will be the winner!

Let us continue this discussion in chat.

The change to uniformly random makes me a sad dragon. I had fun making an entry using a Wald Distribution (inverse gaussian). I'd love to post it.

><>, 46 bytes
 }lr]l:l~\r[-r}x>o?
<!l>x![; ?=\?(0:2i
:,2-%2:

There’s almost no obfuscations in the real code, but I suspect a 2D language will be hard enough to crack anyway.
Disclaimer: Written before it was specified that it had to be uniformly random. This is not uniformly random, and I'm not sure how I'd even implement a uniformly random algorithm in ><> to begin with.

Python 3, 154 bytes (list of chars -> list of chars) (function) Cracked
[=o;]1-::[]:s[i,]1-::[]s:[i=R,L;2//)i(nel=s
:)i(r fed
*tropmi modR+L+o nruter
]:s[L,R=R,L;]s:[L=+o;))L(nel,1(tnidnar=s:R dna L elihw
]nar morf

I doubt this will be too hard to crack, especially since riffling once is rather ineffective (you can see entire program components in the output...). This is mostly just to get things rolling. There might be some whitespace (including newlines) that I didn't copy correctly. The SHA-384 hash of my  intended solution is
5924530418bf8cd603c25da04ea308b124fdddfc61e7060d78b35e50ead69a7fbde9200b5ee16635cc0ee9df9c954fa1.

@H.PWiz Python. Whoops, forgot to add it in (also bytecount, thanks for the reminder!)

In theory, could you just try reverse riffle shuffling the code and executing it with python until it works?

@fəˈnɛtɪk Theoretically that should work... It may take you a while though :P

@fəˈnɛtɪk That's just like try solving the programming language quiz with TIO brute force. There is no fun in doing it.

Cracked

randint includes both endpoints, so you'd need len(i)-1. This might have invalidated your riffled code too. (e.g. running with an input ABCD, assuming left always goes first shouldn't be able to result in CDBA, but this does - assuming the crack is right of course!)

Furthermore all the runs should be in reverse order (like the dlr selection in the example).

@JonathanAllan Theoretically the randint thing shouldn't cause any issues because if s == len(L) then nothing will happen in the remainder of the loop. I fixed the reverse run thing though, I'll add a comment on the cracked post.

Something does happen - R&L swap over, so you get to choose 0 then swap sides.

@JonathanAllan oh good point. Hmm I'll have to fix that somehow then.

...I see you fixed it (my fix was 152 ;p)

Recracked

Jelly, 11 bytes, Cracked
This is a golfed version so someone can probably crack it easily just by making a golfy version. There are probably a few different approaches but I suspect this approach will be decently common with golfing languages.
Ṗ/Œż€X€U2sœ

The SHA-384 hash of my intended program is 86025a659b3c5fc38e943f72b1f26e28e2e751a7118a589073f1d24fa61ff6b02753d6a0f3f0c7fee6555de69fd06a74 (using UTF-8 encoding).

Cracked

@fireflame241 good job +1

R, 283 bytes, Cracked
/n,s(daeh-<l
))'',s(tilpsrts(le::sdohtem-<s
)s(rahcn-<n{)s(noitcnufhtgnel(fi
})x-,l(liat-<l
)))x,l(daeh(ver,o(c-<o
)1,)l(htgnel(elihw
}{-<o
)2/n,s(liat-<r
)2'=pes,o(tac
}})y-,r(liat-<r
)))y,r(daeh(ver,o(c-<o
)1,)r(htgnel(elpmas-<y{))r(l(fi{))r(htgnel|)l(htgnel()'htgne}(lpmas-<x{))le

I realize now that writing a longer answer has more "runs" of characters that are preserved, alas.
Good luck!

Cracked

@Mr.Xcoder  thanks for the edit

APL (Dyalog Unicode), 62 bytes
(g÷f¨()⍵(≢~⊃⍵⍺⍉⍨⍨}(←(←'')⊂f≢(g∘⌈¨}{?↑-⍵↑⋄)≢)))≢⊂{,⋄⍵⍵↑2f≢∘⊃?()

SHA-384 of my intended solution: 3209dba6ce8abd880eb0595cc0a334be7e686ca0aa441309b7c5c8d3118d877de2a48cbc6af9ef0299477e3170d1b94a
This is probably easy enough, especially since most of the people in the APL chat helped me build this answer.

Röda, 118 bytes
2//x#=z}][=]:y[x
}]0>)b..a(#[]1-::[]:y[x
x#%)(reelihw}]0>b#[fi)b(g
getnI]0>a#[fi)a(g{]mo:z[x=b]zdnar=y|x|{=:[g{xx=a
 f

It takes a stream of characters as input and outputs a stream of characters.

Pyth, 14 bytes, Cracked
_Qm/dc2iF.jk.O

Pretty standard-issue Pyth implementation to test the waters. May be quite easy to crack, but I guess we'll see how it fares.

Cracked!

Pushy, 25 bytes, Cracked
iUL1[N@O;?x?v:/2L=0LF;.':

Takes input as a "quoted string" on the command line.

Cracked

Should the 1L be the other way around? Otherwise you're adding 1 to the length

@JoKing Correct, and nice crack!

Random Brainfuck, 273 bytes
]<.[<<]<[<<]<[<]<,.[<]-<<<]>>>>>]<+>-[<]<+>-[<<]>]>+<]<]>[>>]]>[>>]<]<+>-[[<<]>]>[>>]<-[[[>>]]>[>]<+>-[[<]<[[?>>]<+>-[[<]-<]>]<[>>]<<+>>+>-[[<<,[>]<.[<]>[>]<+>-[<]>[>]->>>]<<<<<]>+-[<<-[>]>+<-[>>]<]<+>-[[[<<]]<[<]>+<-[[><]<[[>]<+>-[>],]<+>-[<]<->>+]>[[<-[<?<<+>>>[,]>+<-[[>

Random brainfuck is the same as normal brainfuck, but it introduces the ? character, which sets the current cell to a random value. Fun note; I had a version of this that only worked for inputs of less than 256 characters, for obvious reasons, but the code itself was longer than that. When I changed it to handle longer, it turned out to be one byte shorter than the original. ¯\_(ツ)_/¯.


text:
Riffle shuffle a string - Robbers
Cops post
A riffle shuffle is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle shuffle a string:

Split the string into equal sections.
Reverse the string, and starting from the start of each string.
Put runs of a random length between 1 and the number of characters left into the final string
Then remove these characters from the strings.

An example
"Hello World!"      Output string = ""
"Hello ", "World!"  ""
"Hell", "World!"    " o"
"Hell", "World"     " o!"
"Hel", "World"      " o!l"
"Hel", "Wo"         " o!ldlr"
"H", "Wo"           " o!ldlrle"
"H", ""             " o!ldlrleoW"
"", ""              " o!ldlrleoWH"

The final product from Hello World! could be o!ldlrleoWH and that is what you would output.
Robbers
Your task is to take a Cops submission and rearrange so that it produces a valid riffle shuffler program. You may not add, remove or change any characters in the original program to result in your solution.
If the program works, even if it is not the cops intended solution, it is a valid crack.
The winner is the person who cracks the most Cops submissions!

Sandbox

Python 3, HyperNeutrino
from random import*
def r(i):
    s=len(i)//2;L,R=i[:s][::-1],i[s:][::-1];o=[]
    while L and R:s=randint(1,len(L));o+=L[:s];L,R=R,L[s:]
    return o+L+R

Try it online!
Proof of Same Character Set

Sorry, my original post had a slight issue. The new version shouldn't be too hard to determine from your current progress. Good job though, this was my original solution!

Jelly, HyperNeutrino
œs2UŒṖ€X€ż/

Try it online!

Pyth, notjagan
jk.iFmO./_dc2Q

Try it here!
Explanation
The Pyth interpreter also offers a nice pseudo-code if you check the "Debug" box.

c2Q chops the input into 2 pieces of equal length, with initial pieces one longer if necessary.
m maps a function over the pieces. Variable: d.

_d reverses d
./ partitions the reverse of d; returns all divisions of the reversed d into disjoint contiguous substrings.
O chooses a randOm partition.

.iF Folds (reduces) the list by .interleaving.
And finally jk joins the list of strings.

Pushy, FlipTack
L2/:v;O@N[1LU:'.;FL0=?x?i

Try It Online

R, Giuseppe
function(s){n<-nchar(s)
s<-methods::el(strsplit(s,''))
l<-head(s,n/2)
r<-tail(s,n/2)
o<-{}
while(length(l)|length(r)){if(length(r)){y<-sample(length(r),1)
o<-c(o,rev(head(r,y)))
r<-tail(r,-y)}
if(length(l)){x<-sample(length(l),1)
o<-c(o,rev(head(l,x)))
l<-tail(l,-x)}}
cat(o,sep='')}

Try it online!


text:
Is it a Pascal Prime?
It is well known that odd primes will appear in Pascal's triangle exactly twice. However, not all numbers that appear exactly twice in Pascal's triangle are prime. We'll call these numbers Pascal primes.
Pascal primes are composite numbers that appear exactly twice in Pascal's triangle. The first few Pascal primes are
4, 8, 9, 12, 14, 16, 18, ...

Your challenge is to take a positive integer n as input and output true or false, depending on if n is a Pascal prime or not. This is code-golf, so the shortest program wins!

Relevant OEIS.

Can we output True if it isn't a Pascal prime and false if it is?

This sequence is OEIS sequence A002808's intersection with OEIS sequence A137905.

@cairdcoinheringaahing no, it must be in the given requirement.

I'm surprised nobody has posted an answer in Pascal. I will if I get the time (and if I can find my old Pascal compiler).

Wolfram Language (Mathematica), 45 bytes
CompositeQ@#&&Binomial~Array~{#-1,#}~FreeQ~#&

Try it online!
Every composite number n appears exactly twice on row n and cannot appear afterwards. So the condition for Pascal primes is that they don't appear at all within the first n-1 rows.
As far as I can tell, this is shorter than checking that it appears exactly twice within the first n rows and being able to use !PrimeQ instead.

Jelly, 11 10 9 bytes
Thanks to:

Martin Ender for -1 byte! (another approach, use ’ (+1) avoid using n2 (-2), so -1 overall.
Jonathan Allan for bug fix.
Dennis for another -1 byte.

Ḷc€ḶFċ=ÆP

Try it online!
Alternative approach, by Jonathan Allan. (flawed)
----------- Explanation -----------
Ḷ            Lowered range. [0, 1, ..., n-1]
 c€Ḷ           `c`ombination `€`ach with `Ḷ`owered range [0...n-1]
    F        Flatten.
     ċ       Count the number of occurences of (n) in the list.
       ÆP    Returns 1 if (n) is a prime, 0 otherwise.
      =      Check equality.

Explanation for the last line:

As pointed out by Martin Ender, "n appears twice in the Pascal triangle" is equivalent to "n doesn't appear in the first n-1 rows".
We want to return true if the number is not a prime (that is, ÆP == 0) and the count c is zero. From that we can deduce that ÆP == c.
It can be proven that if they are equal, then they are equal to 0, because:

ÆP return a boolean value, which can only be 0 or 1.
If it returns 1, then n is a prime, therefore it cannot appear in the first n-1 lines (that is, c == 0)

1 is not a Pascal prime; this says it is.

Ḷc€ḶFċoÆP¬ would work I think.

ċ=ÆP should work.

FYI I found a flaw in my approach and have deleted it.

BTW Ḷcþ\Fċ=ÆP` should work too.

Python 2, 93 bytes
def f(n):l=[1];exec"(n in l)>=any(n%k<1for k in range(2,n))>q;l=map(sum,zip([0]+l,l+[0]));"*n

Try it online!
This is a named function f, which outputs via exit code, 0 for Pascal Primes, 1 otherwise.
How this works?
def f(n):l=[1];                       # Define a function f (arg. n) and a list l = [1].
exec"..."*n                           # Execute n times.
(n in l)                              # Boolean: "n is in l?" is greater than...
   >=any(n%k<1for k in range(2,n))    # the boolean: "Is n composite?"?
            >q;                       # If the boolean comparison returns a falsy
                                      # result, then continue on without any difference.
                                      # Otherwise, evaluate the other part of the
                                      # inequality, thus performing "is greater than q".
                                      # Since we have no variable "q", this terminates
                                      # with exit code 1, throwing a "NameError".
l=map(sum,zip([0]+l,l+[0]));          # Generate the next row in Pascal's triangle,
                                      # By zipping l prepended with a 0 with l appended
                                      # with a 0 and mapping sum over the result.

This basically checks whether n occurs in the first n - 1 rows of Pascal's triangle or if it is prime, and throws an error if any of these two conditions are met.
Saved 1 byte thanks to ovs.

93 bytes

@ovs :o That’s clever! Thanks.

APL (Dyalog), 44 34 24 19 bytes
5 bytes saved thanks to @Cowsquack
(~0∊⊢|⍨2↓⍳)⍱⊢∊⍳∘.!⍳

Try it online!
How?
We make sure that neither does
⍳ - range 0 .. n-1,
⍳∘.! - upon cartesian binomial with self
⊢∊ - contain n,
⍱ - nor does
⊢|⍨ - n modulo each item of
2↓⍳ - range 2 .. n-1
~0∊ - not contain 0 (a.k.a non-divisible)

Converting it into a train (∨/1↓1≠⊢∨⍳)∧(~⊢∊⍳∘.!⍳) is shorter by two bytes

@Cowsquack hmm I didn't notice it got so short that a train could fit (started as 40 byter). Thanks!

(0∊⊢|⍨2↓⍳)∧∘~⊢∊⍳∘.!⍳ for another two, I changed the primality checking algorithm

@Cowsquack oo clever. I've never seen that primality variation before

Rearranging the ~ gives (~0∊⊢|⍨2↓⍳)⍱⊢∊⍳∘.!⍳ for one less byte.

Haskell, 86 84 bytes
p=[]:[zipWith(+)(1:x)x++[1]|x<-p]
f n=all((>0).rem n)[2..n-1]==any(elem n)(take n p)

Try it online!
Explanation
The function p recursively defines a degenerate Pascal's triangle:
[]
[1]
[2,1]
[3,3,1]
[4,6,4,1]
[5,10,10,5,1]

As we can see (in this solution 1 is somewhat special) every number n appears exactly twice in the n+1th row and all elements of the subsequent rows only get bigger, thus we only need to check if n is somewhere up to the nth row to see if an element is disqualified:
any(elem n)(take(n-1)p)

Now we have True for all elements that appear more than twice (except 1), so all we need is to have a faulty isPrime function that returns True for 1:
all((>0).rem n)[2..n-1]

05AB1E, 10 bytes
ÝDδcI¢IpÌQ

Try it online!
Explanation
Ý            # push range [0 ... input]
 D           # duplicate
  δc         # double vectorized command binomial
    I¢       # count occurrences of input
      Ip     # check input for primality
        Ì    # add 2
         Q   # compare for equality

Checks that n occurs exactly twice in the first n+1 rows of pascals triangle and isn't prime.
The comparison works as there are no primes that can occur 3 times in the triangle.

JavaScript (Node.js), 103 101 bytes
n=>(r=x=>[...Array(n).keys(F=n=>n>0?n*F(n-1):1)].every(x))(i=>r(j=>F(i)/F(j)/F(i-j)-n))>r(i=>i<2|n%i)

Try it online!

n=>(r=x=>[...Array(n).keys(F=n=>n>0?n*F(n-1):1)].every(x))(i=>r(j=>F(i)/F(j)/F(i-j)-n))>F(n-1)**2%n threority works but in fact for small range

Ruby, 97 95 bytes
->n{c=!r=[1,1]
(2...n).map{|i|c|=1>n%i
[n]&r=[0,*r,0].each_cons(2).map{|a,b|a+b}}&[[n]]==[]&&c}

Try it online!
Scraped a couple bytes off.

R, 55 bytes
function(n)sum(!n%%1:n)>2&!n%in%outer(1:n-1,1:n,choose)

Try it online!
sum(!n%%1:n)>2 is the composite test and outer(1:n-1,1:n,choose) computes rows 0 to n-1 of Pascal's triangle, so we make sure n does not appear there.

Haskell, 90 bytes
f n=2==sum[1|i<-[0..n],j<-[0..i],p[j+1..i]`div`p[1..i-j]==n,mod(p[1..n-1]^2)n<1]
p=product

Try it online!

Pyth, 10 bytes
qP_Q/s.cRU

Try it online! or check the Test suite.

JavaScript (Node.js), 79 133 130  128 bytes
f=(n,a=[1])=>n<a.length||[...'0'.repeat(n)].filter((x,i)=>n%i<1).length>1&&a.indexOf(n)<0&&f(n,[...a.map((x,i)=>x+a[i-1]||1),1])

Try it online!
evil prime checker +50 bytes :(

Python 2, 105 104 bytes
thanks to user202729 for -1 byte
a=q=[1];n=input();r=n<4;p=1
for i in range(2,n):q=a+map(sum,zip(q[1:],q))+a;r+=n in q;p*=n%i
print p+r<1

Try it online!

The pair of parentheses around p+r seems redundant...


text:
Finding My Favorite Times
I really like times that follow certain patterns. In particular, I like times where all the digits are the same, or all of the digits increase arithmetically by one from left to right. Further, I viscerally hate when people put letters in my times, so all of that AM/PM nonsense is dead to me. Thus, my favorite times are:
0000 0123 1111 1234 2222 2345

For my peace of mind, I need you to write me a single program that, given the current time as input, both: (A) if it is not now one of my favorite times, tells me both (i) how many minutes it's been since my last favorite time as well as (ii) how many minutes from now my next favorite time will occur; and (B) if it is now one of my favorite times, supplies a single 'signal value'.
Input
Your program should accept (by whatever method: function argument, stdin, command line argument, etc.) the current time, in any of the following formats:

A four-digit time as a string
An integer that can be zero-padded on the left to make a four-digit time as a string
A sequence of four (or fewer) integers, ordered such that the first integer in the sequence is the leftmost (significant) digit in the time input (e.g., 0951 could be validly represented as [0, 9, 5, 1] or [9, 5, 1])

Representing 0000 as a zero-length sequence is acceptable

In the case of a string input, it should only contain digits, no colons or other punctuation.  Inputs can be assumed to always be valid 24-hour times: HHMM, where 0 <= HH <= 23 and 0 <= MM <= 59. Disregard the possibility of a leap second.
Output
Your program must supply (function returns, stdout, etc. are all fine) either (A) or (B), as appropriate to whether or not the input value is a target time.
For (A):
Supply two numeric values in any sensible format, such as:

Single-string output with a suitable delimiter
Sequential integer/string outputs, e.g., bash printing two lines to stdout:
49
34

Length-two ordered return values, such as a Python list, a C array, etc.: [49, 34]

The values can come in either order. For example, both of the following would be valid outputs for an input of 1200:
49 34
34 49

The order and separator must be the same for all input values, however!
For (B):
Produce any otherwise unattainable result. The same result must be produced for all six of the target times, however. Infinite loops are excluded.
Sample Inputs/Outputs
YAY!!! is used here as a demonstrative example and is not prescriptive.
Input      Output
------    --------
 0000      YAY!!!
 0020      20 63
 0105      65 18
 0122      82 1
 0123      YAY!!!
 0124      1 587
 0852      449 139
 1111      YAY!!!
 1113      2 81
 1200      49 34
 1234      YAY!!!
 1357      83 505
 1759      325 263
 1800      326 262
 1801      327 261
 2222      YAY!!!
 2244      22 61
 2345      YAY!!!
 2351      6 9

This is code-golf, so shortest code in bytes wins. Standard loopholes are disallowed.

Is it OK to return nothing for a favorite time?

@JamesHolderness Fictional-me gets antsy if I don't get anything at all back from an application (what if the interpreter glitched?!?!), so there has to be some value or output generated.

Jelly, 34 33 32 31 28 bytes
3 bytes thanks to Mr. Xcoder's .ị and ³ tricks.
d³ḅ60;15j83,588ṁ5¤_\ṠÞAµ.ịxẠ

Try it online!
Some parts are exactly as in Jonathan Allan's answer, but I'm posting it as I think it is sufficiently different from it and independently written based on my Pyth answer (and shorter :D). Should also have room for improvement.
Input is an integer, output is an array of previous and next times or the empty array for special times.
Explanation
Using example input 1200.

d³ converts the time to base 100, into hours and minutes: [12,0].
ḅ60 converts from base 60 to get total minutes: 720.
;15 pairs it with 15: [720, 15].
83,588 creates the array [83, 588].
ṁ5 makes it length 5: [83, 588, 83, 588, 83].
¤ combines the two above actions. Just a technicality.
j joins the pair with the array: [720, 83, 588, 83, 588, 83, 15].
_\ subtracts each array value from the first and gets intermediate results: [720, 637, 49, -34, -622, -705, -720].
ṠÞ stably sorts these by signum: [-34, -622, -705, -720, 720, 637, 49].
A takes the absolute values: [34, 622, 705, 720, 720, 637, 49].
µ starts a new monadic chain. Again, a technicality.
.ị takes the last and first items: [49, 34].
×Ạ repeats that once if there are no zeroes, or zero times otherwise: [49, 34].

@JamesHolderness Fixed for no size change (changed , to ; since it was being picked up as a list literal).

Funnily enough, I tried to port your Pyth answer to Jelly and I got 28 bytes. I don't think it is different enough to be a separate answer, so feel free to use it (and the cute test suite :P). (note that using ³ instead of 100 is allowed) The YAY!!! value is [0, 0], always the same.

Nice, thanks! I think the main improvement is the half-indexing trick, I never thought about that one.

Are you planning to update with my suggestions? (Just a reminder, I have the feeling that you have forgot to edit?)

@Mr.Xcoder Yeah, forgot to edit. I'll use xẠ as the zero filter since I kind of prefer [] over [0, 0] because it's more clearly different.

JavaScript (ES6), 87 83 bytes
Saved 4 bytes thanks to @l4m2
Takes input as a string. Returns either 0 or a 2-element array.
t=>[i=0,83,588,83,588,83,15].every(d=>(k=t-(t/25>>2)*40)>(j=i,i+=d))|i-k&&[k-j,i-k]

Test cases

let f =

t=>[i=0,83,588,83,588,83,15].every(d=>(k=t-(t/25>>2)*40)>(j=i,i+=d))|i-k&&[k-j,i-k]

console.log(f('0000')) // YAY!!!
console.log(f('0020')) // 20 63
console.log(f('0105')) // 65 18
console.log(f('0122')) // 82 1
console.log(f('0123')) // YAY!!!
console.log(f('0124')) // 1 587
console.log(f('0852')) // 449 139
console.log(f('1111')) // YAY!!!
console.log(f('1113')) // 2 81
console.log(f('1200')) // 49 34
console.log(f('1234')) // YAY!!!
console.log(f('1357')) // 83 505
console.log(f('1759')) // 325 263
console.log(f('1800')) // 326 262
console.log(f('1801')) // 327 261
console.log(f('2222')) // YAY!!!
console.log(f('2244')) // 22 61
console.log(f('2345')) // YAY!!!
console.log(f('2351')) // 6 9

How?
We do not care about the result of the .every() loop. Provided that the input is valid, it will always be falsy. What we're really interested in is when we exit this loop.
We exit as soon as we find a favorite time i (expressed in minutes) which is greater than or equal to the reference time k (the input time t converted in minutes). We then return 0 if i == k or the 2 delays otherwise.

t%100+(t/25>>2)*60 => t-(t/100|0)*40

Befunge-93, 88 85 86 80 74 bytes
&:"d"/58**-:"S"-:"b"6*-:"S"v
@._v#!:<\-*53:-"S":-*6"b":-<
:$#<$$\^@.._\#`0

Try it online!
Outputs the number of minutes since the last favourite time, followed by the number of minutes until the next favourite time (separated by the two character sequence: space, hyphen). If it is already a favourite time, then a single zero is returned.

Jelly,  33 32  34 bytes
 +3  +2 bytes to fix up so all liked time outputs are equal.
gotta be a shorter way!
s2Ḍḅ60
83,588ṁ5“¡Ð‘j+\ṡ2>E¥ÞÇḢạÇa\

A monadic link taking a list of the four digits and returning a list containing two integers
- if it's a liked time the result both entries will be zeros.
Try it online! or see the test-suite.
How?
s2Ḍḅ60 - helper link, getMinuteOfDay: list of digits, D   e.g. [1,2,3,3]
 2     - literal two                                           2
s      - split into chunks of length                           [[1,2],[3,3]]
  Ḍ    - un-decimal (convert from base 10) (vectorises)        [12,33]
    60 - literal sixty                                         60
   ḅ   - un-base (convert from base)                           753

83,588ṁ5“¡Ð‘j+\ṡ2>E¥ÞÇḢạÇa\ - Link: list of digits        e.g. [1,2,3,3]
83,588                      - literal list of integers         [83,588]
       5                    - literal five                     5
      ṁ                     - mould like (implicit range of) [83,588,83,588,83]
        “¡Ð‘                - code-page index list             [0,15]
            j               - join                           [0,83,588,83,588,83,15]
              \             - cumulative reduce with:
             +              -   addition                     [0,83,671,754,1342,1425,1440]
                2           - literal two                      2
               ṡ            - overlapping slices of length     [[0,83],[83,671],[671,754],[754,1342],[1342,1425],[1425,1440]]
                     Ç      - last link (1) as a monad f(D)    753
                    Þ       - sort by:
                   ¥        -   last two links as a dyad:
                 >          -     greater than? (vectorises)    [0, 0] [ 0,  0] [  0,  1] [  1,   1] [   1,   1] [   1,   1]
                  E         -     equal?                          1       1         0         1           1           1
                            -                             -->  [[671,754],[0,83],[83,671],[754,1342],[1342,1425],[1425,1440]]
                      Ḣ     - head                             [671,754]
                        Ç   - last link (1) as a monad f(D)    753
                       ạ    - absolute difference (vectorises) [ 82,  1]
                          \ - cumulative reduce with:
                         a  -   AND                            [ 82,  1]
                            -   -- such that if "liked" then the [0,x] result becomes [0,0] so they are all equal

I don't think the input format (digit array) is allowed in the question, nor is the changing output for special times.

Fixed, but I don't know if it was the true intent to necessitate such transforms...

True, but I think answers should still match the current written rules of the challenge even if the original intent of the OP was different.

@Pietu1998 Originally I'd never even considered a list of digits as a useful input form. Per discussion in the main comments, I've formally revised the challenge to allow sequence-of-digits input.

C, 121 bytes
*p,l[]={0,83,671,754,1342,1425,1440};f(t){t=t%100+t/100*60;for(p=l;t>*p;++p);*p-t?printf("%d %d",t-p[-1],*p-t):puts("");}

Outputs a newline if the time is a favourite time.
Try it online!

Pyth, 48 45 42 bytes
&*FJ.u-NY+P*3,83 588 15isMcz2 60,eK._DJ_hK

Try it online. Test suite.
The code takes in a time string and outputs the previous and next times as an array, or 0 if the time is special.
Interestingly, an imperative approach is also 42 bytes:
V+_isMcz2 60+P*3,83 588 15KZIg0=-ZNIZK)_ZB

Explanation

cz2 splits input (z) into two-character pieces.
sM evaluates them as integers.
i…60 parses the resulting two-item array as base 60.
,83 588 represents the array [83, 588].
*3 triplicates that to [83, 588, 83, 588, 83, 588].
P removes the last 588.
+…15 adds 15 to the end.
.u-NY starts from the parsed number, subtracts each number in the array from it and returns the intermediate values. These are the differences from each special time.
J assigns these differences to J.
*F computes the product of the differences. This will be 0 if the time was special.
& stops the evaluation here and returns 0 if the time was special.
._DJ stable-sorts the differences by sign.
K saves that array in K.
e takes the last item in the array.
_hK takes the first item in the array and negates it.
, returns the two as an array.

And that's a fine, sneaky way of absorbing the negative sign.

Save a byte by switching from cz2 60 to c2z60 (they are equivalent for 4-element lists)

Clean, 126 bytes
import StdEnv
f=[1440,1425,1342,754,671,83,0]
?t#t=t rem 100+t/100*60
=(\(a,b)=(t-hd b,last a-t))(span(\a=t<a||isMember t f)f)

Defines the function ?, taking Int and returning (Int, Int).
When the argument is a favourite time, it crashes the calling program with hd of [].
Try it online!

Husk, 36 bytes
?↑2↑0Πṙ_1†aÖ±↔Ġ-::15t*3e588 83B60†d½

Try it online!
Thanks to Zgarb for explaining me how ternaries work in chat. Trying to golf ↑0, but I didn't get it to work otherwise for some reason (?). This is my first non-trivial Husk answer, and letting the aforementioned aside, I am pretty satisfied with it. The value used instead of YAY!!! is [] (but I hope that will change for golfing purposes).
Explanation

?↑2↑0Πṙ_1†aÖ±↔Ġ-::15t*3e588 83B60†d½ | Input as a digit list from CLA, output to STDOUT.

                                   ½ | Split the list into two halves.
                                 †d  | Turn each half into a base-10 integer.
                              B60    | Convert from base 60.
                :                    | Append the above to ↓ ([15, 83, 588, 83, 588, 83]).
                       e588 83       | Create the two element list [588, 83].
                     *3              | Repeat three times.
                    t                | Remove the first element.
                 :15                 | Prepend a 15.
              Ġ-                     | Apply cumulative subtraction from the right.
             ↔                       | Reverse.
           Ö±                        | Stable sort by the sign (-1, 0 or 1).
         †a                          | Map absolute value.
      ṙ_1                            | Rotate one right.
?    Π                               | If the product is truthy, then:
 ↑2                                  | Take the first two elements.
   ↑0                                | Return an empty list otherwise.

Kotlin, 293 bytes
{fun i(l:List<Int>)=l.all{it==l[0]}|| l.mapIndexed{a,b->b-a}.all{it==l[0]}
val a=(0..1439+0).map{val h=it/60
val m=it%60
listOf(h/10,h%10,m/10,m%10)}+listOf(listOf(0,0,0,0))
val s=a.indexOf(it)
if(i(it))0 to 0 else
s-a.subList(0,s).indexOfLast{i(it)}to a.subList(s,a.size).indexOfFirst{i(it)}}

Beautified
{
    fun i(l:List<Int>)=l.all { it ==l[0] } || l.mapIndexed { a, b -> b - a }.all { it ==l[0] }
    val a = (0..1439 + 0).map {
        val h = it/60
        val m = it%60
        listOf(h/10,h%10,m/10,m%10)
    } + listOf(listOf(0,0,0,0))
    val s = a.indexOf(it)
    if (i(it)) 0 to 0 else
        s - a.subList(0, s).indexOfLast {i(it)} to a.subList(s, a.size).indexOfFirst {i(it)}
}

Test
var t:(i:List<Int>)-> Pair<Int, Int> =
{fun i(l:List<Int>)=l.all{it==l[0]}|| l.mapIndexed{a,b->b-a}.all{it==l[0]}
val a=(0..1439+0).map{val h=it/60
val m=it%60
listOf(h/10,h%10,m/10,m%10)}+listOf(listOf(0,0,0,0))
val s=a.indexOf(it)
if(i(it))0 to 0 else
s-a.subList(0,s).indexOfLast{i(it)}to a.subList(s,a.size).indexOfFirst{i(it)}}

data class Test(val input: List<Int>, val output: Pair<Int, Int>)

val TEST = listOf(
    Test(listOf(0,0,0,0), 0 to 0),
    Test(listOf(0,0,2,0), 20 to 63),
    Test(listOf(0,1,0,5), 65 to 18),
    Test(listOf(0,1,2,2), 82 to 1),
    Test(listOf(0,1,2,3), 0 to 0),
    Test(listOf(0,1,2,4), 1 to 587),
    Test(listOf(0,8,5,2), 449 to 139),
    Test(listOf(1,1,1,1), 0 to 0),
    Test(listOf(1,1,1,3), 2 to 81),
    Test(listOf(1,2,0,0), 49 to 34),
    Test(listOf(1,2,3,4), 0 to 0),
    Test(listOf(1,3,5,7), 83 to 505),
    Test(listOf(1,7,5,9), 325 to 263),
    Test(listOf(1,8,0,0), 326 to 262),
    Test(listOf(1,8,0,1), 327 to 261),
    Test(listOf(2,2,2,2), 0 to 0),
    Test(listOf(2,2,4,4), 22 to 61),
    Test(listOf(2,3,4,5), 0 to 0),
    Test(listOf(2,3,5,1), 6 to 9)
)

fun main(args: Array<String>) {
    for (t in TEST) {
        val v = t(t.input)
        if (v != t.output) {
            throw AssertionError("$t $v")
        }
    }
}

TIO
TryItOnline


text:
How many shuffles
A riffle shuffle is a type of shuffle where the deck is split into two partitions and the partitions are then spliced back together to create a new shuffled deck.
The cards are spliced together in such a way that cards maintain their relative order within the partition they are a member of.  For example, if card A is before card B in the deck and cards A and B are in the same partition, card A must be before card B in the final result, even if the number of cards between them has increased.  If A and B are in different partitions, they can be in any order, regardless of their starting order, in the final result.
Each riffle shuffle can then be viewed as a permutation of the original deck of cards.  For example the permutation
1,2,3 -> 1,3,2

is a riffle shuffle.  If you split the deck like so
1, 2 | 3

we see that every card in 1,3,2 has the same relative order to every other card in it's partition.  2 is still after 1.
On the other hand the following permutation is not a riffle shuffle.
1,2,3 -> 3,2,1

We can see this because for all the two (non-trivial) partitions
1, 2 | 3
1 | 2, 3

there is a pair of cards that do not maintain their relative orderings.  In the first partition 1 and 2 change their ordering, while in the second partition 2 and 3 change their ordering.
However we do see that 3, 2, 1 can be made by composing two riffle shuffles,
1, 3, 2 + 2, 3, 1 = 3, 2, 1

In fact a pretty simple fact to be proven is that any permutation can be made my combining some number of riffle shuffle permutations.
Task
Your task is to make a program or function that takes a permutation (of size N) as input and outputs the smallest number of riffle shuffle permutations (of size N) that can be combined to form the input permutation.  You do not need to output the riffle shuffles themselves just how many there are.
This is code-golf so answers will be scored in bytes with fewer bytes being better.
You may output either 1 or 0 for an identity permutation.
Test Cases
1,3,2 -> 1
3,2,1 -> 2
3,1,2,4 -> 1
2,3,4,1 -> 1
4,3,2,1 -> 2

So, will we be seeing RiffleSort algorithms soon?

Shouldn't 4,3,2,1 be 2?
First we split in the middle and gain 3,1,4,2 and then we split in the middle again and use the same permutation

@HalvardHummel That's correct.  I'll have to find the issue with my reference implementation.

Python 3, 255 bytes
Checks all possible riffles up to the length of the list (maximum number required), so it is very slow for larger input. Could also probably be golfed quite a bit.
lambda x:f(range(1,len(x)+1),x)
f=lambda x,y,i=0:x==y and i or i<len(x)and min(f(q,y,i+1)for a in range(1,len(x))for q in g(x[:a],x[a:]))or i
g=lambda x,y:(x or y)and[[v]+q for v in x[:1]for q in g(x[1:],y)]+[[v]+q for v in y[:1]for q in g(x,y[1:])]or[[]]

Try it online!

Clean, 206 ... 185 bytes
import StdEnv
f=flatten
$a b#[c:d]=b
|a>[]#[u:v]=a
=[a++b,b++a:f[[[u,c:e],[c,u:e]]\\e<- $v d]]=[b]
@l#i=length l
=hd[n\\n<-[0..],e<-iter n(f o map(uncurry$o splitAt(i/2)))[[1..i]]|l==e]

Try it online!
Generates every possible outcome of shuffling n times, and checks if the list is a member.
While this is a horribly inefficient way to solve the problem, this code is particularly slow due to its use of list comprehensions instead of composition, which heavily limits any elementary graph reduction, and results in a spectacular showcase of Clean's garbage collector.
Ungolfed:
import StdEnv
shuffle [] l
    = [l]
shuffle [a: b] [c: d]
    = [[a: b]++[c: d], [c: d]++[a: b]: flatten [
        [[a, c: e], [c, a: e]]
        \\ e <- shuffle b d
        ]]
numReq l
    = until cond ((+)1) 0
where
    cond n
        = let
            mapper
                = map (uncurry shuffle o splitAt (length l/2))
            options
                = iter n (removeDup o flatten o mapper) [[1..length l]]
        in isMember l options

Try it online!