text:
Can I sweep the mines?
Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Instead, you click on nearby tiles to reveal the number of adjacent mines. One downside about the game is that it is possible to end up in a scenario where there are multiple valid answers and you may only guess. For example, take the following board:
1110
2*31
3*??
2*4?
112?

In this format, a number represents the number of adjacent mines, an * represents a known mine, and a "?" represents a potential mine. The unfortunate thing about this particular puzzle is that there are four distinct and valid potential solutions:
1110    1110    1110    1110
2*31    2*31    2*31    2*31
3*4*    3*5*    3**2    3**1
2*42    2*4*    2*4*    2*42
112*    1121    1121    112*

This means the board is unsolvable. Here is an example of a solvable board:
1121
1??*
12?*
0122

This board is solvable because there is only one possible valid solution:
1121
1*4*
12**
0122

Your task is to write either a program or function that takes a valid minesweeper board and determines if it is solvable or not. By "valid minesweeper board", I mean that the input will always be rectangular, have at least one solution, and not contain any invalid characters.
Your input may be an array of characters, an array of strings, a string containing newlines, etc. The output must be a truthy value if it is solvable and a falsy value if it is not. I am not extremely worried about performance, but your solution must theoretically work for any size input.
As usual, standard loopholes apply and the shortest solution in bytes wins!
Examples:
The following examples are all solvable:
1121
1??*
12?*
0122

1110
1???
1110
0000

1110
3???
??20
*310

****
****
****
****

0000
0000
0000
0000

1100
*100
2321
??*2
13*2
1221
1*10
1110

1121
2*??
2*31
2220
1*10

The following examples are all unsolvable:
1110
2*31
3*??
2*4?
112?

01??11*211
12??2323*1
1*33*2*210
12?2122321
13?3101**1
1***101221

1***
3*52
2*31
12??
02??
01??

00000111
000012*1
00001*21
22101110
**100111
?31123*1
?311**31
**113*20

Can we assume the board is rectangular with at least one cell?  Also, can we assume that the input will always admit at least one solution?  (For example, 2? has no solutions, which means it cannot come from an actual game of Minesweeper.  Hence it is not considered a "Minesweeper board"...yes?)

It's worth nothing that in MineSweeper you have an additional information that here is missing: the number of mines.

@mathmandan Yes, the input will always be rectangular with at least one cell and at least one valid solution.

GNU Prolog, 493 bytes
z(_,[_,_]).
z(F,[A,B,C|T]):-call(F,A,B,C),z(F,[B,C|T]).
i([],[],[],[]).
i([H|A],[I|B],[J|C],[H-I-J|T]):-i(A,B,C,T).
c(A/_-B/_-C/_,D/_-_/T-E/_,F/_-G/_-H/_):-T#=A+B+C+D+E+F+G+H.
r(A,B,C):-i(A,B,C,L),z(c,L).
q(63,V):-var(V).
q(42,1/_).
q(X,0/Y):-Y#=X-48.
l([],[0/_]).
l([H|T],[E|U]):-q(H,E),l(T,U).
p([],[[0/_,0/_]],0).
p([],[[0/_|T]],N):-M#=N-1,p([],[T],M).
p([H|T],[[0/_|E]|U],N):-p(T,U,N),l(H,E).
m([H|A],B):-length(H,N),p([],[R],N),p([H|A],M,N),z(r,[R|M]),p(B,M,N).
s(A):-setof(B,m(A,B),[_]).

An extra predicate that may be useful for testing (not part of the submission):
d([]).
d([H|T]):-format("~s~n",[H]),d(T).

Prolog's definitely the right language for solving this task from the practical point of view. This program pretty much just states the rules of Minesweeper and lets GNU Prolog's constraint solver solve the problem from there.
z and i are utility functions (z does a sort of fold-like operation but on sets of three adjacent elements rather than 2; i transposes 3 lists of n elements into a list of n 3-tuples). We internally store a cell as x/y, where x is 1 for a mine and 0 for a nonmine, and y is the number of adjacent mines; c expresses this constraint on the board. r applies c to every row of the board; and so z(r,M) checks to see if M is a valid board.
Unfortunately, the input format required to make this work directly is unreasonable, so I also had to include a parser (which probably accounts for more code than the actual rules engine, and most of the time spent debugging; the Minesweeper rules engine pretty much worked first time, but the parser was full of thinkos). q converts a single cell between a character code and our x/y format. l converts one line of the board (leaving one cell that's known to be not a mine, but with an unknown number of neighbouring mines, at each edge of the line as a border); p converts the entire board (including the bottom border, but excluding the top one). All of these functions can be run either forwards or backwards, thus can both parse and pretty-print the board. (There's some annoying wiggling around with the third argument to p, which specifies the width of the board; this is because Prolog doesn't have a matrix type, and if I don't constrain the board to be rectangular, the program will go into an infinite loop trying progressively wider borders around the board.)
m is the main Minesweeper solving function. It parses the input string, generating a board with a correct border (via using the recursive case of p to convert most of the board, then calling the base case directly to generate the top border, which has the same structure as the bottom border). Then it calls z(r,[R|M]) to run the Minesweeper rules engine, which (with this call pattern) becomes a generator generating only valid boards. At this point, the board is still expressed as a set of constraints, which is potentially awkward for us; we could perhaps have a single set of constraints which could represent more than one board. Additionally, we haven't yet specified anywhere that each square contains at most one mine. As such, we need to explicitly "collapse the waveform" of each square, requiring it to be specifically either a (single) mine or a nonmine, and the easiest way to do this is to run it through the parser backwards (the var(V) on the q(63,V) case is designed to prevent the ? case running backwards, and thus deparsing the board forces it to be fully known). Finally, we return the parsed board from m; m thus becomes a generator which takes a partially unknown board and generates all the known boards consistent with it.
That's really enough to solve Minesweeper, but the question explicitly asks to check whether there's exactly one solution, rather than to find all solutions. As such, I wrote an extra predicate s which simply converts the generator m into a set, and then asserts that the set has exactly one element. This means that s will return truthy (yes) if there is indeed exactly one solution, or falsey (no) if there is more than one or less than one.
d is not part of the solution, and not included in the bytecount; it's a function for printing a list of strings as though it were a matrix, which makes it possible to inspect the boards generated by m (by default, GNU Prolog prints strings as a list of ASCII codes, because it treats the two synonymously; this format is fairly hard to read). It's useful during testing, or if you want to use m as a practical Minesweeper solver (because it uses a constraint solver, it's highly efficient).

Haskell, 193 169 168 bytes
c '?'="*!"
c x=[x]
g x|t<-x>>" ",w<-length(words x!!0)+1=1==sum[1|p<-mapM c$t++x++t,and[sum[1|m<-[-1..1],n<-[j-w,j,j+w],p!!(m+n)=='*']==read[d]|(j,d)<-zip[0..]p,d>'/']]

Usage example: g "1121 1??* 12?* 0122" -> True.
How it works: make list of all possible boards with the ? replaced by either * or ! (! means ignore later). This is done via mapM c, but before we prepend and append a bunch of spaces to the input string so that our indexing won't be out of range. For each such board check if it's a valid board by looping over all elements (index j) and if it's a number (d>'/') also over its neighbors (index n, m), count the * and compare to the number. Finally check the length of the list of valid boards.

Perl, 215 bytes
213 bytes of code + -p0 flags (2 bytes).
/.*/;$c="@+";$_=A x$c."
$_".A x$c;s/^|$/A/mg;sub t{my($_)=@_;if(/\?/){for$i(0..8,"*"){t(s/\?/$i/r)}}else{$r=1;for$i(/\d/g){$r&=!/(...)[^V]{$c}(.$i.)[^V]{$c}(...)(??{"$1$2$3"=~y%*%%!=$i?"":R})/}$e+=$r}}t$_;$_=$e==1

The idea of the code is to test every possibility and see if there is one and only one that leads to a fully filled board that is valid.
More readable, the code looks like:

/.*/;$c="@+";           # count the size of a line.
$_=A x$c."\n$_".A x$c;  # add a line of "A" at the begining and another at the end.
s/^|$/A/mg;        # add a "A" at the start and the end of each line.

# The funcion that actually solves the problem
sub t {
    my $_= pop; # Get the parameter, store it in $_ (default argument to regex).
    if (/\?/) {  # if there is another unknown char.
        for $i(0..8,"*") { # try every possibility
            t(s/\?/$i/r)  # reccursive call where the first unknown char has been replaced
        }
    } else { # no more unknown character, so here we check if the board is valid
        $r=1;  # if r == 1 at the end, then the board is valid, otherwise it's not
        for $i (/\d/g) { # for each number present of the board
            # the following regex checks if there is a number is surrounded by either
            # too much or too little mines.
            # (how it works: magic!)
         $r&=!/(...)[^V]{$c}(.$i.)[^V]{$c}(...)(??{"$1$2$3"=~y%*%%!=$i?"":R})/
        }
        $e+=$r # Increment the number of valid boards.
    }
}
t$_; # Call the previous function
$_=$e==1 # Checks if there is only one valid board ($_ is implicitly printed thanks to -p flag).
About the regex in the middle :
/(...)[^V]{$c}(.$i.)[^V]{$c}(...)(??{"$1$2$3"=~y%*%%!=$i?"":R})/

Note that [^V] just stands for "any character, including \n".
So the idea is: 3 char on a line, then 3 on the next (with $i in the middle), then 3 on the next. those 3 groups of 3 numbers are aligned, thanks to [^V]{$c} and the number we're interested into is in the middle.
And then, "$1$2$3"=~y%*%% counts the number of * (bombs) among those 9 characters: if it's different from $i, we add an empty string to match ("" => instant matching, the regex returns true), otherwise, we force a fail by trying to match R (which can't be in the string).
If the regex matches, then the board isn't valid, so we set $r to 0 with $r&=!/.../.
And that's why we add some A everywhere around each line: so we don't have to worry about edges cases of numbers that are near the edges of the board: they'll have A as neighbors, which aren't mines (of course, roughly any char could have work, I chose A).
You can run the program from the command line like that :
perl -p0E '/.*/;$c="@+";$_=A x$c."\n$_".A x$c;s/^|$/A/mg;sub t{my($_)=@_;if(/\?/){for$i(0..8,"*"){t(s/\?/$i/r)}}else{$r=1;for$i(/\d/g){$r&=!/(...)[^V]{$c}(.$i.)[^V]{$c}(...)(??{"$1$2$3"=~y%*%%!=$i?"":R})/}$e+=$r}}t$_;$_=$e==1' <<< "1121
1??*
12?*
0122"

The complexity couldn't be worst: it's O(m*9^n) where n is the number of ? on the board, and m is the number of cells on the board (without counting the complexity of the regex in the middle, which is probably pretty bad). On my machine, it works pretty fast for up to 4 ?, and starts to be slower 5, takes a few minutes for 6, and I didn't try for larger numbers.

Mathematica, 214 192 190 180 176 174 168 165 bytes
0&/@Cases[b="*";If[!FreeQ[#,q="?"],(x#0@MapAt[x&,#,#&@@#~Position~q])/@{b,0},BlockMap[If[#[[2,2]]==b,b,Count[#,b,2]]&,#~ArrayPad~1,{3,3},1]]&@#,#/.q->_,All]=={0}&

Contains U+F4A1 (Private use). This unnamed function finds all possible combinations for "?" (i.e. replacing all "?"s with "*" or 0) and checks whether there is only one valid solution.
Explanation
b="*";

Set b to "*".
!FreeQ[#,q="?"]

Set q to the string "?". Check whether there is "?" in the input.
If[ ..., (x#0 ... ,0}, BlockMap[ ... ]]

If True...
(x#0@MapAt[x&,#,#&@@#~Position~q])/@{b,0}

Replace the first occurrence of q(="?") with b(="*") or 0 (i.e. two outputs), and apply the entire function again.

If False...
#~ArrayPad~1

Pad the input with one layer of 0.
BlockMap[If[#[[2,2]]==b,b,Count[#,b,2]]&, ... ,{3,3},1]

Partition the input into 3 x 3 matrices with offset 1. For each partition, apply a function such that if the middle value is b(="*"), the output is the b(="*"), and if the middle value is not b(="*"), the output is the number of b(="*") in the input. This step re-evaluates all the number cells.

Cases[ ... ,#/.q->_,All]

From all of the results, find the ones that match the input
0&/@ ... =={0}

Check whether the input is length 1.

JavaScript (ES6), 221 229
g=>(a=>{for(s=i=1;~i;g.replace(x,c=>a[j++],z=j=0).replace(/\d/g,(c,p,g)=>([o=g.search`
`,-o,++o,-o,++o,-o,1,-1].map(d=>c-=g[p+d]=='*'),z|=c)),s-=!z)for(i=a.length;a[--i]='*?'[+(c=a[i]<'?')],c;);})(g.match(x=/\?/g)||[])|!s

If all input is expected to be valid - that is with at least 1 solution - then I can save a byte changing s==1 with s<2
Less golfed
g=>{
  a = g.match(/\?/g) || []; // array of '?' in a
  s = 1; // counter of solutions
  for(i=0; ~i;) // loop to find all configurations of ? and *
  {
    // get next configuration
    for(i = a.length; a[--i] = '*?'[+( c = a[i] < '?')], c; );
    z = 0; // init at 0, must stay 0 if all cells count is ok
    g
    .replace(/\?/g,c=>a[j++],j=0) // put ? and * at right places
    .replace(/\d/g,(c,p,g)=>(
       // look for mines in all 8 directions
       // for each mine decrease c
       // if c ends at 0, then the count is ok
       [o=g.search`\n`,-o,++o,-o,++o,-o,1,-1].map(d=>c-=g[p+d]=='*'),
       z|=c // z stays at 0 if count is ok
    )) // check neighbour count
    s-=!z // if count ok for all cells, decrement number of solutions
  }
  return s==0 // true if exactly one solution found
}

Test

F=
g=>(a=>{for(s=i=1;~i;g.replace(x,c=>a[j++],z=j=0).replace(/\d/g,(c,p,g)=>([o=g.search`
`,-o,++o,-o,++o,-o,1,-1].map(d=>c-=g[p+d]=='*'),z|=c)),s-=!z)for(i=a.length;a[--i]='*?'[+(c=a[i]<'?')],c;);})(g.match(x=/\?/g)||[])|!s

out=x=>O.textContent+=x+'\n'

Solvable=['1121\n1??*\n12?*\n0122'
,'1110\n1???\n1110\n0000'
,'1110\n3???\n??20\n*310'
,'****\n****\n****\n****'
,'0000\n0000\n0000\n0000'
,'1100\n*100\n2321\n??*2\n13*2\n1221\n1*10\n1110'
,'1121\n2*??\n2*31\n2220\n1*10']
Unsolvable=['1110\n2*31\n3*??\n2*4?\n112?'
,'01??11*211\n12??2323*1\n1*33*2*210\n12?2122321\n13?3101**1\n1***101221'
,'1***\n3*52\n2*31\n12??\n02??\n01??'
,'00000111\n000012*1\n00001*21\n22101110\n**100111\n?31123*1\n?311**31\n**113*20']
out('Solvable')
Solvable.forEach(t=>out(t+'\n'+F(t)+'\n'))
out('Unsolvable')
Unsolvable.forEach(t=>out(t+'\n'+F(t)+'\n'))

Op has said you can golf that byte.

@DestructibleWatermelon thanks, I revised all and save some more bytes indeed

JavaScript (Node.js), 167 bytes
s=>g=(r=c='',[p,...q]=s,w)=>w?0:p?(g(r+0,q,p=='*')+g(r+1,q,1/p),c==1):c-=-![...s].some((p,i)=>p>' '&&[-1,1,-q,-1-q,-2-q,q,q+1,q+2].map(j=>p-=~~r[i+j])|p,q=s.search`
`)

Try it online!
Though op say "input will always be rectangular, have at least one solution", false sample 3 doesn't match, so I still require 1 solution, not <2 solution
s=>(        // p.s. Here "block" can also mean \n
  c=0,          // possible mine count
  g=(           // recursive
    r='',       // mine states
    [p,...q]=s, // known info to check possible state for a block
    w           // invert condition, stop if true
  )=>
    w?0:
      p?(       // for each block
        g(r+0,q,p=='*')+   // possibly not bomb if doesn't say so
        g(r+1,q,1/p),      // number/newline can't be bomb
        c==1               // only one bomb
      ):
        c-=-![...s].some(  // no block doesn't satisfy
          (p,i)=>
            p>' '&& // \n don't mean number
                    // other symbols turn into NaN when counting
            [-1,1,-q,-1-q,-2-q,q,q+1,q+2].map(j=>p-=~~r[i+j])
                    // subtract each neighbor, OOB = 0
            |p,     // difference between intended and actual
            q=s.search('\n') // how many blocks in a line
        )
)

seems the "don't match" is a typo, fixing it makes it 4 solutions

APL (Dyalog Unicode), 78 bytesSBCS
{1=+/∧/∘,¨{⍵[1;1]∊' *',⍕+/'*'=,⍵}⌺3 3¨(⊂⍵){' *'[⍵]@c⊢⍺}¨,⍳2⊣¨c←⍸'?'=⍵}(⊢↑⍨2⌈⍴)

Try it online!
A function that takes a 2-dimensional character matrix as its right argument, and gives 1 if the board is solvable (has unique solution) and 0 otherwise.
How it works
This is a straightforward implementation of the challenge description. Dimension extension is needed because the stencil operator isn't happy with too small arrays.
Ungolfed version:
sol←{
  coords←⍸'?'=⍵
  masks←,⍳2⊣¨coords
  replace←{' *'[⍺]@coords⊢⍵}
  check←∧/∘,{⍵[1;1]∊' *',⍕+/'*'=,⍵}⌺3 3
  1=+/masks(check replace)¨⊂⍵
}(⊢↑⍨2⌈⍴)

With comments:
sol←{  ⍝ ⍵←minesweeper board as a character matrix
  ⍝ 2D coordinates of '?'
  coords←⍸'?'=⍵

  ⍝ possible combinations of blank as 0 and mine as 1
  masks←,⍳2⊣¨coords
          2⊣¨coords  ⍝ (≢coords) copies of 2
        ,⍳           ⍝ cartesian product of 0..n-1 for each n in the above

  ⍝ create a board with selected mines
  replace←{' *'[⍺]@coords⊢⍵}
          {                }  ⍝ a function
                         ⊢⍵   ⍝ take the array ⍵
                  @coords     ⍝ replace the items at given coords
           ' *'[⍺]            ⍝ ... into blanks and mines as specified
                              ⍝ by boolean array ⍺

  ⍝ test if the complete board is valid
  check←∧/∘,{⍵[1;1]∊' *',⍕+/'*'=,⍵}⌺3 3
            {                     }⌺3 3  ⍝ for each 3x3 subarray (including ones centered at the edges)
                         ⍕+/'*'=,⍵       ⍝ s←count the mines and cast to string
             ⍵[1;1]∊' *',                ⍝ check if the center is one of blank, mine, or s
        ∧/∘,                             ⍝ reduce by AND for all subarrays

  ⍝ for all combinations, check if the board has unique solution
  1=+/masks(check replace)¨⊂⍵
      masks(      replace)¨⊂⍵  ⍝ generate all possible boards
            check              ⍝ check each board if it is a valid solution
  1=+/                         ⍝ check that there's exactly one valid solution in total

}(⊢↑⍨2⌈⍴)  ⍝ extend each dimension to have at least length 2 before calling main function
       ⍴   ⍝ dimensions
     2⌈    ⍝ max(n,2) for each dimension
  ⊢↑⍨      ⍝ extend the input to have ^ dimension; fill extended cells with blank


text:
Help! I have more homework!
My teacher was more than unhappy with my Martian Homework. I followed all the rules, but she says that what I output was gibberish... when she first looked at it, she was highly suspicious. "All languages should follow Zipf's law blah blah blah"... I didn't even know what Zipf's law was!
It turns out Zipf's law states that if you plot the logarithm of the frequency of each word on the y axis, and the logarithm of the "place" of each word on the x axis (most common = 1, second most common = 2, third most commmon = 3, and so on), then the plot will show a line with a slope of about -1, give or take about 10%.
For example, here's a plot for Moby Dick:

The x axis is the nth most common word, the y-axis is the number of occurences of the nth most common word. The slope of the line is about -1.07.
Now we're covering Venutian. Thankfully, Venutians use the latin alphabet. The rules are as follows:

Each word must contain at least one vowel (a, e, i, o, u)
In each word there can be up to three vowels in a row, but no more than two consonants in a row (a consonant is any letter that's not a vowel).
No words longer than 15 letters
Optional: group words into sentences 3-30 words long, delimited by periods

Because the teacher feels that I cheated on my Martian homework, I've been assigned to write an essay at least 30,000 words long (in Venutian). She's going to check my work using Zipf's law, so when a line is fitted (as described above) the slope has to be at most -0.9 but no less than -1.1, and she wants a vocabulary of at least 200 words. The same word should not be repeated more than 5 times in a row.
This is CodeGolf, so shortest code in bytes wins. Please paste the output to Pastebin or another tool where I can download it as a text file.

Yes and if you want to you could just do a 32767 word sentence. The restriction is that the frequencies of words in the sentence must follow zipf's law

The traditional adjective for "from Venus" is Veneral, but for some reason it's declined in popularity. Venusian is commonly used in sci-fi.

I'm conjecturing that building a list of words following zipf distribution and shuffling it would have a high probability of producing a sequence with pairs of consecutive word also following zipf distribution. Moreover, with enough different words in the list the probability of having the same word repeated more than 5 times in a row would be really small.
In case I tried this approach and managed to produce a valid essay, would it be accepted?

Your conjecture is reasonable, although the slope would be -0.35

It would still look like a straight line; it's just the slope would be too great

Ok, thank you, I'll think about it some more then :)

I made a mistake. When I originally calculated the pair frequency for Moby Dick, I had eliminated all pairs that only occurred once because there were so many of them, it was heavily skewing the data. Although when I calculated the pair frequency for random shuffling, the slope was -0.35 because I included pairs with a frequency of 1 (that only occurred once). Random shuffling actually is a valid way to meet the criteria, and I'll alter the question to reflect that.

Wow... that's so much easier to target.

I'd like a clarification on this: Random shuffling actually is a valid way to meet the criteria ...by this do you mean that if one uses random shuffling, then their program is compliant despite the possibility that on some runs, their output generates 6 or more consecutive words?

how random does this have to be? can it just be one giant print statement? if not, what parts have to be randomized?

It... could be just one giant print statement? Although shortest code in bytes wins, so I wouldn't advise one giant print statement

@JorgePerez Please respond to my last comment; this may be more important than you think.  I think my posted answer is in line to win; and Osable's answer should be disqualified.  However, I also think this is horribly unfair to Osable, and could be remedied with a clarification.  (Note that mods have deleted even accepted non-compliant answers before; and Osable can easily make a deterministic answer)

If the program uses random shuffling, then the program is compliant, even if on some runs their output generates more than 6 consecutive words.

Mathematica, 102 bytes
""<>RandomChoice[1/Range@215->Rest@Flatten@Outer[StringJoin,a={"v","a","e","i","o","u"},a,a,{" "}],8!]

Unnamed function taking no input and returning a string consisting of 40,320 three-letter Venusian words with trailing spaces.
Outer[StringJoin,a={"v","a","e","i","o","u"},a,a,{" "}] produces the 216 three-letter words possible using only the letters "vaeiou", each with its own trailing space. The first of these words, "vvv", is not valid Venusian, but Rest throws it away.
Then RandomChoice[1/Range@215->...,8!] makes 8! = 40,320 random choices from the resulting 215-word list, with frequency weights determined by the reciprocals of the first 215 integers (1/Range@215). Finally, <>""... concatenates the strings in the resulting list.
The output is far from deterministic; one run yielded this Venusian essay.
Mathematica, 129 bytes
#2&@@@Sort[Join@@Table[{i,Rest@Flatten@Outer[StringJoin,a={"v","a","e","i","o","u"},a,a,{" "}]~Part~j},{j,215},{i,0,1,j/7!}]]<>""

This one is deterministic. The base set of 215 words is the same, but now each word is repeated an exact number of times (word #j is repeated roughly 7!/j times) to force zipf's law to hold. Then the words are interleaved equally to avoid repetitions. (Imagine each word is laid out on a ruler, with all the copies of that word equally spaced; when all the words are read in order, no particular word will repeat much, perhaps not at all.) The result is a 30,117-word Venusian essay.

Doesn't making 8! pseudo-random choice mean you could wind up with 6 consecutive repetitions of the same word?

Yes, in theory.

@GregMartin Actually... the essay you linked to is non-compliant; vva appears six times consecutively.  I think there's possibly a bigger issue though... shouldn't challenge answers work every time?  (And if not, how do you draw the line of how likely they should be to work?)

This is a fair critique, and I'm interested to see how it plays out.

05AB1E, 34 33 32 bytes
525DL/9*vNy<FD}})žMDâžNâJè3ô.rðý

525DL                            Yield [1, ..., 525]
     /                           Yield [525/1, ..., 525/525]
      9*                         Yield [4725/1, ..., 4725/525]. It's the number of occurences of each word. The sum of this array is greater than 30000
        v                        For each value (y = value, N = iteration counter starting from 0)
         N                       Push iteration counter
          y<FD}                  Push an array of "int(value)" times the iteration counter
               }                 End for
                )                Wrap everything in an array. At this point the array countains the sorted indices of all words that matches the frequency specs
                 žM              Push "aeiou"
                   Dâ            Cartesian product with itself (["aa", "ae", ...])
                     žN          Push the consonants
                       âJ        Cartesian product and join the values to make valid venutian words
                         è       Compute a big string with all words that correspond to the formerly computed indices
                          3ô     Since all words are concatenated, separate them into blocks of 3 letters
                            .r   Shuffle
                              ðý Join with whitespaces and implicitly display

Try it online!
I think it is still pretty golfable!
For instance the numeric constants and vNy<FD} might be golfable.
Output example
How does it work?
It generates all combinations of words following the rule "vowel+vowel+consonant", which makes 525 unique valid words (more than 200).
It then associates to each of them a frequency that satisfies the law f(x) = 4725/x where x is the rank of the current word, starting at 1 and ending at 525.
Then the frequencies are normalized and multiplied so there are at least 30000 words. This code always yields 32074 words to make the involved constants golfable (please see the code explanation).
So each word is repeated the amount of times corresponding to the frequency of the same word.
Finally the words are shuffled.
However it does not guarantee that a word is never repeated five times in a row.
Hence the programs generates more than the needed 200 unique words in order to decrease the probability of having a word repeated five times in a row.
Please note that this code always generates the same word sequence.
The only thing that differs between two runs is the result of the shuffling operation.
How to evaluate frequency?
I made a simple Python3 code that takes the text in the file named "output" (from the algorithm point of view, it makes sense!) and outputs to "stats.csv".
from collections import Counter
from math import log10

with open("output", "r") as f:
    with open("stats.csv", "w") as stats:
        words = f.read().split()
        freqs = Counter(words)
        freqs = sorted([(i,freqs[i]) for i in freqs],key=lambda x:-x[1])

        print(len(words), "words")
        stats.write("logX;logF\n")
        for i, (key, f) in enumerate(freqs):
            stats.write(str(log10(i+1))+";"+str(log10(f))+"\n")

Which always yields the following distribution for my code:

So the slope is -1.0138.
This value is now less close to -1 than the slope of the previous code, but it still satisfies the slope constraints.

Thank you for the script to evaluate frequency, note that you have an extra ` at the end.
Also, why do you use semicolons as separators? csv usually stands for comma separated values ;)

Yes you're right haha! I got confused with markdown for a second. I used inline code first, then realized it was more appropriate to use a code block but I forgot to remove the extra `. I use semicolons as csv separators because I'm French and some softwares or companies are used to putting decimal values with comas instead of dots as we do with handwritten decimal values. Although I always use the dot to separate the integer part from the fractional part, I use the semicolon without further thinking. But hey, ssv is great as well ;)

Bash/Core Utils, 122 110 bytes
for w in {b,c,d}{a,e,i}{f,g,h}{o,u,a}{j,k,l};{ let ++x;yes $w|head -$[5575/x];}|shuf --random-source=<(yes ae)

Unrolled:
for w in {b,c,d}{a,e,i}{f,g,h}{o,u,a}{j,k,l};{
    let ++x
    yes $w|head -$[5575/x]
}|shuf --random-source=<(yes ae)

The for w loop generates 243 distinct words.  let ++x; increments initially unset x (per arithmetic expression rules during that first execution, x is treated as 0 and thus its increment sets it to 1).  The next line thus generates succeeding words at frequency 5575/x to approximate zipf frequency.
The next step is to permute this deterministically to fit the repetition requirement; despite --random-source being a terribly large flag name, using it with shuf beats the char count of hand rolling a mul-mod selector.  yes ae is actually the shortest fixed "random" device I found to comply.
This generates this 33729 word essay [pastebin].
Bash/Core Utils, 96 84 bytes (non-competing)
For a non-deterministic approach, just chop off shuf flags:
for w in {b,c,d}{a,e,i}{f,g,h}{o,u,a}{j,k,l};{ let ++x;yes $w|head -$[5575/x];}|shuf

Analysis
The zipf slope is tuned to be straight.  Using Excel to plot on logarithmic scales:

The teacher should notice a zipf slope of =-1.000764.

source: Stack Exchange

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

sort: votes


text:
Write an program that terminates after 60 seconds - Cops' Thread
This is a cops and robbers challenge - Robber's Thread
Write a program that terminates after exactly 60 seconds (or as close to it as possible). For example:
#include <unistd.h>
int main(int argc, char **argv){
    sleep(60);
    return 0;
}

However, your goal is to write this program such that terminating after exactly 1 minute is essentially inherent to the program's execution - it should be difficult to change the program to predictably run for a different amount of time without overhauling the algorithm. The robbers will attempt to change your program such that it terminates after 31 seconds instead of 60, and they will have to do so with a solution whose Levenshtein edit distance is up to half of the length of your submission.
If you do not wish to take advantage of system interrupts or the system clock, you can use either of the following:

The speed of printing to stdout is controlled by the baud rate of the terminal you are printing to. If you wish, you can control the speed of your program by printing to stdout with a set baud rate. However, you must also cite an actual piece of hardware or terminal program that has that baud rate as default (e.g. a serial printer with a default print speed of 300 baud).
If you are working in a language where all operations take some constant amount of time (such as assembly language), you can control the speed of your program by specifying the processor's clock rate. However, this too must be accompanied with a citation of an actual processor chip that runs at that speed (e.g. the 1 MHz 6502 put inside Apple //e and NES boards).

This is cops and robbers, so prepare to rigorously defend your algorithm! If your solution has been cracked, put [Cracked](link to cracker) in your header. If your solution remains uncracked after exactly 2 weeks, it is safe from future cracking attempts - put Safe in your header and explain how your algorithm works.
The winner of this challenge is the Safe solution with the most upvotes.

I believe this fits into the category of popcon "do [task] in a creative way" which is considered too broad by our community, so this might be closed. Seems like a cool challenge, though...

@Challenger5 maybe it could be turned into a police v robbers challenge, where the robbers are supposed to edit the program to terminate in 30 seconds for example. That is, if this would indeed be considered too broad.

Yeah, ditto to Jarko's idea, I feel like this might be a good challenge for cops-and-robbers - it doesn't need much changing, TBH.

nigh impossible to change the program to predictably run for a different amount of time without completely rewriting it isn't well-defined; the Jelly program 281ÆCœS does exactly that, and making it wait for 30 seconds requires changing at least three characters.

I'm voting to close this question; questions without an objective validity criterion are off-topic, as they make it impossible to indisputably decide whether a submission is valid or not.

@JarkoDubbeldam That sounds interesting... maybe the robbers had to rewrite the cop's program to terminate in 30 secs but with the Levenshtein distance from the original strictly less than some value.

@JarkoDubbeldam That's a good idea. Glad to know that that category exists for just this sort of stuff.

@Dennis That is a good point. By "completely rewriting" I mean something around the lines of changing the algorithm itself substantially.

As before, without overhauling the algorithm isn't well-defined. In case you're not aware, we have a sandbox where you can get  feedback from the community before posting your challenge on the main site.

@Dennis I was aware of the sandbox, though I was not aware of the "sort by active" capability on the answer list.

What if you can't reduce it to 31 seconds exactly? What happens then? Also, 2 weeks is a bit long - usually, a submission that's uncracked for 1 week is safe.

@Qwerp-Derp Not 31 seconds simply doesn't count. I'm saying 31 instead of 30 because it's much harder to go down 31/60 than it is to divide by 2. It doesn't have to be 31.0000..., though - no computer can be that accurate.

What would be accurate enough for 31 seconds? Is 31.01 seconds okay? Where's the "window" for an accurate time?

Am I allowed to create an expression (math expression maybe) that takes 60 seconds to evaluate on certain specs that I'd provide with the answer?

edit distance of half the length is too high, I think. It should be max(3, log_2(#chars)+2) or something like that.

@justhalf That's a good point. I was, however, thinking of a possible program that has System.out.println(); over and over or something like that, with a fixed output rate. You would have to delete at least half of the characters to bring the termination time down to 31 seconds.

@TheHansinator: You can limit the program length also (but it might hurt for some languages like Unary, haha)

@justhalf - Actually, I just realized that my example (and probably the others like it) could be defeated with a simple return. I'll adjust the puzzle requirements soon...

Perl 52 bytes (26 edits allowed) (Safe, technically speaking)
sub a{[gmtime+time]->[0]^$x}$x=a;0 until a;0 while a

Unfortunately, I don't think it's possible to write an uncrackable Perl program (it should become obvious why if and when this is cracked; being able to edit half the program is just too much), but this algorithm should be very hard to change to wait for any length of time other than 1 minute.
Marking this as safe, as nobody's officially submitted a crack for 14 days (although someone unofficially cracked it by just writing a separate program and commenting out the existing code). The basic idea of the program is as follows: we look at the seconds digit of the time, loop until it changes, then loop until it returns to its original value. This requires quite some changes to alter to a length of time other than 1 minute, 1 hour, or 1 day (although 26 edits is easily enough – you can do some modular arithmetic on the seconds value to determine a new target to wait until – but nobody found that solution).

sleep(31)#ime+time]->[0]^$x}$x=a;0 until a;0 while a is what you meant, right? I'm not posting this as a solution hoping that someone will try to provide a "proper" solution. (I don't know perl, so I'm out)

Yes, that's what I meant. The algorithm might be hard to change (although probably not impossible; I can see an approach that might work), but under the rules of the challenge you can just completely ignore it and write your own program to do the waiting.

Jelly, 30 bytes, cracked
69266249554160949116534784œSÆl

This can't be tested online since TIO has a 60 second timeout.
Verification
$ time jelly eun '69266249554160949116534784œSÆl'
69266249554160949116534784

real    1m0.033s
user    0m0.433s
sys     0m0.041s

How it works
The natural logarithm (Æl) of 69266249554160949116534784 is 59.5. œS sleeps that many seconds before returning its left argument. Adding the wait time to the 500ms boot time of Jelly (mostly spent loading SymPy and NumPy) gives an execution time of roughly one minute. This is on a third generation Core i7 CPU at 3.40 GHz and an SSD. The boot time will naturally vary on other computers.

Cracked.

reticular, 11 bytes, Cracked
[[3w]5*]4*;

Running:
λ timecmd reticular test.ret
command took 0:1:0.38 (60.38s total)

(timecmd link)
Explanation
[[3w]5*]4*;
[      ]4*  execute this 4 times
 [  ]5*     execute this 5 times
  3w        wait 3 seconds
          ; terminate program

Where can I find the documentation for / an implementation of this language?

Cracked.

Pyth - 5 bytes (distance of 2 allowed) Cracked.
.d*T6

Mess with it online (though it times out with 60 seconds).

Cracked. (for real this time)

@Dennis nice one

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


text:
Complex Binary Numbers
Let's create a simple, surjective mapping from positive integers to Gaussian integers, which are complex numbers where the real and imaginary parts are integers.
Given a positive integer, for example 4538, express it in binary with no leading 0's:
4538 base 10 = 1000110111010 base 2

Remove any trailing 0's:
100011011101

Replace any runs of one or more 0's with a single +:
1+11+111+1

Replace all 1's with i's:
i+ii+iii+i

Evaluate the resulting complex expression and output the simplified Gaussian integer:
i+ii+iii+i = i+i*i+i*i*i+i = 2i+i^2+i^3 = 2i+(-1)+(-i) = -1+i

The output can be expressed in a traditional mathematical way, or given as two separate integers for the real and complex parts. For the 4538 example, any of these would be fine:
-1+i
i-1
-1+1i
(-1, 1)
-1 1
-1\n1

For inputs like 29, mathy formatted outputs such as 0, 0i, or 0+0i are all fine.
Using j (or something else) instead of i is fine if that is more natural for your language.
The shortest code in bytes wins.

From the title I thought that the challenge would be about complex numbers in binary, e.g. 4+2j -> 100+10j...

MATL, 7 bytes
BJ*Y'^s

Try it online!
How it works
Consider input 4538 for example.
B     % Implicit input. Convert to binary
      % STACK: [1 0 0 0 1 1 0 1 1 1 0 1 0]
J*    % Multiply by 1i
      % STACK: [1i 0 0 0 1i 1i 0 1i 1i 1i 0 1i 0]
Y'    % Run-length encoding
      % STACK: [1i 0 1i 0 1i 0 1i 0], [1 3 2 1 3 1 1 1]
^     % Power, element-wise
      % STACK: [1i 0 -1 0 -1i 0 1i 0]
s     % Sum of array. Implicit display
      % STACK: -1+1i

7 bytes in MATL, and the best I can get is 58 in MATLAB... You've made a nice little language there! =)

@StewieGriffin easily the best in show when it comes to graphing or plotting, perhaps also for matrix arithmetic too from the awesome answers I've seen him post.

Jelly, 8 bytes
BŒgaıP€S

Try it online!
How it works
BŒgaıP€S  Main link. Argument: n (integer)

B         Convert to binary.
          If n = 4538, this yields [1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0].
 Œg       Group equal elements.
          This yields [[1], [0, 0, 0], [1, 1], [0], [1, 1, 1], [0], [1], [0]].
   aı     Logical AND with the imaginary unit.
          This yields [[ı], [0, 0, 0], [ı, ı], [0], [ı, ı, ı], [0], [ı], [0]].
     P€   Product each.
          This yields [ı, 0, -1, 0, -ı, 0, ı, 0].
       S  Sum.
          This yields -1+ı.

Python 2, 53 bytes
f=lambda n,k=0:(n and f(n/2,n%2*(k or 1)*1j))+~n%2*k

Been trying to golf this and it seems golfable but I'm out of ideas atm...

That (k or 1) doesn't seem optimal, but the only other thing I can think of is (k+0**k)...

@ETHproductions My thoughts exactly, but unfortunately 0**k doesn't work for complex k...

Mathematica, 44 38 bytes
Tr[1##&@@@Split[I*#~IntegerDigits~2]]&

Explanation
#~IntegerDigits~2

Convert the input into base 2. (4538 becomes {1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0})
I*

Multiply by I ({1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0} becomes {I, 0, 0, 0, I, I, 0, I, I, I, 0, I, 0})
Split

Split by runs ({I, 0, 0, 0, I, I, 0, I, I, I, 0, I, 0} becomes {{I}, {0, 0, 0}, {I, I}, {0}, {I, I, I}, {0}, {I}, {0}})
1##&@@@ ...

Find the product at level 2. ({{I}, {0, 0, 0}, {I, I}, {0}, {I, I, I}, {0}, {I}, {0}} becomes {I, 0, -1, 0, -I, 0, I, 0})
Tr

Sum the result. ({I, 0, -1, 0, -I, 0, I, 0} becomes -1 + I)

minus 1 byte: Tr[Times@@@(I*Split@RealDigits[#,2][[1]])]&

@martin Well, I used your idea of multiplying I first, but IntegerDigits ended up being shorter.

yes - much better :)

Python, 199 129 124 116 94 90 71 63 61 bytes
print sum(1j**len(s)for s in bin(input())[2:].split('0')if s)

Input is just the number itself.
Output is in the format (a+bj), where j is the imaginary unit. 0j will be output instead of (0+0j)
First convert to binary. Truncate the '0b' off. Kill the trailing zeros. Split using a block of zero(s) as a delimiter. Map each block to 1j ** len. Then, take the sum of the entire thing.
-70 bytes by not converting to pluses.
-5 bytes regex is shorter.
-8 bytes by getting rid of the two unnecessary variables that were only being called once.
-22 bytes by using complex numbers instead of my weird thing. Thanks to @Dennis' answer for informing me of complex numbers!
-4 bytes by realizing that map is just a fancy way of doing list comprehensions, except longer.
-19 bytes by switching to a slightly arcane method of avoiding errors with j ** 0 and avoiding regex. Inspired by @Griffin's comment. Thanks! :)
-8 bytes by moving the if part to the end.
-2 bytes Thanks to @Griffin for saving 2 bytes by removing the square brackets to make it a generator expression instead!

I got something quite similar so won't post separate answer, bit shorter though sum(1j**x.count('1')for x in bin(input()).split('0')if x)

@Griffin Nice. I think it's different enough that you could post a separate answer, since it uses a different method of counting the 1 blocks and it doesn't use regex like mine does. Also, I don't want to steal the code from you since it's a lot better than my version. :)

@Griffin I found another solution that's the same length as your solution except instead of counting 1s rather than length, it takes the 0x part off the front first. Thanks for the idea of moving the if to the end; I never would've known that works otherwise!

you don't need the list comprehension. Remove the square brackets to make it a generator expression

@Griffin Oh. Okay, thanks! I'll remember that for future golfing

JavaScript (ES6), 67 64 bytes

f=(n,q=0,a=[0,0])=>q|n?f(n/2,n&1?q+1:q&&0*(a[q&1]+=1-(q&2)),a):a
<input oninput="O.innerHTML=f(this.value)" type="number" step=1 min=0 value="4538">

Outputs as a 2-element array.
Explanation
Since JavaScript doesn't have imaginary numbers, we have to keep track of the real and imaginary parts in separate variables. The easiest way to do this is in a single array, with the real part first. i is represented as [0,1], i2 (or -1) as [-1,0], i3 (or -i) as [0,-1], and i4 (or 1) as [1,0].
First, we repeatedly divide the number by 2, collecting each run of ones in its binary representation. Each run of n ones corresponds to in. This corresponds to adding 1 - (n & 2) to the item at index n & 1 in the two-item array. So that's we do.
I should probably add more explanation, but I can't think of what else needs explaining. Feel free to comment with any questions you might have.

Python 2, 77 76 71 bytes
p=r=0
for n in bin(input()*2):t=n=='1';r-=p*~-t;p=p*t*1jor t*1j
print r

Thanks to @ZacharyT for golfing off 1 byte!
Try it online!

MATLAB, 58 bytes
@(x)eval([strrep(strrep(dec2bin(x),48,43),49,'i*1'),'.0'])

dec2bin(x) % converts the decimal value to a binary string of 1s and 0s.
strrep(dec2bin(x),48,43) % Substitutes ASCII character 48 with 43 (0s become +)
strrep(___,49,'i*1')     % Substitutes ASCII character 49 with 'i*1'
                         % 1s become 'i*1' (this is the gem)
eval([___,'.0']          % Appends .0 in the end and evaluates the expression.

Let's use 285 to illustrate the process:
temp1 = dec2bin(285)
      = 100011101

temp2 = strrep(temp1,48,43)
      = 1+++111+1

Luckily 1+++1 behaves just as 1+1 in MATLAB, so the above evaluates to: 1+111+1.
temp3 = strrep(temp2,49,'i*1')
      = i*1+++i*1i*1i*1+i*1

Now this strrep-call is the real gem! By inserting i*1 for 1 we get something really nice. If there's only one 1, we simply get i*1 which is i. If there are more than one then i*1 gets repeated and concatenated into a sequence: i*1i*1i*1i*1. Since i==1i in MATLAB and 1i*1==i this is simply: i*i*i*i.
temp4 = [temp3,'.0']
      = i*1+++i*1i*1i*1+i*1.0

Appending .0 seems unnecessary here, but it's needed if the last character of temp3 is a +. We can't append just a zero, since that would give i*10 in the case above and therefore the wrong result.
And finally:
eval(temp4)
0.0000 + 1.0000i

This doesn't work in Octave for several reasons. strrep can't take ASCII-values as input, it needs the actual characters ('0' instead of 48). Also, +++ doesn't evaluate to just + in Octave, as that would break the increment/decrement shortcuts x++ and x--.

Always +1 for using eval :-P Can't you use 1i instead of 1*i?

Oh you're is using it differently. Very clever!

Thanks :-) I must admit, I was quite satisfied with the i*1 part...

Pyth - 15 bytes
Frustratingly long.
s^L.j)hMe#r8jQ2

Test Suite.

Mathematica, 84 bytes
ToExpression[#~IntegerString~2~StringTrim~"0"~StringReplace~{"0"..->"+","1"->"I "}]&

Anonymous function. Takes a number as input and returns a complex number as output.

Wow, I'm surprised that Mathematica doesn't have a built-in for this!

Mathematica, 75 bytes
ToExpression[#~IntegerString~2~StringReplace~{"1"->"I ","0"..->"+"}<>"-0"]&

Independently came up with almost the same solution that LegionMammal978 posted 23 minutes ago! Replacing 1 with I  (which is Mathematica's internal symbol for the square root of -1) works because spaces are treated as multiplication of neighboring expressions. The place I saved on the other solution, namely by avoiding the need for StringTrim, is by always appending -0: if the binary number ends in 1, then this expression ends in ...I-0 which doesn't affect its value; while if the binary number ends in '0', then this expression ends in ...+-0 which is parsed as "add negative 0" and thus gets rid of the trailing plus sign.

Matlab, 99 Bytes
function c=z(b)
c=0;b=strsplit(dec2bin(b),'0');for j=1:numel(b)-isempty(b{end});c=c+i^nnz(b{j});end

Test cases:
z(656) = 3i
z(172) = -1 + 2i
z(707) = -2 + i
z(32)  = i
z(277) = 4i

Haskell, 102 91 89 87 bytes
0%a=a
n%c@[a,b]|odd n=div n 2%[-b,a]|d<-div n 2=zipWith(+)c$d%[mod d 2,0]
(%[0,0]).(*2)

Repeatedly divides by two and checks the bit. Keeps an accumulator of i^(number of odds) where a+b*i is encoded as [a,b] and *i is [a,b]↦[-b,a] (rotation by 90 degrees). The initial (*2) is to avoid a lookup for the first bit.
Usage (thanks to @OwenMorgan for the examples):
(%[0,0]).(*2)<$>[656,172,707,32,277]
[[0,3],[-1,2],[-2,1],[0,1],[0,4]]

Java, 172 bytes
l->{int i=0,j=i;for(String x:l.toString(2).split("0")){int a=x.length();j+=a&1>0?(a&3>2?(a-3)/-4+1:(a-3)/4+1):0;i+=a&1<1?(a&3>1?(a-3)/4+1:(a-3)/-4+1):0;}return i+"|"j+"i";}

Clojure, 183 bytes
#(loop[x(clojure.string/split(Integer/toString % 2)#"0+")y[0 0]a 0](if(= a(count x))y(recur x(let[z([[1 0][0 1][-1 0][0 -1]](mod(count(x a))4))][(+(y 0)(z 0))(+(y 1)(z 1))])(inc a))))

Am I allowed to do this?
Use the function like so:
(#(...) {num}) -> (Wrap the # function in brackets first!)

Actually, 35 bytes
├'0' aÆô' @s"j+"j'jo`"1j*1"'1τ(Æ`Y≡

Try it online!
Explanation:
├'0' aÆô' @s"j+"j'jo`"1j*1"'1τ(Æ`Y≡
├                                    binary representation of input
 '0' aÆ                              replace 0s with spaces
       ô                             trim leading and trailing spaces
        ' @s                         split on spaces
            "j+"j                    join with "j+"
                 'jo                 append "j"
                    `"1j*1"'1τ(Æ`Y   do until the string stops changing (fixed-point combinator):
                     "1j*1"'1τ(Æ       replace "11" with "1j*1"
                                  ≡  evaluate the resulting string to simplify it

Roughly equivalent Python 3 code:
a='j+'.join(bin(eval(input()))[2:].replace('0',' ').strip().split())+'j'
b=0
while a!=b:b,a=a,a.replace("11","1j*1")
print(eval(a))

Try it online!

Splitting on '0's with '0@s and using \`░` to trim any trailing empty strings should save you four bytes.

Jelly, 10 bytes
This isn't better than Dennis's Jelly answer, but I wanted to try my hand at a Jelly answer anyway. Golfing suggestions welcome! Try it online!
BŒrm2Ṫ€ı*S

Ungolfing
BŒrm2Ṫ€ı*S   Main link. Argument: n (integer)

B            Convert n to binary.
 Œr          Run-length encode the binary list.
   m2        Every 2nd element of the run_length encoding, getting only the runs of 1s.
     Ṫ€      Tail each, getting only the lengths of the runs.
       ı*    The imaginary unit raised to the power of each run (as * is vectorized).
         S   Sum it all into one complex number.

In the link above The input 1 return 1j the input 2 return 1j.... Is that right?

@RosLuP Yes, that's right? Since we remove trailing 0's, 1 => 1 => 1j is equivalent to 2 => 10 => 1 => 1j.

Actually, 15 bytes
Golfing suggestions welcome! Try it online!
├'0@s``░`lïⁿ`MΣ

Ungolfing:
         Implicit input n.
├        Convert n to binary.
'0@s     Split by '0's.
``░      Filter out non-truthy values.
`...`M   Map over the filtered result, a list of runs of '1's.
  l        Yield the length of the run of '1's.
  ïⁿ       Yield the imaginary unit to the power of that length.
Σ        Sum all of this into one complex number.

Perl 6,  40  46 bytes
I came up with this fairly quickly
*.base(2).comb(/1+/).map(i***.chars).sum

Unfortunately it is currently inaccurate in the Rakudo implementation on  MoarVM.
say i ** 3; # -1.83697019872103e-16-1i
So I had to do the next best thing:
*.base(2).comb(/1+/).map({[*] i xx.chars}).sum

Expanded:
*\             # Whatever lambda
.base(2)       # convert to a Str representation in base 2
.comb(/ 1+ /)  # get a list of substrings of one or more ｢1｣s
.map({         # for each of those

  [*]            # reduce using ｢&infix:<**>｣
    i xx .chars    # ｢i｣ list repeated by the count of the characters matched

}).sum          # sum it all up

Test:
.say for (4538, 29).map:

    *.base(2).comb(/1+/).map({[*] i xx.chars}).sum

# -1+1i
# 0+0i

Bug report filed

Axiom, 140, 131, 118 108 bytes
b(x)==(s:=0;repeat(x=0=>break;r:=x rem 2;repeat(x rem 2=1=>(r:=r*%i;x:=x quo 2);break);s:=s+r;x:=x quo 2);s)

%i is the imaginary costant.Ungolfed
sb(x:NNI):Complex INT==
  r:Complex INT;s:Complex INT:=0
  repeat
    x=0=>break
    r:=x rem 2
    repeat
       x rem 2=1=>(r:=r*%i;x:=x quo 2)
       break
    s:=s+r
    x:=x quo 2
  s

results
(3) -> b 4538
   The type of the local variable r has changed in the computation.
   We will attempt to interpret the code.
   (3)  - 1 + %i
                                                    Type: Complex Integer
(4) -> b 29
   (4)  0
                                                    Type: Complex Integer
(5) -> sb 299898979798233333333333333339188888888888888888222
   Compiling function sb with type NonNegativeInteger -> Complex Integer
   (5)  - 7 + 12%i
                                                    Type: Complex Integer
(6) -> b 299898979798233333333333333339188888888888888888222
   (6)  - 7 + 12%i
                                                    Type: Complex Integer

PHP, 87 bytes
for($n=$argv[1];$n|$i;$n>>=1)$n&1?$i++:($i?$i=0*${$i&1}+=1-($i&2):0);echo"(${0},${1})";

Almost the same as ETHproductions´ solution; only iterative instead of recursive.
Takes input from command line, sets variables ${0} and ${1}.

TI-Basic (TI-84 Plus CE), 70 bytes
Prompt X
0→S
0→N
While X
If remainder(X,2
Then
N+1→N
int(X/2→X
Else
S+i^Nnot(not(N→S
X/2→X
0→N
End
End
S+i^Nnot(not(N

There's no builtin to convert to a binary string, (nor is there to parse a string), so this program manually divides by 2, incrementing N each time it sees a 1 and adding i^N to S (N>0) and resetting N if it sees a zero.

Java, 100 bytes
int[]f(int n){int c=2,r[]=new int[2];for(;n>0;r[c&1]+=n%4==1?(c&2)-1:0,n/=2)c=n%2<1?2:c+1;return r;}

Try it online!

R, 54 bytes
function(n,x=rle(n%/%2^(0:log2(n))%%2))sum(1i^x$l*x$v)

Try it online!
n%/%2^(0:log2(n))%%2 computes a vector of the binary digits. Using the run-length encoding, we use R's complex type to compute the appropriate sum, multiplying by the x$values to remove zeros.
Returns a complex vector of one element.

APL(Dyalog Extended), 13 bytes SBCS
+/×/¨0j1×⊆⍨⊤⎕

Try it on APLgolf!
A tradfn submission which takes a decimal number.

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


text:
Write an program that terminates after 60 seconds - Robbers Thread
This is a cops and robbers challenge - Cop's Thread
Each of the cops have been tasked to write a program that terminates after exactly 60 seconds, or as close as possible. For example:
#include <unistd.h>
int main(int argc, char **argv){
    sleep(60);
    return 0;
}

Your goal is to take any of the uncracked submissions and change it so that it terminates after 31 seconds. If a cop's answer has been up for more than two weeks, it is immune to cracking. The original answer and your edit must have a Levenshtein edit distance of up to half of the original program's length.
The robber with the most cracks wins!
The cops have been allowed to do either of the following if they do not wish to use the system time calls:

The speed of printing to stdout is controlled by the baud rate of the terminal you are printing to. If you wish, you can control the speed of your program by printing to stdout with a set baud rate. However, you must also cite an actual piece of hardware or terminal program that has that baud rate as default (e.g. a serial printer with a default print speed of 300 baud).
If you are working in a language where all operations take some constant amount of time (such as assembly language), you can control the speed of your program by specifying the processor's clock rate. However, this too must be accompanied with a citation of an actual processor chip that runs at that speed (e.g. the 1 MHz 6502 put inside Apple //e and NES boards).

If you encounter a solution with this specification, you cannot change this parameter. (Not that it would help you much anyway, since it's hard to find an upgraded chip or serial output device with a 31:60 speed ratio).

Your pseudo-code definition of fundamentally changing the algorithm is a step in the right direction, but this part and the "reasonable" baud rates and CPU frequencies are still too vague. Also, neither the cops' nor the robbers' challenge have a winning criterion at this point, nor do they specify how a solution becomes safe.

@Dennis Would it help if I actually wrote a good answer and cracked it?

No. Validity and winning criteria have to be objective. Having an example of a "good answer" doesn't hurt, but it also doesn't replace a proper specification.

Jelly, edit distance 5 from 30 bytes
Original:

69266249554160949116534784œSÆl

Crack:

69266249554160949116534784œSÆl_29$$

I just subtracted 29 from the timeout immediately before the œS runs. (_29 subtracts 29, the dollars control precedence, a bit like parentheses in other languages.)

reticular, edit distance 4 from 11 bytes
Original:

[[3w]5*]4*;

Crack:

6w[[1w]5*]5*;

The edit distance we've been given is just way too high to make cracking difficult. There was a lot of freedom in this one, so I aimed for one that preserved the spirit of the original code.
reticular, edit distance 3 from 11 bytes
I found an improved crack, here it is:
Original:

[[3w]5*]4*;

Crack:

1w[[3w]5*]2*;

Hm, nice. I do think the edit distance is too high as well.

Pyth, 5 bytes, Maltysen
.dh*T3

*T3 computes 30, h increments, and .d waits for that many seconds.


text:
Help me untangle these wires!
My wires are all tangled!
Isn't it annoying when wires get all tangled up? Well, that just happened to me, so I'd like to to help me untangle them! For your convenience, I've disconnected them all from the device, but they're all still connected to the outlet. Your challenge is to figure out how to untangle them!
Input
The input will consist of spaces, pipes, and Xs (both cases). The input will look something like this:
| | | |
 X  | |
| |  x
|  X  |
| | | |

A capital X means that the left wire crosses over the right wire, and a lowercase x means the opposite. The first and last lines will always be | | | |.... You may take the input as a comma separated string, an array of strings, etc. The format is not strict, as long as it makes sense and doesn't contain any extra information.
Output
For this challenge, not only do I need to know how long I will take, I need to know exactly what to do. So, output a list of integer pairs with the character R or L, case insensitive, representing which two wires to untangle and which way (R means right over left, and vice versa for L). You need to tell me which way to uncross them; I can't figure that out myself. Output is pretty flexible too, as long as you output all of the integer pairs + character in the correct order and you don't output any extra nonsense text (brackets, commas, etc. are fine). The wires can be zero or one indexed, but the index must start from the left. Note that you must untangle from the bottom, not the top. Output style must be consistent, and please specify how you are outputting if it is not obvious. The case of the character doesn't have be consistent, if that helps at all.
Sample Output
For the example input above, the output would be something like:
2 3 R
3 4 L
1 2 R

The output format here is a newline separated list of space separated values. This is 1-indexed.
Further specifications
It is valid to have X and x stacked vertically over each other in either order. Since I'm lazy, I don't want to switch wires around unnecessarily, so don't output anything for these cases; if I find that, I'll just pull the wires gently to get them straight.
It is also valid to have multiple X and x stacked vertically, and as long as neither wire is involved in other crossings, I don't want any extra moves (because I'm lazy). Thus, if the characters X X x X x x show up in a column without any other crossings, the output should still be blank!
In case this isn't clear, R eliminates X and L eliminates x.
There could be two wire crossings in the same row, in which case the order of these two swaps does not matter. You will never get something like |  X X  | (this does not make sense because it implies that the middle wire is being crossed over the wires on both its left and its right).
There aren't always crossings...
The input could be a single pipe. However, the input will never be blank.
Shortest valid solution wins on December 20th!
More Examples
As I promised:
Example 1
Input
| | | | | |
| |  X   x
 X  |  x  |
|  x  |  X
 X   X  | |
| | | | | |

Output
1 2 R
3 4 R
2 3 L
5 6 R
1 2 R
4 5 L
3 4 R
5 6 L

Example 2
Input
| | |
 X  |
|  x
| | |
|  X
|  x
| | |

Output
2 3 L
1 2 R

Example 3
Input
|

Output is blank. Yes, you have to deal with this case.
Example 4
Input
| |
 X
 x
 X
 x
 X
 x
 X
 x
 X
 x
| |

Output is blank. Just for fun :).
Example 5
Input
| |
 X
 X
 x
 X
 x
 x
| |

Output is still blank...

Is it possible to have two pairs of wires entangled in the same row?

@JamesHolderness Yes, it is. In this case, the order does not matter. I will clarify that in the question. Thanks!

@JamesHolderness Done!

Befunge, 173 bytes
Input is read from stdin in the exact format given in the challenge description, although it's crucial that every line be the correct length and the final line must include a newline (i.e. not just EOF at the end of that line).
$1>>05p~$~:55+-#v_
$_^#`"N":+1g50$<>:2+3%1-05g6g+0v>!#:v#
vg50-1*2p51:-1_^#:<*2!!-*84p6g5<
 +#,.#$"R"\#\-#+5<^g51$_:0`6*\25g\v@_:#!.#:1#,
>+::25p6g\48*\6p48 *-:!^!:--1*2`0:<

Try it online!
The basic idea for this solution is that we have an "array" keeping track of the twist counts for each wire. So every time we encounter a twist in one direction we increment the count for the associated wire, while a twist in the other direction will decrement the count.
At the same time as we process the twist for a particular wire, we also look at the twist count for the wires to the left and right of it. If either of them are non-zero, we need to "flush" those twists onto the stack, since it will no longer be possible for them to be unravelled by later twists in the opposite direction.
After the last line of input, the input stream returns EOF repeatedly, and these EOF characters are interpreted as twists in every wire, at least for the purposes of flushing. This forces the program to flush any outstanding counts in the array, but it will not generate any new twist counts.
Once we've finished processing the input, all the commands for untangling the wires will now be on the stack. This means we can simply pop them off in reverse order to output the instructions needed to untangle the wires from the bottom up.

This appears to work perfectly. Good job!

This is the winning answer. Good job! Also, thanks for checking the other answers for me! :)

@AlexL. Thanks. This is my first winning answer on the site. Didn't think that would ever be possible with Befunge. :)

No problem. Congrats on the win! I'm rather surprised as well as to how short you made a Befunge answer. :)

Pyth - 26 25 bytes
Very straightforward, maybe I can golf the filtering.
fhhT_m+hB/xrdZ\x2@"RL"}\x

Try it online here.

Good attempt. Unfortunately, the character being output is not correct; it seems to be R every time. Good try though; the numbers are coming out correctly!

@AlexL. I'm stupid, I had flipped the args to in, fixed, and it saved me a byte too

I see. Nice answer! Have an upvote. :)

If I'm not mistaken, this doesn't appear to handle the case where you have X and x stacked vertically. It tells you to swap the wires back and forth unnecessarily.

JavaScript (ES6), 178 bytes
f=([t,...a],r=[])=>a[0]?t.replace(/x/gi,(c,i)=>(c=c<'x'?'R':'L',i=++i/2,r.reduce((f,[j,,d],n)=>f||i<j+2&&j<i+2&&(j-i|c==d||r.splice(n,1)&&2),0)<2?r=[[i,i+1,c],...r]:r))&&f(a,r):r

Takes input as an array of strings representing lines and returns an array of arrays of values e.g. [[2, 3, "R"], [3, 4, "L"], [1, 2, "R"]]. The reverse ordering helps with the eliminations.

Where are you getting s from? I'm running it on repl.it and it's telling me that there's a ReferenceError: s is not defined.

@AlexL. Oops, I accidentally pasted in the previous version of my code, which I hadn't finished golfing. Should be fixed now.

@JamesHolderness The question was changed since I submitted my answer, I'd have to update it.

@JamesHolderness Yep. Sorry about that, Neil. I just needed to clarify some parts of the question that I didn't clarify earlier.

@JamesHolderness I realise that, which is why I have marked my answer as noncompeting as it answered a previous iteration of the question, until such time as I am able to update it to the current requirements.

@JamesHolderness OK I think this version works now.

Python 2, 244 241 bytes
m=[]
for l in input():
 for i in range(len(l)):
  c=l[i];a=i/2+1;L,R=[a,a+1,'LR'[c>'v']],[a,a+1,'RL'[c>'v']];x=m.index(L)if L in m else-1;M=zip(*m[:x+1])
  if c in'xX':
   if x>=0and(a in M[1]or a+1in M[0])<1:del m[x]
   else:m=[R]+m
print m

Takes input as list of strings
Example:
Input: ['| | | |', ' X  | |', '| |  x ', '|  X  |', ' x  | |']
Output: [[1, 2, 'L'], [2, 3, 'R'], [3, 4, 'L'], [1, 2, 'R']]
Edit:
Fixed for case:
Input: ['| | |', ' X  |', ' X  |', ' x  |', '|  X', ' X  |', ' x  |', ' x  |', '| | |']
Output: [[1, 2, 'L'], [2, 3, 'R'], [1, 2, 'R']]

@JamesHolderness Should be fixed now.

This looks like it's working properly now!

@JamesHolderness Yes, that seems like a problem. Please fix that, TFeld. Otherwise, nice attempt!

@AlexL. Should be fixed now


text:
Numpad Word Search
Given an integer from 1 to 999 inclusive, output a truthy value if it appears horizontally, vertically, or diagonally, either forwards or backwards, anywhere in the 3x3 square of digits 1-9 on a standard number pad:
789
456
123

If the number does not appear, output a falsy value.
The exact 65 numbers you need to output truthy for are:
1
2
3
4
5
6
7
8
9
12
14
15
21
23
24
25
26
32
35
36
41
42
45
47
48
51
52
53
54
56
57
58
59
62
63
65
68
69
74
75
78
84
85
86
87
89
95
96
98
123
147
159
258
321
357
369
456
654
741
753
789
852
951
963
987

Everything else is falsy.
The shortest code in bytes wins.

Relevant OEIS.

The input may contain 0, it can be a string.

I see Luis Mendo showing up with a MATL answer in the near future heh.

JavaScript (ES6), 83 ... 74 73 bytes
Takes input as a string.
n=>1/([a,b,c]=[...n].map(v=>--v+v/3|0))||45242>>(a^b)&(~c&&n<99|b*2==a+c)

Saved 3 bytes thanks to ETHproductions
How it works
We transform the number pad by applying an offset to each digit according to the row it belongs to:

+1 for the top row
0 for the middle row
-1 for the bottom row.

All codes below are represented in hexadecimal.
7 8 9      8 9 A  (+1)
4 5 6  =>  4 5 6  (unchanged)
1 2 3      0 1 2  (-1)

Let's consider all XOR combinations of these new key codes. Contiguous keys are highlighted with brackets.
XOR|  0   1   2   4   5   6   8   9   A
---+------------------------------------
 0 |  0  [1]  2  [4] [5]  6   8   9   A
 1 | [1]  0  [3] [5] [4] [7]  9   8   B
 2 |  2  [3]  0   6  [7] [4]  A   B   8
 4 | [4] [5]  6   0  [1]  2  [C] [D]  E
 5 | [5] [4] [7] [1]  0  [3] [D] [C] [F]
 6 |  6  [7] [4]  2  [3]  0   E  [F] [C]
 8 |  8   9   A  [C] [D]  E   0  [1]  2
 9 |  9   8   B  [D] [C] [F] [1]  0  [3]
 A |  A   B   8   E  [F] [C]  2  [3]  0

We can see that two keys are contiguous if and only if XORing their codes leads to one of the following values:
1, 3, 4, 5, 7, C, D, F

This list can be packed into the following binary mask:
  FEDCBA9876543210
  ----------------
0b1011000010111010 = 0xB0BA = 45242

Hence the test to determine if two key codes (a, b) correspond to two contiguous keys:
45242 >> (a ^ b) & 1

For three key codes (a, b, c), we need this additional test:
b * 2 == a + c

Example:
a = 0xA
b = 0x6
c = 0x2

0xB0BA >> (0xA ^ 0x6) & 1 == 0xB0BA >> 0xC & 1 == 1
=> 0xA and 0x6 are contiguous key codes

0x6 * 2 == 0xA + 0x2
=> 0xA, 0x6 and 0x2 are contiguous key codes on the same row, column or diagonal

Demo
This snippet outputs the list of truthy values.

let f =

n=>1/([a,b,c]=[...n].map(v=>--v+v/3|0))||45242>>(a^b)&(~c&&n<99|b*2==a+c)

console.log([...Array(1000).keys()].filter(n=>n && f(n+'')).join(' '))

Coercion is your friend here: a-.5 returns true for any array a containing (zero or) one integer. n=>([a,b,c]=[...n].map(v=>--v+v/3|0))-.5||n%10&&n<100|b*2==a+c&&45242&1<<(a^b)

@ETHproductions Ah, nice! 1/a is even shorter and should work just as well, I think.

Python3, 72 bytes
lambda n,s="123 456 789 741 852 963 42 753 86 26 159 84 ":n in s+s[::-1]

Input is taken as a string.
Golfing suggestions welcome! :D

Does this take the number as a string?

@Flp.Tkc Yes it does. I'll mention that in the post. Thanks!

@TuukkaX there is an additional space in string s, you can save 1 byte.

@GurupadMamadapur I don't see why I would change my current 72 bytes solution to your 74 bytes solution... :D And if you refer to my string s, which has an whitespace after 84, then you're incorrect, since it's required. If it wouldn't contain a whitespace, the resulted string would have a chain '8448', which would lead to failed testcases. Thanks for the suggestions though!

@TuukkaX Yeah you're right about the extra whitespace, missed that one :)

That's crazy, great thought process there.

@carusocomputing You probably meant to comment on Arnauld's answer. He did a great job at thinking a good bit-hacky solution!

Befunge, 169 161 159 bytes
38*:2+"*0>DTV{51"3*\3*"kV"3*\3*"{w"3*\3*"mr"v
v:\&+*83:++66:+"c":+"?":+"$":++66:+"W":*6\*4<
_v#:\_v#*-+%+55g00*+55g02\*-g02\*-g00\`9::::p02/+55p00%"d":
0<@.!!<

Try it online!
The first two lines are just pushing the list of test numbers onto the stack. This is done in order of size, since it can sometimes be easier to generate a number as an offset from the previous one in the series rather than generating it from scratch. Once we get to the larger numbers, we can also sometimes save a byte by generating them in pairs, e.g. "kV"3*\3* gives us 258 and 321 in nine bytes, where individually they would take five bytes each.
The main loop is on line three, executing right to left with wrap around. This just iterates through all the test numbers on the stack, comparing the value itself, value%100, and value/10. If any of those match the input number or the number <= 9 then we output 1 and exit. If there is no match, we continue looping. If we run out of test numbers on the stack then we output 0 and exit.
Thanks to Mistah Figgins for saving me a couple of bytes.

I think you can change the last line to 0<@.!!< to save 2 bytes. This relies on the top of the stack being non-zero when the IP comes down onto the second arrow. Try it Online!

Jelly, 29 24 19 bytes
Saved 5 bytes thanks to @Dennis's suggestion of K and Ɠ.
9s3µUŒD;;Z;ŒDµ;UKƓẇ

Try it online!
Explanation
9Rs3µUŒD;;Z;ŒDµ;UKƓẇ  Main link. Argument: number
9s3                   Split [1..9] into [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
   µ                  New monadic chain
    U                 Reverse the rows
     ŒD               Take the diagonals of the result
       ;              Append the original rows
        ;Z            Append the original columns
          ;ŒD         Append the original diagonals
             µ        New monadic chain
              ;U      Append the reverse of everything
                K     Join by spaces
                 Ɠẇ   Check if a line from STDIN is in the result

If you read the input from STDIN, 9s3µUŒD;;Z;ŒDµ;UKƓẇ saves 5 bytes.

Do you need to reverse the rows? They can appear forward or backwards, so 123,456,789 should be the same as 789,456,123

@Riley I reverse each row, not the rows as an array. I guess I could've been clearer there. Anyway, it's done in order to get half of the diagonals.

Ruby, 77 bytes
->n{!!((s='123 456 789 147 258 369 753 951 86 62 24 48 ')+s.reverse)["#{n}"]}

You are creating a string that is '123 456 789 147 258 369 753 951 ' + the same string reversed, and checking whether the parameter is found on the string, right? If it's so, then this solution is invalid. For example, 86 and 24 will fail.

The rules say you need only output a truthy or falsey value, so you don't need !! or the attendant parentheses.

bash, 75
printf %s\\n 123 456 789 741 852 963 42 753 86 26 159 84|tee >(rev)|grep $1

outputs something and returns 0 for all the values in that list
prints nothing and returns 1 in all other cases

Java, 397 bytes
public class Numpad {public static void main(String[] args){Scanner input=new Scanner(System.in);int in=input.nextInt();int h=in/100;int u=in%10;int t=(in%100)/10;boolean out=false;input.close();if(in<10)out=true;else if( h==0){int decider=Math.abs(t-u);if((decider==1)||(decider==3)||(decider==4))out=true;}else{if ( Math.abs(h-t) == Math.abs(t-u))out=true;}System.out.println("RESULT : "+out);}}

I am new to this .. kindly excuse any oblivionism.

Hello, and welcome to the site! I've edited your post so that the code section is displayed as code and added a byte count, which is standard for answers here. This competition is a [tag:code-golf] competition, meaning the ultimate goal is to make your code as short as possible. For example, you can use short variable names, and define a function instead of a full class. I'm not great at Java, but some more tips are available here. You should try to make your code shorter, and then [edit] the new version into your post.


text:
Create an application that restarts itself after n-seconds once
In your favorite programming language, create an application that restarts itself once, after n seconds.
You need to find a way to restart after exiting the program. EG: run cmd to do it for you. Make sure it waits an amount of seconds specified by the user before restarting
For clarification: You can run a second program, or compile one at runtime to do the work for you.
Also, make sure the program works every time you execute it, not only once.
Example of algorithm:
If hasntrestartedalready
    read i
    exit
    wait(i)
    restart
end if

Least amount of bytes wins.

What does "Use any external programs/libraries that don't come with your OS" mean in the context of OSes other than Windows and MacOS? I don't think even CPM distros were consistent in their accompanying utils. 2. What does"invisible" mean?

Don't download binaries on runtime and use them to do the work for you, and don't have anything predownloaded to do the work for you. You can use any programming language, but you can't do eg
DownloadFile("http://bar.com/foo.exe") and then run it.
Invisible = no gui/window/form showing.

Why are you restricting the allowed algorithm?

I'm not restricting it. I'm trying to give an example of how I did it.

“The algorithm of your program should be:” If I'm correctly understandingthe meaning of “should” you are forbidding to use an other algorithm

Fair enough. Edited.

You are still restricting the algorithm, I will make an edit (You can still rollback it)

Could you clarify (by editing the question) whether it's OK for the program to replace itself via an exec (i.e. an atomic run-a-program-and-exit command)? Or does there have to be some time during which the program is not running at all in between the program exiting and starting. Additionally, is it legal to run a second program in the background, exit, and have the second program run you? Or must the restart not even be a child of the original execution?

Edited the post a bit for clarification.
For your first question, yes you can do that, but make sure the program works with every execution. So it won't stop working after I execute it once
For your second question, yes. You can use a second program as a helper for restarting.

Batch, 34 28 bytes
timeout/t %1
if %1 neq [] %0

Input time in seconds as the first argument. If no argument is present, as well as after restarting, it spews out error messages (follow both commands with 2>NUL to get rid of them). The new instance opens in the same window (OP said it's allowed).

Wait, if %1 isn't 1, then why is passing it to your script again going to work? Isn't it just infinite recursion based off of %1? Example: script 482 will never not call %0 %1.

Wouldn't it be something like if %1 neq 0 wait %1 %0 0?

Wouldn't you do if %1 neq 1 %0 1?

@Timtech That's what I proposed, but the current answer nor your proposal wait for %1 seconds, as required.

@SeeOneRhino Looks like this question was edited after being posted...

@Timtech I fixed the script! Probably. (a percent sign was where it shouldn't be) Also added timeout.

You probably can get away without the /nobreak and you don't need the space before /t (but you do need the space after).

Does this program actually restart itself after exiting? Or is it just exec-ing itself (i.e. replacing its running image with itself)? It's unclear to me whether the latter counts.

@ais523 I'm not sure how a script can do stuff after exiting, so it runs a new instance after the timeout and exits right after that.

@Neil I'll consider that, thanks!

@Sobsz: in my answer, I used the operating system's task scheduler to handle the restart. (I think figuring out a way to do that is the hardest part of the challenge.)

@Sobsz Yes that does count. As long as the arguments are passed, the program is restarted successfully after the seconds specified.

@P. Ktinos Yay!

bash + at, 29 bytes
at now+$[$1/60]min<<<bash\ $0

zsh + at, 28 bytes
at now+$[$1/60]min<<<zsh\ $0

bash + at or zsh + at, 23 bytes, arguably cheating
at now+$[$1/60]min<<<$0

The first version re-executes the program after the number of seconds given as a command-line argument (which must be a multiple of 60 because at has only minute granularity). at is a standard POSIX program for scheduling programs to be run in the future. The 29-byte and 28-byte programs each rerun the program with the shell it's designed for. The 23-byte program doesn't specify a shell, and thus may well accidentally rerun it with sh, which is likely to be unable to parse it; it's up to you whether you consider it reasonable for the restart to happen in the wrong language or not, so I presented both versions.
The time to wait is taken as a command-line argument. This means that the argument won't be present in the rerun, and thus the rerun will exit (with an error message due to the malformed expression, but which will be hidden by at; on some systems, it might be sent to you by email, but mine doesn't have that set up) rather than keep rerunning indefinitely.
bash considers the $[] syntax for arithmetic obsolete, but it still works and is shorter than the "official" syntax. zsh is fine with it, as far as I could tell from the documentation.

With your use of terms such as likely and acciddentally I will assume the program might not function correctly (restart after n-seconds) based on chance? If that's the case, that is not allowed, as the program must work each time it is executed. You can keep the other two however.

It's not based on chance, it's based on the configuration of the operating system it's run under. Additionally, the program will restart; it's just that it might restart under the wrong interpreter. (It's analogous to a Python program that restarts after n seconds, but ends up running under Ruby rather than Python; the restart itself functions, but you can't say much about the functioning of the program after the restart.)


text:
Tasteless and other bugs
Some versions of the standard Android calculator app allow you to press a key, like 'sin' and then the 'del' key to make it 'si'. Probably just a bug which they can't be bothered with removing.

The following letters/letter groupings are typable:

sin
si
s
cos
co
c
tan
ta
t
ln
l
log
lo
e

So, 'tasteless' is typable, because ta-s-t-e-l-e-s-s and so is 'clogs' because 'c-log-s'. However 'got' is not typable, neither is 'an' or 'xyz'.
Write a program that takes a single word (or sequence of letters, only a-z in input) as input and produces output to indicate if a word is typable or not.
Output may be a single character/letter/digit/etc. or it may be larger. All typable words should produce the same output. All non-typable words should also produce the same output.
P.S. Just out of curiosity, is 'tasteless' the longest dictionary word that is typable?

Just to be clear: We output a single, consistent digit or letter of our choice to indicate the word is typeable, and a different, single, consistent digit or letter of our choice to indicate the word is not typeable. Is that correct?

The longest word I could find is 10 letters, coelostats.

So, is "πe" not a word?

@Dennis Ya, more or less.

@MrLister To make the problem simpler, only a-z are allowed in input.

@Dennis Though there's probably nothing wrong in outputting something bigger, like 'true' and 'false' or something like that. Basically it shud be obvious from the output as to what the result is. Ok, I'll edit the question

Another 11: sissinesses

Perl, 47 43 41 + 1 = 42 bytes
-4 bytes thanks to @Sunny Pun.  -2 bytes thanks to @Brad Gilbert b2gills and @Downgoat
Run with the -n flag.
say!/^(s(in?)?|co?|t(an?)?|ln?|log?|e)+$/

It can definitely be golfed futher, but in the spirit of competition, I'm leaving the mostly-original regex I came up with at the beginning.
Returns nothing if true, 1 if false.
Try it online!
I downloaded a dictionary file, and the longest word I found was 11 letters -- tattletales

I think co? should be sufficient since sin will take care of the s :) Nice playing with /log?/!

It doesn't say that it needs to be case insensitive (remove i), or that the single result has to make sense (remove one !)

Do you need i flag at very end since input is only a-z?

You can make this simpler: -2: /^(s|sin?|co?|t|tan?|ln?|log?|e)+$/ or if you prefer: /^([celst]|sin?|co|tan?|ln|log?)+$/

ETHProductions´ regex is 4 bytes shorter: /^((si|ta|l)n?|co?|log?|[ste])+$/

Enjoy your bounty!

JavaScript (ES6), 44 bytes
s=>/^((si|ta|l)n?|co?|log?|[ste])+$/.test(s)

I think this is the shortest regex possible, but of course I may be wrong.
Explanation
An obvious first place to start would be a regex that simply includes all options separately:
s=>/^(sin|si|s|cos|co|c|tan|ta|t|log|lo|l|ln|e)+$/.test(s)

First, we can observe that cos can be formed from co and s, making it unnecessary:
s=>/^(sin|si|s|co|c|tan|ta|t|log|lo|l|ln|e)+$/.test(s)

Some of these, such as sin and si, can be combined by making the last letter optional:
s=>/^(sin?|s|co?|tan?|t|log?|ln?|e)+$/.test(s)

This works because sin? matches si with or without an n on the end, thus covering both sin and si.
There seems to be a lot of n?s as well. What if we put them all together?
s=>/^((si|ta|l)n?|s|co?|t|log?|e)+$/.test(s)

One more way to golf this would be to combine the remaining single-char options into a character range, but this comes out at the same length:
s=>/^((si|ta|l)n?|co?|log?|[ste])+$/.test(s)

And that's how you golf a simple regex. I believe this is the shortest possible regex that matches every string correctly, but perhaps not. I will award a +100 bounty to anyone who manages to improve upon this regex.

The one that I used in my answer is sort of similar: ^(s|t|co?|(l|ta|si)n?|log?|e)+$

Firstly, I count 44 bytes. Secondly, here's an alternate but longer solution: / /.test.bind(/^((si|ta|l)n?|co?|log?|[ste])+$/).

@ConorO'Brien Whoops, don't know how I miscounted that...

You can do a=/^((si|ta|l)n?|co?|log?|[ste])+$/;a.test for 42 bytes.  I believe this is allowed, because a.test is an anonymous function.

@SeeOneRhino It is, but it's not really allowable because f=a.test doesn't work. I wonder if it's acceptable to call with the alternate name a.test though...

@ETHproductions I tried it on Chrome Dev Console. It worked.

@SeeOneRhino Does f=/abc/.test; f("abc") work?

You could do s|t|e instead of [ste]; might be faster. But I bet there´s nothing shorter.

@ETHproductions No. Sorry, I thought it worked. It keeps giving an "incompatible type reciever" error.

@SeeOneRhino That's OK, thanks for suggesting it anyway. I've tried that in the past, but while it works in some other languages, it does not in JS...

You can add your bounty to http://meta.codegolf.stackexchange.com/q/5243/40929

@ETH Are you still awarding a bounty?

Pyth, 37 33 29 28 bytes
The code contains an unprintable character, so here is an xxd hexdump.
00000000: 737d 5173 4d5e 733c 5252 6336 2e22 6174  s}QsM^s<RRc6."at
00000010: 14d0 69ba 76f1 ac59 6422 346c            ..i.v..Yd"4l

Try it online.
Extremely Astronomically inefficient. The time and space complexity is O(16n) O(24n).
Explanation
First, a Q is implicitly appended.
s}QsM^s<RRc6."…"4lQ     Implicit: Q = input
            ."…"        Generate "logsincostanlnee"
          c6            Split in 6 parts: ["log", "sin", "cos", "tan", "ln", "ee"]
         R      4       For each n from 0 to 3
       <R               Take the first n chars from each string
      s                 Flatten the results
                 lQ     Get length of input
     ^                  Take that Cartesian power of the list
   sM                   Join each resulting list
 }Q                     Check if the input is found
s                       Cast to integer

The OP has clarified; you don't need the s.

Jelly, 32 31 30 28 26 bytes
ŒṖw@€€“¡Ṡ[ẈKœịḲ-¢ȧ?-»’%3ḌẠ

Outputs 0 if the word is typeable, 1 if not. Thanks to @JonathanAllan for golfing off 1 byte!
Try it online!
How it works
ŒṖw@€€“¡Ṡ[ẈKœịḲ-¢ȧ?-»’%3ḌẠ  Main link. Argument: s (string of lowercase letters)

ŒṖ                          Yield all partitions of s.
      “¡Ṡ[ẈKœịḲ-¢ȧ?-»       Yield "sine  logcostanln". Every third character
                            marks the start of a typeable word.
  w@€€                      Find the indices of all substrings in the partitions
                            in the string to the right (1-based, 0 if not found).
                     ’      Decrement. "Good" indices are now multiples of 3.
                      %3    Modulo 3. "Good" indices are mapped to 0, "bad"
                            indices are mapped to 1 or 2.
                        Ḍ   Convert from decimal to integer. A partition will
                            yield 0 iff all indices are "good".
                         Ạ  All; yield 0 if one or more integers are falsy (0), 1
                            if all integers are truthy (non-zero).

Brachylog, 33 bytes
Fixed a bug thanks to @Synoli.
~c:1a
,"sincostanloglneeee"@6e@[?

Try it online!
Outputs true. if typeable or false. otherwise.
Explanation
We try deconcatenations of the input until we find one for which all strings that we concatenate are a prefix of one of ["sin", "cos", "tan", "log", "lne", "eee].
~c                          A list of strings which when concatenated results in the Input
  :1a                       All strings of this list satisfy the predicate below:

,"sincostanloglneeee"@5           The list ["sin", "cos", "tan", "log", "lne", "eee"]
                       e          Take one element of that list
                        @[?       The input is a prefix of that element

Why the . after true?

@KritixiLithos In SWI-Prolog when a query is true it prints true. and false. otherwise. i just reimplemented this: if the output is ignored (as it is here) and there is no writing to STDOUT, then it will print true. or false. depending on whether the main predicate succeeds or fails. It has a dot in SWI-Prolog because true. and false. are actually valid programs which always succeeds/always fails.

How does this solution work without tan explicitly appearing in the list?

@Synoli It doesn't. I fixed it at the cost of 3 bytes, thanks.

Perl 6,  60 50  44 bytes
first attempt (60)
put +?(get~~/^<{<sin cos tan ln log e>».&{|m:ex/^.+/}}>*$/)

translation of the Perl 5 answer (50)
put +?(get~~/^[s[in?]?|co?|t[an?]?|ln?|log?|e]*$/)

using -n switch (43+1)
put +?/^[s[in?]?|co?|t[an?]?|ln?|log?|e]*$/

The first ? converts the result to Boolean, and the first + converts that to a number (1 for True, 0 for False)

Python 3, 154 bytes
r=1;i=input()
while r:
 r=0
 for s in'sin,cos,tan,log,ln,co,lo,si,ta,s,c,t,l,e'.split(','):
  if i.startswith(s):r=i=i.replace(s,'',1);break
print(i=='')

Try it online!

You might need to check indentation, I had to edit the code to make it work

@george, weird, I tried in IDLE and the online compiler, and both seem to work

Wonder, 41 bytes
!.(mstr"^(s|t|co?|(l|ta|si)n?|log?|e)+$")

Usage:
(!.(mstr"^(s|t|co?|(l|ta|si)n?|log?|e)+$")) "tasteless"

Totally misunderstood the question before, but now it's all fixed.
Outputs F for match and T for no match.
Noncompeting, 35 bytes
!.`^(s|t|co?|(l|ta|si)n?|log?|e)+$`

Usage:
(!.`^(s|t|co?|(l|ta|si)n?|log?|e)+$`) "tasteless"

This makes use of applicable regexes, which was implemented after this challenge.

From my understanding, you can only delete the last character in the calculator, which means n in not typable but sin and ln are.

This regex detects sa as true

This fails the test case got.

I believe it's fixed.

The ? make the sub expression docile; see http://www.rexegg.com/regex-quantifiers.html#cheat_sheet. But even making it greedy with ?? or possessive with ?+ doesn´t work for some reason (at least in PHP). coelostats triggers the trap (at lo and ta).

Is there a... problem? I'm pretty sure coelostats is typable. If there is another test case that this code fails on, let me know.

Mathematica, 101 bytes
If[StringMatchQ[#,("sin"|"si"|"s"|"cos"|"co"|"c"|"tan"|"ta"|"t"|"ln"|"l"|"log"|"lo"|"e")..],"T","F"]&

It seems that the hard parts of this challenge are coming up with the shortest regex and choosing the most concise language to match the regex. I don't have anything to contribute to the former, and Mathematica isn't good candidate for the latter since you have to use StringMatchQ and RegularExpression. What I can do is answer your P.S.: is "tasteless" the longest word that you can type?
In[1]:= f=StringMatchQ[#,("sin"|"si"|"s"|"cos"|"co"|"c"|"tan"|"ta"|"t"|"ln"|"l"|"log"|"lo"|"e")..]&;

In[2]:= Select[EntityList@"Word",f@#[[2,1]]&][[All,2,1]]//SortBy[StringLength]//DeleteDuplicates
Out[2]= {c,e,l,s,t,cc,cl,el,et,lo,si,sl,ta,te,ccc,col,cos,cot,eel,ell,eta,etc,lee,let,log,lot,sec,see,set,sic,sin,sit,tae,tan,tat,tec,tee,cell,clog,clot,coco,cole,colt,coss,cost,cote,else,less,loco,loge,loll,lose,loss,lota,sect,seel,sell,sess,seta,sett,sill,silo,silt,sine,sise,siss,site,sloe,slog,slot,stet,taco,tact,tael,talc,tale,tall,tect,tell,test,cello,close,cosec,costa,cotan,eccle,elect,elsin,ettle,loess,lotte,secle,setee,since,sleet,stale,stall,state,steel,stele,tasse,taste,tatee,teest,telco,testa,tetel,tsine,cellco,closet,coleta,collet,coltan,cosine,cosset,costal,ecesis,estate,lessee,scelet,select,sellee,sestet,settee,settle,siesta,silole,stacte,stance,stasis,tallet,tallot,taslet,tassel,tasset,tattle,tectal,teetan,tellee,testee,tsetse,celesta,cessile,cocotte,collect,costate,ecolect,ectasis,electee,sessile,sinless,sitelet,statant,tassell,tastant,testate,coestate,colessee,colocolo,cosiness,costless,electant,lossless,sceletal,siletane,statelet,tactless,tallness,telltale,telocoel,coelostat,sissiness,stateless,tasteless,tattletale}

So "tattletale" seems to be the longest by one character.

Why is this non-competing? Does the function f you define not comply with the rules of the challenge?

No, it outputs True or False rather than a single character.

Posts tagged with decision-problem are about determining True/False, so I think this is competing.

Non-competing status is reserved for submissions that use a language or language feature that didn't exist or had a bug when the challenge was posted.

Fair enough. I edited my answer to have an actual solution.

You can save a few bytes by replacing If[...,"T","F"] with Boole@....

Processing, 223 bytes
int d(String b){for(String p:"tan0log0sin0cos0ln0e".split("0"))if(p.startsWith(b))return 1;return 0;}

int l(String p){String b="";int t=1;for(char c:p.toCharArray()){b+=c;if(d(b)<1){b=c+"";t=d(b);}if(t<1)return t;}return t;}

Finally decided to do an answer without regex. To call the function, use l("tasteless");. Returns 0 for false and 1 for true.
Expanded code with explanation
int d(String b){
  for(String p:"tan0log0sin0cos0ln0e".split("0"))
    if(p.startsWith(b))
      return 1;
  return 0;
}
//main function
int l(String p){
  String b="";
  int t=1;
  for(char c:p.toCharArray()){
    b+=c;
    if(d(b)<1){
      b=c+"";
      t=d(b);
    }
    if(t<1)return t;
  }
  return t;
}

Basically, we iterate over the given string, building up b char by char. We check using d() if any of the tan,log,... start with b. If it does, then it is valid. Else, we check if the char at that position is valid and we reset b. Now if it is invalid, 0 will be returned, or else it will still be valid. At the end, if the program hasn't already returned something, then return 1.

Can't the d function return a bool?

@RomanGräf It is more bytes to use boolean than int. Also true and false require more bytes than 1 and 0

Scala, 49 bytes
s=>s.matches("(s(in?)?|co?|t(an?)?|ln?|log?|e)+")

Returns true if the given string matches the regex, false otherwise.

Python 3, 149 130 bytes
i=input()
for a in 'tan,sin,cos,log,si,co,ta,lo,lo,ln,s,c,t,l,e'.split(','):
    if a in i:
        i=i.replace(a,"")
print(not i)

edit #1: shaved 19 bytes using @Henke solution

Java 8, 55 bytes
s->return s.matches("^((si|ta|l)n?|co?|log?|[ste])+$");

Disclamer: I used ETHproductions' regex because it was many bytes shorter than mine. Full credit on the Regex to him. What I did was add 24 bytes to make it a Java function.
Returns false if the word did not fit into the Regex, else true.

PHP, 60 bytes
<?=preg_match("#^((si|ta|l)n?|co?|log?|s|e|t)+$#",$argv[1]);

regex stolen from ETHproductions:
takes input from command line argument; prints 1 for typable, 0 for not typeable.
older versions, 75 73 69 bytes
<?=!preg_replace("#co|log|ln|lo|sin|si|tan|ta|[celst]#","",$argv[1]);

replaces all possible words with empty string, returns the result, negates.
<?=!preg_split("#co|log|ln|lo|sin|si|tan|ta|[celst]#",$argv[1],-1,1);

splits input by regex matches. Flag 1 stands for PREG_SPLIT_NO_EMPTY and tells preg_split to only return non-empty results. If input is typable, preg_split will only have empty results, so it will return an empty array, which is falsy. ! negates the result.
Both versions take input from command line argument
and print 1 if result is empty (input is typable), else nothing.
Notes:
Packing the regex using ? does not work here; it renders the expressions ungreedy; probably due to backtracking. And the order of the alternatives is important: ta has to stand before t or the engine will stop matching when it finds t.
I found a quantifier cheat sheet, thought ?? or ?+ might help; but they did not work for me.

Python 2, 124 bytes
f=lambda w:any(f(w[len(s):])if w[:len(s)]==s else 0for s in'sin,cos,tan,log,ln,co,lo,si,ta,s,c,t,l,e'.split(','))if w else 1