Linear Regression on a String This challenge is a little tricky, but rather simple, given a string s:

meta.codegolf.stackexchange.com

Use the position of the character in the string as an x coordinate and the ascii value as a y coordinate. For the above string, the resultant set of coordinates would be:

0, 109
1, 101
2, 116
3, 97
4, 46
5, 99
6, 111
7, 100
8, 101
9, 103
10,111
11,108
12,102
13,46
14,115
15,116
16,97
17,99
18,107
19,101
20,120
21,99
22,104
23,97
24,110
25,103
26,101
27,46
28,99
29,111
30,109

Next, you must calculate both the slope and the y-intercept of the set you've garnered using Linear Regression, here's the set above plotted:

Which results in a best fit line of (0-indexed):

y = 0.014516129032258x + 99.266129032258

Here's the 1-indexed best-fit line:

y = 0.014516129032258x + 99.251612903226

So your program would return:

f("meta.codegolf.stackexchange.com") = [0.014516129032258, 99.266129032258]

Or (Any other sensible format):

f("meta.codegolf.stackexchange.com") = "0.014516129032258x + 99.266129032258"

Or (Any other sensible format):

f("meta.codegolf.stackexchange.com") = "0.014516129032258\n99.266129032258"

Or (Any other sensible format):

f("meta.codegolf.stackexchange.com") = "0.014516129032258 99.266129032258"

Just explain why it is returning in that format if it isn't obvious.

Some clarifying rules:

- Strings are 0-indexed or 1 indexed both are acceptable.
- Output may be on new lines, as a tuple, as an array or any other format.
- Precision of the output is arbitrary but should be enough to verify validity (min 5).

This is code-golf lowest byte-count wins.

Octave, 29 26 24 20 bytes
@(s)s/[!!s;1:nnz(s)]

Try it Online!
We have the model
y= intercept *x^0 + slope * x
 = intercept * 1  + slope * x

Here y is the  ASCII value of string s
To find parameters intercept and slope we can form the following equation:
s = [intercept slope] * [1 X]

so
[intercept slope] = s/[1 x]

!!s converts a string to a vector of ones with the same length as the string.
The vector of ones is used for estimation of the intercept.
1:nnz(s) is range of values from 1 to number of elements of the string used as x.
Previous answer
@(s)ols(s'+0,[!!s;1:nnz(s)]')

For test paste the following code into Octave Online
(@(s)ols(s'+0,[!!s;1:nnz(s)]'))('meta.codegolf.stackexchange.com')

A function that accepts a string as input and applies ordinary least squares estimation of model y = x*b + e
The first argument of ols is y that for it we transpose the string s and add with number 0 to get its ASCII code.


User Appreciation Challenge #1: Dennis ♦ I got the spontaneous idea of making a series of challenges of users that have helped and continue to help the PPCG community be an enjoyable place for everyone, or maybe just specifically for me. :P

If you convert Dennis's name to an array of 1s and 0s where each consonant is 1 and each vowel is 0, the array is [1, 0, 1, 1, 0, 1], which is symmetrical. Thus, your challenge is to determine what other names are like this.

Challenge

Given an ASCII string, remove all characters that aren't letters and determine if the configuration of vowels and consonants are symmetrical. y is not a vowel.

Please note that your program does not have to be this type of string itself.

Test Cases

Dennis -> truthy
Martin -> truthy
Martin Ender -> truthy
Alex -> falsy
Alex A. -> truthy
Doorknob -> falsy
Mego -> falsy

Reference Implementation

This Python 3 code will give the correct output given a test case. It is as ungolfed as I could make it without being ridiculous.

Python 3

s = input()
l = []
for c in s:
	if c in 'AEIOUaeiou':
		l.append(0)
	elif c in 'BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz':
		l.append(1)
print(l == list(reversed(l)), end = '')

Try it online!

Jelly, 11 bytes

ŒufØAe€ØCŒḂ

Try it online!

Alternate versions:

ŒlfØae€ØCŒḂ

ŒufØAe€ØcŒḂ

ŒlfØae€ØcŒḂ

Of course a challenge appreciating Dennis must have an answer in a language of his.


Get string "-" with JavaScript using only the symbols from "+[]" Challenge: Get the JavaScript string value containing only the "-" character using code only containing the following three symbols: +[]. Note: I'm not sure if this is possible.
Scoring criterion: The number of bytes of code used.
Why? I've set myself a challenge to be able to write code using only the above three characters that can evaluate to ANY JavaScript number. The only thing left I am missing is having access to the "-" character. Once I have this, everything else becomes possible. This question is what gave me inspiration for this.
Definitions
Here is a list of definitions I've so far come up with to write a JavaScript expression (on the left) using only the +[] symbols (on the right). Most definitions reuse existing definitions.

0: +[]
1: ++[[]][0]
(EXPR): [EXPR][0]
1: (1)
2: 1+1
3: 1+2
4: 1+3
5: 1+4
6: 1+5
7: 1+6
8: 1+7
9: 1+8
POSITIVE_INTEGER: +((DIGIT1+"")+DIGIT2+DIGIT3+...)
"": []+[]
EXPR+"": EXPR+[]
undefined: [][0]
"undefined": undefined+""
"undefined": ("undefined")
"u": "undefined"[0]
"n": "undefined"[1]
"d": "undefined"[2]
"e": "undefined"[3]
"f": "undefined"[4]
"i": "undefined"[5]
NaN: +undefined
"NaN": NaN+""
"N": "NaN"[0]
"a": "NaN"[1]
Infinity: +(1+"e"+3+1+0)
"Infinity": Infinity+""
"I": "Infinity"[0]
"t": "Infinity"[6]
"y": "Infinity"[7]
"function find() { [native code] }": ([]["f"+"i"+"n"+"d"]+"")
"c": "function find() { [native code] }"[3]
"(": "function find() { [native code] }"[13]
")": "function find() { [native code] }"[14]
"{": "function find() { [native code] }"[16]
"[": "function find() { [native code] }"[18]
"a": "function find() { [native code] }"[19]
"v": "function find() { [native code] }"[22]
"o": "function find() { [native code] }"[17]

Unfinished definitions
These definitions contain missing pieces, highlighted in red (never mind, I can't figure out how to change the color, I'll use italics for now).

Number: 0["constructor"]
OBJ.FUNC(): +{valueOf:OBJ.FUNC}
OBJ.FUNC(): {toString:OBJ.FUNC}+""
"-": (Number.MIN_SAFE_INTEGER+"")[0]
"-": (Number.NEGATIVE_INFINITY+"")[0]
"-": (Number.MIN_VALUE+"")[2]
"-": ("".indexOf()+"")[0]
".": (+"1e-1")[1]

Thanks to the amazing answers to this question, I've created a JSFiddle that can generate any JavaScript number using those 3 characters. Input a number, tap "Go!", and then copy and paste the JavaScript into your devtools console to see it in action. You can also hover over the generated output in the explanation section for details on how it works.


Golf the Inverse of Exponential Generating Function Earlier, we talked about exponential generating functions (e.g.f.).

Task

You will take a few terms of a sequence.

Your task is to find another sequence with that many terms, whose e.g.f., when multiplied to the original e.g.f., would be exactly the constant function 1 accurate to that many terms.

That is, given a0=1, a1, a2, ..., an, find b0=1, b1, b2, ..., bn such that a0 + a1x + a2x^2/2! + a3x^3/3! + ... + anx^n/n! multiplied by b0 + b1x + b2x^2/2! + b3x^3/3! + ... + bnx^n/n! equals 1 + O(x^(n+1)).

Specs

They will start at the zeroth power and will be consecutive.
The first term is guaranteed to be 1.
All the terms are guaranteed to be integers.
There will not be negative powers.

Testcases

Input : 1,0,-1,0,1,0,-1,0 (this is actually cos x)
Output: 1,0, 1,0,5,0,61,0 (this is actually sec x)

Input : 1, 2, 4, 8, 16, 32 (e^(2x))
Output: 1,-2, 4,-8, 16,-32 (e^(-2x))

Input : 1,-1,0,0, 0,  0,  0 (1-x)
Output: 1, 1,2,6,24,120,720 (1/(1-x) = 1+x+x^2+...)

Julia, 91 81 77 bytes

!v=(b=[1;0v[r=2:end]];for i=r,j=0:i-2 b[i]-=binomial(i-1,j)v[i-j]b[j+1]end;b)

Usage: ![1 0 -1 0 1 0 -1 0]

Saved 4 bytes thanks to Dennis!

This is a fairly straightforward implementation - it uses the fact that the "exponential" part causes a binomial to appear in the solution. Otherwise, it's just solving for the relevant coefficients.


Newtons Method by Recursive Quines Your task is to calculate the square root of 2 using Newton's Method - with a slight twist. Your program is to calculate an iteration using Newton's Method, and output the source code for the following iteration (which must be able to do the same).

Newton's method is fairly exhaustively described on Wikipedia

To calculate square root 2 using Newtons method, you:

Define f(x) = x^2 - 2
Define f'(x) = 2x
Define x[0] (the initial guess) = 1
Define x[n+1] = x[n] - (f[n] / f'[n])

Each iteration will move x[n] closer to the square root of two. So -

x[0] = 1
x[1] = x[0] - f(x[0])/f'(x[0]) = 1 - (1 ^ 2 - 2) / (2 * 1) = 1.5
x[2] = x[1] - f(x[1])/f'(x[1]) = 1.5 - (1.5 ^ 2 - 2) / (2 * 1.5) = 1.416666667
x[3] = x[2] - f(x[2])/f'(x[1]) = 1.416666667 - (1.416666667 ^ 2 - 2) / (2 * 1.416666667) = 1.414215686
and so on

Your program will:

Calculate x[n] where n is the amount of times the program has been run
Output the source code to a valid program in the same language which must calculate x[n+1] and satisfy the same criteria of this question.
The first line of the source code must be the calculate result, properly commented. If the source requires something particular (such as a shebang) on the first line, the result may be put on the second line.

Note that

Your program must use an initial guess of x[0] = 1
The Standard Loopholes apply
Any in-build power, square root or xroot functions are forbidden
Your program must not accept any input whatsoever. It must be entirely self contained.

Your score is the size of your initial program in UTF-8 bytes. The lowest score wins.

Common Lisp, 223 95 68 66
(#1=(lambda(x p)(format t"~S~%~S"p`(,x',x,(+(/ p 2)(/ p)))))'#1#1)

Now that I read the problem statement more carefully (thanks, primo!) I noticed that the first line must be the result of calculation, not that it needs to contain the result. Thus, I think my earlier attempts did not quite follow the rules. This one should.
Example use (SBCL 1.1.15):
$ sbcl --script nq.lisp | tee nq2.lisp
1
((LAMBDA (X P) (FORMAT T "~S~%~S" P `(,X ',X ,(+ (/ P 2) (/ P)))))
 '(LAMBDA (X P) (FORMAT T "~S~%~S" P `(,X ',X ,(+ (/ P 2) (/ P))))) 3/2)
$ sbcl --script nq2.lisp | tee nq3.lisp
3/2
((LAMBDA (X P) (FORMAT T "~S~%~S" P `(,X ',X ,(+ (/ P 2) (/ P)))))
 '(LAMBDA (X P) (FORMAT T "~S~%~S" P `(,X ',X ,(+ (/ P 2) (/ P))))) 17/12)
$ sbcl --script nq3.lisp | tee nq4.lisp
17/12
((LAMBDA (X P) (FORMAT T "~S~%~S" P `(,X ',X ,(+ (/ P 2) (/ P)))))
 '(LAMBDA (X P) (FORMAT T "~S~%~S" P `(,X ',X ,(+ (/ P 2) (/ P))))) 577/408)
$ sbcl --script nq4.lisp | tee nq5.lisp
577/408
((LAMBDA (X P) (FORMAT T "~S~%~S" P `(,X ',X ,(+ (/ P 2) (/ P)))))
 '(LAMBDA (X P) (FORMAT T "~S~%~S" P `(,X ',X ,(+ (/ P 2) (/ P)))))
 665857/470832)
$ sbcl --script nq5.lisp | tee nq6.lisp
665857/470832
((LAMBDA (X P) (FORMAT T "~S~%~S" P `(,X ',X ,(+ (/ P 2) (/ P)))))
 '(LAMBDA (X P) (FORMAT T "~S~%~S" P `(,X ',X ,(+ (/ P 2) (/ P)))))
 886731088897/627013566048)
$


As programmers say: Strive to be lazy Story
Have you seen this post from 9gag?
Maybe you got the feeling to make your own sentences. But then you realize that you could just golf a script in half an hour, and you will never have to deal time with that.
The submission
Your program will get an input string which it will return with added quotation marks as explained below.
Standard loopholes are forbidden. Output as a list of lines is allowed. Trailing spaces and empty lines that don't break the output are allowed.
The rules of input

The input only contains printable ASCII characters.
The input may contain spaces. The words are determined with them.
It's guaranteed that a space will never be followed by another space.
The case of no input or empty string doesn't matter.

The rules of output
If one word is given then the program has to return the string between quotation marks.
If the input string has 2 or more words, it first returns the initial input, but the first word is in quotation marks. Then on the next line, it returns the initial input, but with the second word in quotes. And so on for the remaining words.
In general, the program has to return as many lines as there are words in the input.
Examples:
test -> "test"

This is codegolf -> "This" is codegolf
                    This "is" codegolf
                    This is "codegolf"

This is a significantly longer, but not the longest testcase -> "This" is a significantly longer, but not the longest testcase
                                                                This "is" a significantly longer, but not the longest testcase
                                                                This is "a" significantly longer, but not the longest testcase
                                                                This is a "significantly" longer, but not the longest testcase
                                                                This is a significantly "longer," but not the longest testcase
                                                                This is a significantly longer, "but" not the longest testcase
                                                                This is a significantly longer, but "not" the longest testcase
                                                                This is a significantly longer, but not "the" longest testcase
                                                                This is a significantly longer, but not the "longest" testcase
                                                                This is a significantly longer, but not the longest "testcase"

Here is an another one -> "Here" is an another one
                          Here "is" an another one
                          Here is "an" another one
                          Here is an "another" one
                          Here is an another "one"

This is code-golf, so the least byte answer wins!

vim, 38 bytes

:s/"/<C-d>/g
qqysW"Ypds"W@qq@qdk:%s/<C-d>/"/g

Try it online!

Requires the vim-surround plugin.

If the input does not contain " characters, this can be done in 19 bytes:

qqysW"Ypds"W@qq@qdk

Here, we record a recursive macro (qq ... @qq@q) that surrounds a word with quotation marks (ysW"), duplicates the line (Yp), deletes the quotation marks (ds"), and moves to the next word (W) before calling itself recursively. After it terminates, there are two extraneous lines, which are deleted with dk.

The full solution simply wraps this with :s/"/<C-d>/g at the beginning, which replaces existing " characters with an unprintable character, and :%s/<C-d>/"/g at the end, which undoes the replacement.


Mutually Exclusive Quines Your challenge is simple. Write two programs that share no characters which output each other.

Example

Two programs P and Q are mutually exclusive quines if:

P outputs Q
Q outputs P
There is no character c which belongs to both P and Q
Each program P and Q are proper quines

This counts empty quines and quines that read their own (or the other's) source code as invalid.

More rules

The shortest combined length of these programs wins. That is, size(P) + size(Q) is your score, and the lowest score wins.
Both programs are in the same language
Each program may be a full program or function, and they need not be the same.

For example, P may be a full program and Q may be a function.

Verification

This Try it online! snippet here can verify whether or not two programs are mutually exclusive. The inputs are put in the first two arguments.

><>, Score: 41+41 = 82

Edit: both contained a 3. Fixed

'd3*}>a!o-!<<8:5@lI55>@z:5ll55>>q:>|q::|,

and

"r00gr40g44++bb+0p64++?b6+0.22#eW4s )Z

Try it online! (swap the lines to get the other output) With verification this time!

><> is an especially hard language to use here, as there is only one way to output characters, the command o. Fortunately, we can use the put command to place an o in the source code during execution, like in my Programming in a Pristine World answer.

This one took a lot of trial and error. I started off with the two mutually exclusive programs:

'd3*}>N!o-!<<data

and

"r00gr40g8+X0pN+?Y0.data

Each one transforms itself and its data by N, the first one subtracting and the second adding. It then outputs this in reverse. The point is that the data after each program is the other program in reverse, shifted by N. (X is the cell number where the program needs to put the o and Y is the cell where the pointer loops back to. ? is where the o is put).

Both follow the same structure, represented in different ways. They run a string literal over the entire code, adding it to the stack. They recreate the string literal command they used and put it at the bottom of the stack. They loop over the stack, adding/subtracting N to each character and printing them.

The first program uses ' as the string literal, and the simple d3*} to create the value 39 and push it to the bottom of the stack. The second uses " as the string literal with the same function. It reverses the stack, gets the character at cell 0,0 and reverses the stack again. It then gets the value at cell 4,0 (g) and adds 8 to it to get o and puts that at X.

Both programs use a different method of looping. The first program uses the skip command (!) to run only half the instructions while going left, reverses direction and runs the other half. The second uses the jump command (.) to skip backwards to the start of the loop at cell Y. Both of these run until there are no more items on the stack and the program errors.

I ran into a number of problems with most of the lower values of N, because shifting one character would turn it into another character essential for that program (and therefore couldn't be used as data for the other program) or two characters from the two programs would shift into the same character. For example:

++1 = , = --1
.+2 = 0
* = --3
g+4 = k =  o-4

etc.

Eventually I got to 10 (a), where I was able to avoid these issues. There might be a shorter version where the shifts are reversed, and the first program is adding N while the second subtracts it. This might be worse off though, as the first program is generally on the lower end of the ASCII scale, so subtracting is better to avoid conflicts.


The sequence of self-contained numbers Let's define a self-contained number as a positive integer, whose digits appear in runs of length equal to themselves only. In other words, any decimal digit d (excluding 0) occurs only in runs of length exactly d.
Task
You can choose any of the three methods listed below:

Given an integer n, output the nth (either 0 or 1-indexed) self-contained number.
Given an integer n, output the first n self-contained numbers.
Print the sequence indefinitely.

Examples

133322 is a self-contained number because 3 appears in a run of three 3's, 1 is single and 2 occurs in a run of two 2's.

On the other hand, 35553355 isn't, because, although 5 and 3 occur five and three  times respectively, they do not form runs of adjacent digits.

44422 is not self-contained, because 4 only occurs three times.

12222333 isn’t either, because 2 appears in a run of four 2's, and it cannot be treated as two separate runs of two 2's.

Not surprisingly, this is OEIS A140057, and its first few terms are:
1, 22, 122, 221, 333, 1221, 1333, 3331, 4444, 13331, 14444, 22122, 22333, 33322, 44441, 55555, 122122, 122333, 133322, 144441, 155555

You can take input and provide output through any of the standard methods, in any programming language, while noting that these loopholes are forbidden by default. This is code golf, so the shortest code in bytes (in every language) wins.

Python 2, 104 94 83 bytes

-10 bytes thanks to Mr. Xcoder
-11 bytes thanks to Jonathan Allan

i=0
while 1:
 if`i`==''.join(d*int(d)for c,d in zip(`-i`,`i`)if d!=c):print i
 i+=1

Try it online!


The modulus validation Given a list of math expressions that all hold true and consist of modulo remainder  calculations with two numbers and a result, your task is to yield the first n numbers that hold true for all the statements in the list.

For example:

[m % 3 = 0, m % 4 = 1, m % 5 = 3], where % is the modulo operator.

For n = 3, the first 3 numbers (counting from 0) that fit the sequence  are 33, 93, 153, thus your result would be that (format up to you).

Rules / IO

You take a positive number n and a list of truths. Of course, the things you need take are only the RHS of the modulo operation and the result.
n and the numbers in the list of truths will always be in the range 1 -> 2^31-1, and so are the results.
You take input in any convenient form and output in any convenient form. For example, input: 3 [3 0, 4 1, 5 3] and output: 33 93 153.
It's guaranteed that the solution is mathematically possible.
The source of input can be from a file, function parameters, stdin, etc... Same goes for the output.
No loopholes.
This is code-golf, so the lowest byte count wins.

Testcases

# Input in the form <n>, <(d r), (d2 r2), ...>
# where <d> = RHS of the modulo expression and <r> the result of the expression. Output in the next line.

5, (3 2), (4 1), (5 3)
53 113 173 233 293

3, (8, 0), (13, 3), (14, 8)
120 848 1576

Reference implementation in pseudo-code

n = (an integer from stdin)
truths = (value pairs from stdin)
counter = 0

while n != 0 {
    if matches_criterias(counter, truths) {
        print counter
        n -= 1
    }

    counter += 1
}

Jelly, 7 bytes

%⁼⁴
0ç#

This is a full program. Arguments are divisors, target moduli, and number of solutions, in that order.

Try it online!

How it works

0ç#  Main link.
     Left argument: D (array of divisors)
     Right argument: M (array of target moduli)
     Third argument: n (number of solutions)

0ç#  Execute the helper link with k = 0, 1, 2, ... as left argument and D as the
     right one until n of them return 1. Yield the array of matches.

%⁼⁴  Helper link. Left argument: k. Right argument: D

%    Compute k % d for each d in D.
 ⁼⁴  Compare the result with M.


Last digit large number For a given list of number \$[x_1, x_2, x_3, ..., x_n]\$ find the last digit of \$x_1 ^{x_2 ^ {x_3 ^ {\dots ^ {x_n}}}}\$
Example:

[3, 4, 2] == 1
[4, 3, 2] == 4
[4, 3, 1] == 4
[5, 3, 2] == 5

Because \$3 ^ {(4 ^ 2)} = 3 ^ {16} = 43046721\$.

Because \$4 ^ {(3 ^ 2)} = 4 ^ {9} = 262144\$.

Because \$4 ^ {(3 ^ 1)} = 4 ^ {3} = 64\$.

Because \$5 ^ {(3 ^ 2)} = 5 ^ {9} = 1953125\$.

Rules:

This is code golf, so the answer with the fewest bytes wins.

If your language has limits on integer size (ex. \$2^{32}-1\$) n will be small enough that the sum will fit in the integer.

Input can be any reasonable form (stdin, file, command line parameter, integer, string, etc).

Output can be any reasonable form (stdout, file, graphical user element that displays the number, etc).

Saw on code wars.

JavaScript (ES7), 22 bytes
Limited to \$2^{53}-1\$.

a=>eval(a.join`**`)%10

Try it online!


Twist on words to numbers The Goal
The goal of this question is to put a twist on this question. Your answer should be able to convert an array of words associated with integers into those integers. As an extra challenge, allow support for  , +, -, and _ in between numbers such as sixty seven, sixty+seven, sixty-seven, or sixty_seven.
Examples
General Example: one, twenty-two, eleven, thirty+five, forty eight => 1, 22, 11, 35, 48.
General Example: ninety_two, eighty one, zero, seventy+seven, nine => 92, 81, 0, 77, 9.
Javascript/Node.JS Example: ['five', 'twenty+eight', 'fifty_two', 'thirty', 'zero'] => [5, 28, 52, 30, 0]
Assumptions

There are no negative numbers
The applicable numbers only need to be 0-99
The array will not be empty

Scoring
As this is code-golf, let the answer with the fewest amount of bytes win. Good luck.


Graph Florets of a Flower Take a look at this chamomile flower:

Pretty, isn't it? Well, what if I told you that this wasn't actually one flower?

A lot of flowers (including sunflowers, chamomiles, daisies and others) actually consist of many very small flowers (the black dots on sunflowers) on a flower head. These miniature flowers are called florets, and they are arranged in a very special way.

Basically, the nth floret's position on a flower head is (in polar coordinates):

where c = 1 (Note that 137.508 degrees = golden angle. You don't have to use this exact precision.)

This causes the florets to be formed in a spiral called Fermat's Spiral. The positioning of the florets also is connected with Fibonnaci numbers, but that's a tale for another time.

So, here's the challenge. Given an integer n as input, calculate the positions of the first n florets and plot them. This is graphical-output, so I do actually want you to display the points in either a window of some sort or outputted as data in some common image format to STDOUT or a file. Other than that, this challenge should be fairly straightforward. It's code-golf, so shortest code wins. GLHF!

Here is a sample picture of what an output might look like:

TI-BASIC, 34 bytes
For the TI-83+/84+ series of calculators.
Input N
2πe^(-2sinh⁻¹(.5→θstep
AnsN→θmax
"√(θ→r₁
Polar                      ;Displays polar mode graphs to graph screen
Dot                        ;Prevents lines from connecting points
DispGraph                  ;Displays graph screen

This considers the dot at the origin to be the 0th dot.
Thanks to the one-byte sinh⁻¹( token, 2πe^(-2sinh⁻¹(.5 is a short way of getting the golden angle in radians. This is derived from the fact that e^(sinh⁻¹(.5 is the golden ratio.
Here are screenshots for N=50.
(Yes, that's a 96x64 monochrome display on a TI-84+. The newer color calculators have a resolution upgrade, but still have only 3.7% the pixels of an iPhone.)

Press TRACE to step through each point.


Minimum operations to get from one number to another Let's define a simple language that operates on a single 8-bit value.
It defines three bitwise operations (code explanation assumes 8-bit value variable):

! Negate the least significant bit (value ^= 1)
< Wrapping left-shift (value = value << 1 | value >> 7)
> wrapping right-shift (value = value >> 1 | value << 7)

Input:
Two 8-bit numbers, a and b. As they are 8-bit, you can alternatively take them as characters.
Output:
The shortest way to get from a to b, with the three operations defined above.
You can return a string or an array of characters, or define a constant, distinct values for each operation and return an array of those (yes, you could also say < means > and > means <), but please explain your output format in your answer.
If there are multiple, equally long ways, you can output any or all of them.
Rules:

You can submit a program or function
Standard loopholes apply
The submission with fewest bytes in each language wins (no answer will be accepted)

Solutions without brute-forcing (or at least not only brute-forcing) might get my upvote.
Test cases:
12, 13 => '!'
1, 2 => '<'
254, 253 => '<'
5, 5 => ''
98, 226 -> '<!>'
64, 154 -> '!>!>>>!>'
177, 164 -> '!>>!>>>!'
109, 11 -> '>>!>!>>'
126, 92 -> '!>!>!>!<' or '!>!>>!<!'
26, 85 -> '<!<<!<!<' or '<!<<!<!>' or '<!<<<!>!'
123, 241 -> '!>!<<!' or '>!<!<!'
236, 50 -> '<<!<!>' or '<<<!>!'
59, 246 -> '<<!>'
132, 95 -> '!<<!<!<!'
74, 53 -> '!>>>!>!'
171, 127 -> '<<!<<!<'
109, 141 -> '!>>>'
185, 92 -> '!>'
166, 201 -> '!<!>>>' or '<!>!>>'
77, 155 -> '<!'
124, 181 -> '!<<<<!>>' or '!>>>>!>>'
108, 85 -> '!<<<!<!<!<' or '!<<<!<!<!>' or '!<<<!<<!>!' or '!>>>!>!>!<' or '!>>>!>!>!>' or '!>>>!>>!<!'
185, 144 -> '<!<<!<!'
70, 179 -> '<<<!<!>' or '<<<<!>!' or '>>>>!>!'

Here is a program to generate a few more.

JavaScript (ES6), 100 96 86 bytes

f=(a,b,[c,d,...e]=[a,''])=>c-b?f(a,b,[...e,c^1,d+1,c/2|c%2<<7,d+2,c%128*2|c>>7,d+0]):d
<div oninput=o.textContent=f(a.value,b.value).replace(/./g,c=&gt;`&lt;!&gt;`[c])>a: <input type=number min=0 max=255 value=0 id=a> b: <input type=number min=0 max=255 value=0 id=b>

Somewhat slow breadth-first search without double-checking. Slightly more efficient 114-byte version:

f=(a,b,c=[],[d,e,...g]=[a,''])=>c[d]?f(a,b,c,g):d-b?f(a,b,c,[...g,d^1,c[d]=e+1,d/2|d%2<<7,e+2,d%128*2|d>>7,e+0]):e
<div oninput=o.textContent=f(a.value,b.value).replace(/./g,c=&gt;`&lt;!&gt;`[c])>a: <input type=number min=0 max=255 value=0 id=a> b: <input type=number min=0 max=255 value=0 id=b>

Both versions encode <!> as 012 but the snippets decode this for you. Edit: Saved 10 utterly useless bytes thanks to @RickHitchcock.


Underhanded contest: The OS war We all know how the discussion about which is the best operating system caused a lot of flame-wars. Your goal is now, to provide decisive "proof" that your favorite operating system is better... ah, no, much better, to provide decisive "proof" that another operating system is bad.

The task:
Write a program, that does some calculations, and it works correctly on at least one OS and incorrectly on at least another one.

the program should do at least some calculations, so it has to read some simple input (preferably on the standard input, or if from files if you want, but misusing little endian/big endian would not only be cheap, but also obvious), and provide some output depending on the input. The calculations should be meaningful and justified, for example solving a real life or a mathematical problem.
you should specify both operating systems, stating on which one it will work correctly, and on which one it won't. Both operating systems should be well known, and from roughly the same time (so no DOS 1.0 versus a modern OS). It is advised to provide a short description about the cause of the difference (especially if you suspect many people would not realize it) in spoiler tags.

   like this

the cause of the difference has to be subtle, so no #ifdef _WIN32 or similar, please! Remember, your goal is to "prove" that this specific system is bad, so people should not be able to (immediately) spot your trick!
if there is a very strange or very unusual part in your code, you have to justify it in comments why it is there. Of course, this "justification" can/will be a big lie.

Scoring:

This is not a golf! The code should be well organized, and kept simple. Remember, your goal is to hide a bug into it so that people won't suspect it. The simpler the code, the less suspicious it is.

The winner will be decided by votes. The most votes after approximately 10 days after the first valid submission wins. Generally, answers where the code is easy to read and understand, yet the bug is well hidden, and even if discovered, can be attributed to a mistake rather than malice, should be voted up. Similarly, it should be worth much more if the bug just causes an incorrect result, rather than just causing the program to crash or to not do anything.

As usual, I withhold the right to choose an answer as a winner if it is not more than either 10% or 1 point below the one with the most votes, on any subjective criteria.

Python

This program opens the image specified on the command line and displays it.

import Image
import sys

with open(sys.argv[1]) as f:
    im = Image.open(f)
    im.show()

Works on linux, does not work on windows.

This is due to the way windows opens files. Binary mode must be specified for this to work properly on all operating systems.


Prove 2+2=2*2 (and similar) Output a full formal poof of such statements such as 1+2=3, 2+2=2*(1+1) etc.

Introuction

If you know Peano Arithmetic you can probably skip this section.

Here's how we define the Natural Numbers:

(Axiom 1) 0 is a number
(Axiom 2) If `x` is a number, the `S(x)`, the successor of `x`, is a number.

Hence, for example S(S(S(0))) is a number.

You can use any equivalent representation in your code. For example, all of these are valid:

0    ""    0           ()       !
1    "#"   S(0)        (())     !'
2    "##"  S(S(0))     ((()))   !''
3    "###" S(S(S(0)))  (((()))) !'''
...
etc

We can extend the rules to define addition as follows.

(Rule 1) X+0 = X
(Rule 2) X+S(Y)=S(X)+Y

With this we can prove 2+2=4 as follows

         S(S(0)) + S(S(0)) = 2 + 2
[Rule 2 with X=S(S(0)), Y=S(0)]
         S(S(S(0))) + S(0) = 3 + 1
[Rule 2 with X=S(S(S(0))), Y=0]
         S(S(S(S(0)))) + 0 = 4 + 0
[Rule 1 with X=S(S(S(S(0))))
         S(S(S(S(0))))     = 4

We can extend these rules to define multiplication as follows

(Rule 3) X*0 = 0
(Rule 4) X*S(Y) = (X*Y) + X

Although to allow this we need to define the structural role of parentheses.

(Axiom 3) If X is a number, (X) is the same number.

Addition and multiplication operators are strictly binary and parentheses must always be explicit. A+B+C is not well-defined, but (A+B)+C and A+(B+C) are.

Example

Now we have enough to prove a theorem about multiplication: 2+2=2*2

2 + 2
(2) + 2
(0 + 2) + 2
((0*2) + 2) + 2
(1*2) + 2
2*2

Requirements

A proof that A=B is a list expressions such that:

the first is A,
the last is B, and
each expression in the list apart from the first can obtained from the previous by transforming it under one of the rules.

Your program will take two valid expressions as input, each expression contains numbers, addition, multiplication, and parentheses as defined above.

Your program will output a proof, a list as defined above, that the two expressions are equal, if such a proof exists.

If the two expressions are not equal, your program will output nothing.

Proving or disproving is always possible in a finite number of steps, because each expression can be reduced to a single number and these numbers can be trivially tested for equality.

If the input expressions are not valid (e.g. unbalanced parentheses, contains non-numbers, or non-binary operators) then your program should exit with error, throw an exception, print an error, or otherwise produce some observable behaviour which is distinct from the case in which the inputs are valid but non-equal.

In summary, the normal output for admissible inputs is a list of equal numbers, including the inputs, which is produced by the following rules.

(Axiom 1) 0 is a number
(Axiom 2) If `x` is a number, the `S(x)`, the successor of `x`, is a number.
(Axiom 3) If X is a number, (X) is the same number

(Rule 1) X+0 = X
(Rule 2) X+S(Y)=S(X)+Y
(Rule 3) X*0 = 0
(Rule 4) X*S(Y) = (X*Y) + X
(Rule 5) X = (X)              (Axiom 3 expressed as a transformation rule.)

Any suitable representation of the numbers in the input and output is allowed, e.g. 0=""=(), 3="###"=(((()))), etc. Whitespace is irrelevant.

Rules can, of course, be applied in either direction. Your program does not have to output which rule is used, just the expression produced by its action on the previous expression.

Shortest code wins.

Perl, 166 + 1 bytes
Run with -p (1 byte penalty).
$r='\((S*)';(@b,@a)=@a;push@a,$_ while+s/\+S/S+/||s/$r\+\)/$1/||s/$r\*\)//||s/$r\*S(S*)/(($1*$2)+$1/||s/$r\)/$1/;$\.=/[^S]./s;$_=$b[-1]eq$a[-1]?join'',@b,reverse@a:""

More readable:

                           # implicit: read a line of input into $_
                           # we leave the newline on
$r = '\((S*)';             # we use this regex fragment a lot, factor it out
(@b, @a) = @a;             # set @b to @a, @a to empty
push @a, $_ while          # each time round the loop, append $_ to @a
+s/\+S/S+/||               # rule 2: change "+S" to "S+"
s/$r\+\)/$1/||             # rule 1: change "(X+0)" to "X"
s/$r\*\)//||               # rule 3: change "(X*0)" to ""
s/$r\*S(S*)/(($1*$2)+$1/|| # rule 4: change "(X*Y" to "((X*Y)+X"
s/$r\)/$1/;                # rule 5: change "(X) to "X"
$\.=/[^S]./s;              # append a 1 to the newline character if we
                           # see any non-S followed by anything
$_=$b[-1]eq$a[-1]?         # if @b and @a end the same way
  join'',@b,reverse@a      # then $_ becomes @b followed by (@a backwards)
  :""                      # otherwise empty $_
                           # implicit: output $_

The input format expresses numbers in unary as strings of S, and requires the two inputs on separate lines (each followed by a newline, and an EOF after both are seen). I interpreted the question as requiring that parentheses should be literally ( ) and addition/multiplication should be literally + *; I can save a few bytes through less escaping if I'm allowed to make different choices.
The algorithm actually compares the first line of input with an empty line, the second with the first, the third with the second, and so on. This fulfils the requirements of the question. Here's an example run:
My input:

(SS+SS)
(SS*SS)

Program output:

(SSS+S)
(SSSS+)
SSSS
SSSS
(SSSS+)
((SS+)SS+)
(((SS*)SS+)SS+)
(((SS*)S+S)SS+)
(((SS*)+SS)SS+)
((SS*S)SS+)
((SS*S)S+S)
((SS*S)+SS)

The duplicated SSSS in the middle is annoying but I decided it didn't violate the specification, and it's fewer bytes to leave it in.
On invalid input, I append 1 to the newline character, so you get stray 1s sprinkled in at the end of the output.


A curious prime fraction formula Given a positive integer n output the integers a and b (forming reduced fraction a/b) such that:

Where pk is the k th prime number (with p1 = 2).

Examples:

1   -> 3, 5
2   -> 12, 25
3   -> 144, 325
4   -> 3456, 8125
5   -> 41472, 99125
15  -> 4506715396450638759507001344, 11179755611058498955501765625
420 -> very long

Probabilistic prime checks are allowed, and it's ok if your answer fails due to limitations in your language's integer type.

Shortest code in bytes wins.

Mathematica, 32 bytes

1##&@@(1-2/(Prime@Range@#^2+1))&

An unnamed function that takes integer input and returns the actual fraction.

This uses the fact that (p2-1)/(p2+1) = 1-2/(p2+1). The code is then golfed thanks to the fact that Mathematica threads all basic arithmetic over lists. So we first create a list {1, 2, ..., n}, then retrieve all those primes and plug that list into the above expression. This gives us a list of all the factors. Finally, we multiply everything together by applying Times to the list, which can be golfed to 1##&.

Alternatively, we can use Array for the same byte count:

1##&@@(1-2/(Prime~Array~#^2+1))&


Write a piece of code to output the line number of the print / output statement itself (in the form "Hello World, from line X!") The Challenge

Write a program that outputs Hello World, from line X!, where X is the line number, in the source code, of the actual print statement itself.

The Rules

In this context, we want the first line number of the statement which outputs the string to be displayed to stdout
You should avoid simply searching through your source code as a string (either file or quine) to find the line number
If any additional whitespace or statements (which do not interrupt the flow of the code) is added to the source code, it should be reflected at run-time (after compiling if applicable)

Recommendations

If provided by the language, you may use exceptions/stack traces to accomplish this goal.  Try your best to use code that is portable across different systems/implementations, but note that this is not a requirement.  Using defined variables like __LINE__, although allowed by the rules,  are discouraged.

The Winner

This is a popularity contest (ended on June 10, 2014), where the answer voted highest by the community will be declared the winner based on the current votes at the time
When voting, please consider the creativity of someone's answer, how elaborate or interesting it is. and the difficulties/constraints of the programming language being used

Sinclair Basic

10 PRINT "Hello world, from line ";PEEK 23621;"!"

  Hello world, from line 10!

This will work for any line by PEEKing at the address storing the current line number, so the following will work as well:

341 PRINT "Hello world, from line ";PEEK 23621;"!"

  Hello world, from line 341!


Compute the Matrix-Vector Given an integer array of at least two elements, output the Matrix-Vector (defined below) of the array.

To compute the Matrix-Vector, first rotate through the size-n input array to create a matrix of size n x n, with the first element of the array following the main diagonal. This forms the matrix portion. For the vector, flip the input array vertically. Then perform normal matrix multiplication. The output vector is the result.

For example,

a = [1, 2, 3]

First, rotate the array two times to the right, to obtain [3, 1, 2] and [2, 3, 1], then stack them to form a 3x3 matrix

[[1, 2, 3]
 [3, 1, 2]
 [2, 3, 1]]

Next, flip the array vertically to form the vector

[[1, 2, 3]    [[1]
 [3, 1, 2]  x  [2]
 [2, 3, 1]]    [3]]

Perform usual matrix multiplication

[[1, 2, 3]    [[1]    [[1+4+9]    [[14]
 [3, 1, 2]  x  [2]  =  [3+2+6]  =  [11]
 [2, 3, 1]]    [3]]    [2+6+3]]    [11]]

And the output is [14, 11, 11] or [[14], [11], [11]] (your choice of whether it's flattened or not).

Example #2

a = [2, 5, 8, 3]

[[2, 5, 8, 3]    [[2]    [[4+25+64+9]     [[102]
 [3, 2, 5, 8]  x  [5]  =  [6+10+40+24]  =  [80]
 [8, 3, 2, 5]     [8]     [16+15+16+15]    [62]
 [5, 8, 3, 2]]    [3]]    [10+40+24+6]]    [80]]

[102, 80, 62, 80]

Rules

The input and output can be assumed to fit in your language's native integer type.
The input and output can be given in any convenient format.
Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
If possible, please include a link to an online testing environment so other people can try out your code!
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Jelly, 5 bytes
ṙJṚæ.

Try it online!
Explanation
Firstly:
$$\left[\begin{matrix}
\vec{v}_1 \\
\vec{v}_2 \\
\vec{v}_3 \\
\vec{v}_4 \\
\end{matrix}\right] \vec{x} =
\left[\begin{matrix}
\vec{v}_1 \cdot \vec{x} \\
\vec{v}_2 \cdot \vec{x} \\
\vec{v}_3 \cdot \vec{x} \\
\vec{v}_4 \cdot \vec{x} \\
\end{matrix}\right]$$
where \$\vec{v}_k\$ are row vectors and \$x\$ is a column vector.
This demonstrates that matrix multiplication is just dot product between rows and columns.
Then, \$\vec{v}_1\$ is actually \$\vec{v}\$ rotated \$0\$ to the right, and \$\vec{v}_k\$ is \$\vec{v}\$ rotated \$k-1\$ to the right, etc.
From another angle, \$\vec{v}_1\$ is \$\vec{v}\$ rotated \$n\$ to the left, and \$\vec{v}_n\$ is \$\vec{v}\$ rotated \$1\$ to the left, etc.
How it works
ṙJṚæ.   input: z (a list of length n)
ṙJ      [rot(z,1), rot(z,2), ..., rot(z,n)] (to the left)
  Ṛ     [rot(z,n), ..., rot(z,2), rot(z,1)]
   æ.   [rot(z,n).z , ..., rot(z,2).z , rot(z,1).z] (dot product)


Which Friends characters were really the best friends? The six main cast members of the American sitcom Friends all agreed that they would be paid the same salary throughout the run of the series (after season 2, at least). But that doesn't mean that they all had the same amount of air time or that they all interacted on screen with each other the same amount.
In this challenge, you'll write a program that could help determine which Friends friends were really the best.
Setup
Consider watching an episode or scene of Friends and noting down exactly who is on screen during each camera shot and for how long.
We'll abbreviate each character's name:

C is for Chandler
J is for Joey
M is for Monica
P is for Phoebe
R is for Rachel
S is for Ross

Then for every camera shot (or every time a character enters/exits the shot), we'll list who was on screen. For example:
504 CRS
200 J
345 MP
980
2000 CJMPRS

This is saying that:

For 504ms, Chandler, Rachel, and Ross were on screen.
Then for 200ms, Joey was.
Then for 345ms, Monica and Phoebe were.
Then for 980ms, none of the 6 main characters were on screen.
Then for 2 seconds, all of them were.

(This is not from an actual clip, I made it up.)
Note that the following would be equivalent:
504 CRS
1 J
199 J
345 MP
980
2000 CJMPRS

To analyze which combinations of characters had the most screen time, we look at all 64 possible subsets of the 6 characters and total up the screen time they had. If everyone in a subset appears on screen during a camera shot, even if there are more characters than just the ones in the subset, the time for that camera shot is added to that subset's total screen time.
There's an exception for the empty subset - only the scenes with none of the 6 main characters are counted.
So the analysis of the example above would be:
980
2504 C
2200 J
2345 M
2345 P
2504 R
2504 S
2000 CJ
2000 CM
2000 CP
2504 CR
2504 CS
2000 JM
2000 JP
2000 JR
2000 JS
2345 MP
2000 MR
2000 MS
2000 PR
2000 PS
2504 RS
2000 CJM
2000 CJP
2000 CJR
2000 CJS
2000 CMP
2000 CMR
2000 CMS
2000 CPR
2000 CPS
2504 CRS
2000 JMP
2000 JMR
2000 JMS
2000 JPR
2000 JPS
2000 JRS
2000 MPR
2000 MPS
2000 MRS
2000 PRS
2000 CJMP
2000 CJMR
2000 CJMS
2000 CJPR
2000 CJPS
2000 CJRS
2000 CMPR
2000 CMPS
2000 CMRS
2000 CPRS
2000 JMPR
2000 JMPS
2000 JMRS
2000 JPRS
2000 MPRS
2000 CJMPR
2000 CJMPS
2000 CJMRS
2000 CJPRS
2000 CMPRS
2000 JMPRS
2000 CJMPRS

We can see that J (just Joey) had 2200ms of screen time because he had 200 by himself and 2000 with everyone.
Challenge
Write a program that takes in a string or text file such as
504 CRS
200 J
345 MP
980
2000 CJMPRS

where each line has the form [time in ms] [characters on screen], and outputs the total amount of time that each of the 64 subsets of the 6 characters spent on the screen, where each line has the form [total time in ms for subset] [characters in subset] (just as above).
The input can be taken as a string to stdin, the command line, or a function, or it can be the name of a text file that contains the data.

The milliseconds numbers will always be positive integers.
The character letters will always be in the order CJMPRS (alphabetical).
You can optionally assume there is a trailing space when there are no characters in the scene (e.g. 980 ).
You can optionally assume there is a trailing newline.
The input will have at least 1 line and may have arbitrarily many.

The output should be printed or returned or written to another text file as a 64 line string.

The lines may be in any order.
The character letters do not need to be in the CJMPRS order.
Subsets with 0ms total time do need to be listed.
There may optionally be a trailing space after the empty subset total.
There may optionally be a trailing newline.

(This problem can of course be generalized to more characters, but we'll stick with the 6 CJMPRS Friends characters.)
The shortest code in bytes wins.
Note that I actually enjoy Friends and don't think some characters are more important than the others. The statistics would be interesting though. ;)

Haskell, 187 bytes

f=g.(>>=(q.words)).lines
g t=p"CJMPRS">>=(\k->show(sum.map snd$filter((==k).fst)t)++' ':k++"\n")
q[n]=[("",read n)]
q[n,s]=[(k,read n)|k<-tail$p s]
p s=map concat$sequence[[[],[c]]|c<-s]

f is a function that takes the input, as a single multi-line string, and returns the multi-line output as single string. Probably plenty left to golf here.

λ: putStr test1
504 CRS
1 J
199 J
345 MP
980
2000 CJMPRS

λ: putStr $ f test1
980
2504 S
2504 R
2504 RS
2345 P
2000 PS
2000 PR
2000 PRS
2345 M
2000 MS
2000 MR
2000 MRS
2345 MP
2000 MPS
2000 MPR
2000 MPRS
2200 J
2000 JS
2000 JR
2000 JRS
2000 JP
2000 JPS
2000 JPR
2000 JPRS
2000 JM
2000 JMS
2000 JMR
2000 JMRS
2000 JMP
2000 JMPS
2000 JMPR
2000 JMPRS
2504 C
2504 CS
2504 CR
2504 CRS
2000 CP
2000 CPS
2000 CPR
2000 CPRS
2000 CM
2000 CMS
2000 CMR
2000 CMRS
2000 CMP
2000 CMPS
2000 CMPR
2000 CMPRS
2000 CJ
2000 CJS
2000 CJR
2000 CJRS
2000 CJP
2000 CJPS
2000 CJPR
2000 CJPRS
2000 CJM
2000 CJMS
2000 CJMR
2000 CJMRS
2000 CJMP
2000 CJMPS
2000 CJMPR
2000 CJMPRS


Nokia mystery puzzle A friend sent me this puzzle. I'm pretty sure solving it will require some programming. Can anyone crack it? The original is here in case of encoding issues in the past below.

Did you know that...
List of prime numbers include 2 as only even number, but not 1 which is equally not divisible by any other number than itself and 1?
Indexes in most of the programming languages start from 0?
Random mess is often considered as just "life"?
Prime bits of life include open position in Nokia?
Start here:
QnšmzFyN\�Li�B§TJ�vhgUEg�XbDMb¯o�ag�wUF�Iv¶u²nGTbf�vFc�]n¡vbD^Q@utJjMthn wŸ�B�CiŸ`yuftlyF]^Qvfh¹ºK[fF�wXuHdojG�YftvTP�OwmU�gzF�zuYQ�Z[gEn�wjU�MmŽ`FDtœPC�Sw`�Raw^»DuFlVvUdEa@uiluigJQhgtc[ŒGVcBSUL�OtnouŠ�KwGTI hEtwžgtEAtl§wuZoE�Qvvc[wZ@¢Pu\T�fo[RXtGVU¶wCdySwU[{w��wGX\�\v^ŽBFS_v^^@yXPmctvPcoWvHlfBwI�FJGu�AbWcnuªOv@[j�tu@GwBNB[tX�USioimTC¶KQŸbv\iiYK£DQ�[Ich`Oš[vcwaOyJ\RoŸP�tMQvtEvLKºWbwBvtvQžf�kXv°A\TA¬�PPwU�eTT[NAIAFhvti{WOga{`H�tRJ{a`BMHUI[ZI`lIDb\BA�fa`mtd€gK\@BwCTeR�³ww�NFDCGvfQSz£t`FBZ¬wMevA^Rv¢^iSct¢Bk�\zjNBv¢tRbIwNv\¹E³tiBHxwCH«\mtt`xgNBu@hJŸkeZbQŠaaF^o_YEcLii£F`tKjU_wHt��w®wDvO^²¶[DDvAvP�uk»gAOtx]JHRuWvcu�dQmŠn_\guZD]DlHh[€DGvfb@_X¬TMt^Xun@F«twOMTIv�]ZjvKSTwdRicvxG\K�¯mStILhUvOjwb^t�xi_VJUuRwh§v`Wg]W{JoŽh]uvIdw�@QXZ]«ŽinWJ�R_ZtwB¶Vu_JStI@UUMxT`²VYyuV�l\eW]lOghv]²NP\i�xySiuJvZG±ut�`\jMEtVZuv�twv±o_Awu�vn�oŽzYTM^fEt\bWH�M�lGilw�BI²tPgTvaE`h±e�x\aafvBNmt[RŠn£hjOBEUtmhNHtAuVHP�va_uOn�\UKnuBAHW_waFwH{WLu\ZRvT[nmvv«B]Yj�JbF¹BgyDNcv^`@iAwwlweFYlwe�§fk@mnPNh�Fg\`Di[�{j¬enk�Jw{Wh^[�cYO]`MWu®�oclQTg`X�VbnXlK\\ŠMuvAw]_^®SvTA�ZSmwB`PUwYw�»\utCnl[JGcuWVTXo€¬M¡aoPuvjR[jvV[�C_zM�nUn�wP«t¿IMVtuhwFJXvº@t^UEtIhGbCXt]bVSE€CMuZktmH_uvtwuIt¹vtKy{wNC«YivUM[BG�ntCJ^aBBFdhfNlPoBE@kuTe�VC�kRwwhZdTtfnt�^v^mg�cPeh�§Au°^BtND�Jd[f\th§`jNwRvFHLu@MNwvuSR`CdSE]vaaw_wPIvRjw^HXDi°fQ�wIfNTS`ttSA¢jv XX�EP@lbDALWdzkuG€_VQvmjIX�EkTummeC³iuZokw�]uQfMcBu�SXH_Whtuv^SjyejxoEtœwStoD�xVeaOA�jtJBa_KDPwtK^\ounwfZKDDuL@[vhIDI»tvvJc\cµvWe�FPvv�beWKUtaOtvA�DMTLcPh]nDD[Qfc�R�vwštAvhfWEv^hEZPuvaCNDBQtwdvuaw@�D@dPCG�wIdttYMKvau²wQnm^mOuvaZNB�viKBvkuDj¶BuVb_§hGtkEZvSc�tttµ_GxwvGwŒ]U�[{KJcv�h�ŒKv¯vRQIPHOivFG©LtXvtljuIB\^v�zDiPBgtcm�@tUdetwYhQuvK§¥t[�HONFwcXDxH�w`t_J`�tcHXM`vO°wkQQttw§@t£uvI[TTRgvŠbf¡AJoWoRfT�dP�g�wi�S{wYYh¢uleHR@\�KnK³u\vNcx{FHkvwTMEwP�gngEvutdGOE[teWDµwKOdG�G^�wEGARcNYutf�tvmdutv@TvvF�QHkX�]tPbvšlwvVJwuKu�So@o©]LNLx�btvXGDdlLz@eVzCltvwvt�Vb£L²wPXh_viyOw[XEkSvEJdIvmVJuw�@VGTw�tjKhjv�uWmEUhI®TtwRiuŒFZ�lYtuH\\F�Ufšn®YSu�dšOk�xuVdDgmOIEBUdw@]kvtEYAt^�NutW®®ebtMhv\kfljk@±nLgEB[�fImIKt[[�jo¯OnMtwcfgKcŒuEEªvvN\�tEw`GvNQ[gUK_euho�oY[�WTKMBatvl^twJ¿cK^lAaHw�M_uFK�DvtfNªKw€šKnIv@FiI�vj°S±Ru@wid»Qt\uRvZDvZjkwuFQVH\�zW[�hMUUkNe^�famV�TGw[hJovbtugIw`t`BDwl�tlVwQmtQ^YnOA¡StuCiv�]µ€BJj`n�]BeYi[PLtY@mAoPxHxI�SwIiJ�LA±uMhPm[oPG¯OUHuKvlIbwNttX�w_k]gwmL_`m�Ef]AVvwuPiwNT±Œfw¢`XAAKuwBvkLVXNix®]lVGSo�b]XS�[foSn�]Hu®md[Lf�QJcY�ZtkŸBtjtvPH�MfYBFnLYty_dBTQzdwT@W�[uvFwama[oj@Zh�IBmYtPJEie¹�Bw]\wOwŠNdfNul^zSwwYuOu^u]`nm¬vBBvmDP^ZGRgtIxcZYbn�Dn\D¥`otŽi^E_BvD]_w u\w�EvimvuPGwH�ST^otQ¥u]�KU¥W[CR¯l@vjt€^ATNu¥HVªTvC�ifzwteG[[`gtFJŠK¡tjt�MNbkuSuMDU£lt^[E�tiLc{ZhFu`RX]tdXvYuXuTdAKvuaxPXfi[Wg]wAeukeQkuP�utvvVBExOjgi{ad`HtaiŒuvo^u@lN©Awbub\kDWµ\»WYuRYZFHR{QvojtyNbtvwDOIv_YnAu^wttunyu[VCOQWE^dTuwtuYUwl^�VXlGž�NNFk��``KQV\NWHG] ^RNkRVQw\JAO@@wdV�ev«tc[vLAZNMoYZQk�H�uFBOdt]c]ADKDfvfC[�u`®\tSX�vUDE^vu_e�JwOhmd]EMwiRHmUH]\W°vtHzWµ\@j]^mh{MAxnAPu\QuvQuekthoµRTwNX`uTcŸS_Bc�SZwJJwe_cye^ªNtwv�Wuu�ev�IQ¹B�Xt]Q_gbVkmXwh_XUL±»tvvId`wAgX�]bžmVumB«DlJ_G�D@egUoPtu�@i[S¥e\ŽFIMFweI`ut_wIOD«vZ[_wiGuVZKFk±PDG�Aw@^`vAoS{nvw``kXUSuuZWù

Python - 132 chars

Data is read from stdin, starting from the "Qn..."

I=raw_input()
print("%X"%int("".join(`ord(I[x/8])>>(7-x%8)&1`*all(x%f for f in range(2,x))for x in range(2,24024)),2)).decode('hex')


Multiply two numbers without using any numbers You are given as input two strings representing positive integers in base 10, such as "12345" and "42". Your task is to output a string containing their product, "518490" in this case.

The twist is that you may not use any numerical types in your code. No ints, floats, unsigned longs, etc., no built-in complex number types or arbitrary precision integers, or anything along those lines. You many not use literals of those types, nor any function, method, operator etc. that returns them.

You can use strings, booleans, arrays, or anything else that wouldn't normally be used to represent a number. (But note that neither indexing into an array nor getting its length are likely to be possible without invoking a numeric type.) chars are permitted, but you may not perform any arithmetic or bitwise operations on them or otherwise treat them as anything else other than a token representing part of a string. (Lexicographical comparison of chars is allowed.)

You may not work around the restriction. This includes (but is not limited to) using numeric types inside an eval type function, implicit type conversions into numerical types, using numeric or bitwise operators on non-numeric types that support them, using numerical types stored inside container types, or calling functions or external programs that return numerical results in string form. (I reserve the right to add to this list if other workarounds appear in the answers.) You must implement the multiplication yourself using only non-numeric types.

Input and output may be by any convenient method, as long as the data enters and exits your code in the form of a string. You may assume each of the two input arguments contains only the ASCII characters [0-9] and will not start with 0.  Your output shouldn't have leading zeroes either.

One more thing: your code must correctly handle inputs up to at least 10 characters in length, and must run in under a minute on a modern computer for all inputs in that range. Before posting, please check that when given inputs 9999999999 and 9999999999, your program gives an output of 99999999980000000001, in less than a minute. This restriction exists specifically to prevent answers that work by allocating an array of size a*b and then iterating over it, so please bear in mind that answers of that form will not be eligible to win.

This is code-golf, so the shortest valid solution (in bytes) wins.


Generate programs that print n times their length Given a nonnegative integer n, your solution must output a program in your chosen language whose output has n times as many bytes as the outputted program.

Rules

You must specify the language and encoding of the programs your solution outputs, and you may not choose different languages or encodings for different inputs to your solution. The language of your output program may or may not be the same as the language of your solution.
Your submission only needs to handle integers in your language's range, but please do not abuse this rule.

This is code-golf so the shortest submission in bytes wins.

Example

Suppose n is 4. My solution then outputs f_8, a program which, in my (imaginary) language outputs j3 1s+/2]!mz. The program output has length 3 and its output has length 3 * 4 = 12, so the solution is correct for input 4.

Suppose instead that n is 1 and my program outputs ffffpfpffp (10 bytes). The program ffffpfpffp in my chosen language would have to produce an output of 10 * 1 = 10 bytes.

JavaScript (ES6), 38 bytes

n=>`(x="${n}")=>(x+1/7+1e9).repeat(x)`

Demo

let f =

n=>`(x="${n}")=>(x+1/7+1e9).repeat(x)`

function update() {
  let n = I.value,
      func = f(n),
      res = eval(func)();
  O.innerText =
    'n = ' + n + '\n\n' +
    'Function (' + func.length + ' bytes):\n' + func + '\n\n' +
    'Function output (' + res.length + ' bytes):\n' + res;
}
update()
<input type=range id=I min=0 max=100 oninput="update()">
<pre id=O>


Pascal's Alternating Triangle Pascal's triangle is generated by starting with 1 and having each row formed from successive additions. Here, instead, we're going to form a triangle by alternating  multiplication and addition.

We start row 1 with just a solitary 1. Thereafter, addition is done on the odd rows, and multiplication is done on the even rows (1-indexed). When performing the addition step, assume the spaces outside of the triangle are filled with 0s. When performing the multiplication step, assume that the outside is filled with 1s.

Here's the full triangle down to 7 rows. The * or + on the left shows what step was performed to generate that row.

1                1
2 *            1   1
3 +          1   2   1
4 *        1   2   2   1
5 +      1   3   4   3   1
6 *    1   3  12  12   3   1
7 +  1   4  15  24  15   4   1

Challenge

Given input n, output the nth row of this triangle.

Rules

You may choose to 0-index instead, but then please realize that the addition and multiplication rows must flip-flop, so that the exact same triangle is generated as above. Please state in your submission if you choose to do this.
The input and output can be assumed to fit in your language's native integer type.
The input and output can be given in any convenient format.
Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
If possible, please include a link to an online testing environment so other people can try out your code!
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Examples

Showing two possible examples of output out of many: a list, or a space separated string.

4
[1, 2, 2, 1]

8
"1 4 60 360 360 60 4 1"

Pascal, 249 247 233 bytes

Well, this is Pascal's alternating triangle.

1 byte saved thanks to @Mr.Xcoder

function f(n,k:integer):integer;begin if((k<1)or(k>n)or(n=1))then f:=n mod 2 else if n mod 2=0then f:=f(n-1,k-1)*f(n-1,k)else f:=f(n-1,k-1)+f(n-1,k)end;
procedure g(n:integer);var k:integer;begin for k:=1to n do write(f(n,k),' ')end;

Try it online!


Program my autodialer Back in the day, telephone autodialers used punched cards with one column for each digit of the number to be dialed. Columns had seven rows. The first three rows represented the numbers (1,2,3), (4,5,6), and (7,8,9) respectively. The last three rows rotated this arrangement by 90°: (1,4,7), (2,5,8), and (3,6,9). The middle row was used for 0. Any digit 1-9 would have two holes punched - one in the first three rows, and one in the bottom three rows. Zero would only have the middle row punched. Let's visualize the punched column for the number 6 (. is unpunched, x is punched, guide on left is just to illustrate the encoding):

123 .
456 x
789 .
 0  .
147 .
258 .
369 x

We look for which row(s) contain the number we're trying to dial. For 6, this is the second row, and the ninth row. These two rows are punched, the remaining five rows are unpunched. Here are the punched patterns for all digits 0-9:

    0 1 2 3 4 5 6 7 8 9
123 . x x x . . . . . .
456 . . . . x x x . . .
789 . . . . . . . x x x
 0  x . . . . . . . . .
147 . x . . x . . x . .
258 . . x . . x . . x .
369 . . . x . . x . . x

Your goal is to (write a program or function to) punch these cards for me.

Input: A number, taken in any reasonable format (string, integer, list of integers, &c.), not to exceed 9999999999999.

Output: The grid of punched columns corresponding to the number input. You don't need the headers or extra spacing shown above, just the punched columns themselves. Leading/trailing newlines are ok, as is whitespace between rows/columns as long as it is consistent. Speaking of, as long as they are consistent, you may use any (non-whitespace) character for punched, and any other character for unpunched (while it should be obvious, please specify what characters you are using).

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

Test cases (all use . for unpunched, x for punched):

In: 911
Out: .xx
     ...
     x..
     ...
     .xx
     ...
     x..

In: 8675309
Out: ....x..
     .x.x...
     x.x...x
     .....x.
     ..x....
     x..x...
     .x..x.x

In: 5553226
Out: ...xxx.
     xxx...x
     .......
     .......
     .......
     xxx.xx.
     ...x..x

Jelly, 13 bytes

9s3,Z$j0ċþDZY

Try it online!

1 = punctured, 0 = not punctured.


Monday Mini-Golf #2: Truncating long text Monday Mini-Golf: A series of short code-golf challenges, posted (hopefully!) every Monday.

Many web applications (especially social media) automatically truncate long passages of text so they fit within the app's formatting. In this challenge, we're going to create an algorithm to automatically trim a passage of text to a certain length.

Challenge

The goal of the challenge is to write a program or function that takes in two arguments:

T, the text to truncate.
L, the maximum length to return.

And returns T, truncated with the following logic:

If the length of T is less than or equal to L, no truncation is needed. Return the original string.
Truncate T to length L-2. If this contains no spaces or hyphens, return T truncated to exactly L-3 characters, followed by an ellipsis ....
Otherwise, trim the end of the result up to the last space or hyphen. Add an ellipsis ... and return the result.

Details

T and L may be taken in either order and any format.
You may assume that 3 < L < 231.
You may not use U+2026 Horizontal Ellipsis …; you must use three periods.
The input will not start with a space or a hyphen.
The input will not contain any whitespace other than regular spaces. (No tabs, newlines, etc.)

Test-cases

Inputs:

"This is some very long text." 25
"This-is-some-long-hyphen-separated-text." 33
"Programming Puzzles & Code Golf is a question and answer site for programming puzzle enthusiasts and code golfers." 55
"abcdefghijklmnopqrstuvwxyz" 20
"a b c" 4
"Very long." 100

Outputs:

"This is some very long..."
"This-is-some-long-hyphen..."
"Programming Puzzles & Code Golf is a question and..."
"abcdefghijklmnopq..."
"a..."
"Very long."

(Note that the quotes are just to specify that these are strings; they need not be included.)

Scoring

This is code-golf, so shortest valid code in bytes wins. Tiebreaker goes to submission that reached its final byte count first. The winner will be chosen next Monday, Oct 5. Good luck!

Edit: Congrats to your winner, @Jakube with Pyth again, with 25 bytes!

Pyth, 25 bytes

+WnzK<zeo}@zN" -"-Q2K"...

Try it online: Demonstration or Test Suite

Explanation:

+WnzK<zeo}@zN" -"-Q2K"...  implicit: z = input string, Q = input number
        o        -Q2       order the indices N in [0, 1, ..., Q-3] by
         }@zN" -"            z[T] in " -"
                           (hyphen-indices get sorted to the back)
       e                   take the last such number
     <z                    reduce z to length ^
    K                      save this string to K
+WnzK               K"...  print (K + "...") if z != K else only K


CAPTCHA Modified by Evil Mathematician CAPTCHA Modified by Evil Mathematician

I accidentally incurred the wrath of an eccentric passive-aggressive mathematician. As part of his demented idea of payback, he modified the CAPTCHA system on my favorite website. Up until now, it would just ask a moderately challenging math question, like 3+2^4, and I would simply type the answer, 19, to verify that I am a human being. But now, thanks to my mathematical nemesis, the CAPTCHA questions are obnoxiously hard to calculate by hand and it keeps me from logging into my profile!

From what I can tell, this is what he has done. The CAPTCHA images seem to still be the same, but the way it calculates the correct answer has changed. It takes the expression displayed in the image and rotates the operations. You wouldn't believe how long it took me to figure this out T__T.

Because of this fiasco, I need a program/function that takes in one of these expressions as a string, evaluates it and returns the result so that I can log onto my website! To make this a game, fewest bytes win.

Ok, you have the idea, lets walk through an example. Suppose that the CAPTCHA displayed an image with 6+5+4-3*2/1. Normally the answer would 9. Instead, we now have to rotate the operations to the right and that gives us 6/5+4+3-2*1. At this point, we evaluate it to be 6.2

Summary

Steps to evaluate the string input:

Rotate the operation to the right
Evaluate the result

Specifications

Full program or function
Standard I/O
Takes an expression
Prints/Returns the evaluated result

After the op rotation

Possible operations are +-/*^

The negatives for negative numbers stays with the number when rotating
Follow the normal order of operations after the rotation is completed
Using integer division is allowed

Possible numbers are positive/negative integers

This does not include 0

Parentheses could be included, but aren't rotated

Test Cases

Input     -> Output
1+3       -> 4
7+6       -> 13
1+1-2     -> 2
3*4+2     -> 11
-7^4      -> -2401
3*7+1-3   -> -1
-9+4/4    -> 1.75
(4*1)+8   -> 40
1+2-3*4/5 -> -16.5
1+-2*3    -> 1
3*4--2    -> 11
30-2/7    -> 8
120*3-4+10-> 122
(13^-12)+11 -> 1

Update

[16-07-28] Fixed typo in last test case. I had posted the expression after rotating it once >___> , so that rotating a second time gave an incorrect answer. It is fixed now! Thanks to @sintax!
[16-08-13] Removed broke test case. Thanks again to @sintax!

Python 3.5, 118 113 164 bytes:

from re import*
def R(U):Z='(?<!\d)-\d+|\d+|[()]';O=sub(Z,'',U);print(eval(sub(Z,'%s',U).translate(str.maketrans(O,O[::-1])).replace('^','**')%tuple(findall(Z,U))))

A named function. Can probably be golfed down more. This will take quite a while and apparently plenty of memory to compute the solution for the input:

((22^22)+2*2^2^2^2*2-2+222222+22222*-2222-2*222*2*2+2^-2+(2+2+2+2+2)+222/222+2+22*2*2)*2*2*2

I started processing this with my program about 30 minutes ago as of the time of this edit (9:52 PM on July 27, 2016) and it is still going. EDIT: Well, it eventually started to take up too much memory, so I had to stop it at around 1 hour after I started, at around 10:52 PM on July 7, 2016.

EDIT # 2: Well, even for the updated last test case it's pretty much the same thing, as it takes quite a while for my program to start finding the answer before it eventually quits out on me with error code 137.

Try It Online for the Rest of the Test Cases! (Ideone)


Visualize the greatest common divisor Background

The greatest common divisor (gcd for short) is a convenient mathematical function, since it has many useful properties.
One of them is Bézout's identity: if d = gcd(a, b), then there exist integers x and y such that d = x*a + y*b.
In this challenge, your task is to visualize this property with simple ASCII art.

Input

Your inputs are two positive integers a and b, given in any reasonable format.
You may also take unary inputs (repetitions of a single printable ASCII character of your choice), but you must be consistent and use the same format for both inputs.
The inputs may be in any order, and they may be equal.

Output

Your output is a string s of length lcm(a, b) + 1 (lcm stands for lowest common multiple).
The characters of s represent integers from 0 to lcm(a, b).
The character s[i] is a lowercase o if i is a multiple of a or b, and a period . otherwise.
Note that zero is a multiple of every number.
Now, because of Bézout's identity, there will be at least one pair of characters o in s whose distance is exactly gcd(a, b).
The leftmost such pair is to be replaced by uppercase Os; this is the final output.

Example

Consider the inputs a = 4 and b = 6.
Then we have gcd(a, b) = 2 and lcm(a, b) = 12, so the length of s will be 13.
The multiples of a and b are highlighted as follows:

0  1  2  3  4  5  6  7  8  9 10 11 12
o  .  .  .  o  .  o  .  o  .  .  .  o

There are two pairs of os with distance two, but we will only replace the leftmost ones with Os, so the final output is

o...O.O.o...o

Rules and scoring

You can write a full program or a function.
The lowest byte count wins, and standard loopholes are disallowed.

Test cases

 1  1 -> OO
 2  2 -> O.O
 1  3 -> OOoo
 4  1 -> OOooo
 2  6 -> O.O.o.o
 2  3 -> o.OOo.o
10  2 -> O.O.o.o.o.o
 4  5 -> o...OO..o.o.o..oo...o
 8  6 -> o.....O.O...o...o.o.....o
12 15 -> o...........O..O........o.....o.....o........o..o...........o
19 15 -> o..............o...o..........o.......o......o...........o..o..............OO.............o....o.........o........o.....o............o.o..............o.o............o.....o........o.........o....o.............oo..............o..o...........o......o.......o..........o...o..............o

Retina, 112 109 99 94 91 bytes

^
.
+r`(?<!^\1+). (.+)
$'$0
.(?=.* (.+) (.+))(?=\1* |\2* )
o
o(\.*)o((\1\.*o)*) .*
O$1O$2

Not very competitive, I think, but number theory in Retina is always quite fun. :)

Takes input as unary numbers using . as the unary digit.

Try it online.

Explanation

^
.

This inserts a . and a space in front of the input. This will ultimately become the output.

+r`(?<!^\1+). (.+)
$'$0

This prepends the LCM of a and b to the string. Since we already have a . there, we'll end up with lcm(a,b)+1. This is accomplished by repeatedly prepending b as long as a does not divide this new prefix. We capture a into a group one and then check if we can reach the beginning of the string by matching that capture at least once. b is then inserted into the string via the rarely used $' which inserts everything after the match into the substitution.

.(?=.* (.+) (.+))(?=\1* |\2* )
o

This one matches characters at positions which are divided by a or b. It makes use of the fact that the result is symmetric: since lcm(a,b) is divided by both a and b going left by subtracting instances of a or b yields the same pattern as going right from 0 by adding them. The first lookahead simply captures a and b. The second lookahead checks that there is a multiple of each a or b characters before the first space.

o(\.*)o((\1\.*o)*) .*
O$1O$2

As stated on Wikipedia, in addition to Bézout's identity it is also true that

  The greatest common divisor d is the smallest positive integer that can be written as ax + by.

This implies that the GCD will correspond to the shortest gap between two os in the output. So we don't have to bother finding the GCD at all. Instead we just look for first instance of the shortest gap. o(\.*)o matches a candidate gap and captures its width into group 1. Then we try to reach the first space by alternating between a backreference to group 1 and os (with optional additional .s). If there is a shorter gap further to the right, this will fail to match, because we cannot get past that gap with the backreference. As soon as all further gaps are at least as wide as the current one, this matches. We capture the end of the LCM-string into group 2 and match the remainder of the string with .*. We write back the uppercase Os (with the gap in between) as well as the remainder of the LCM string, but discard everything starting from the space, to remove a and b from final result.


Good rational approximations of pi Write a program that prints out all the good rational approximations of pi with denominator < 1000000, in increasing denominator order.  a/b is a "good rational approximation" of pi if it is closer to pi than any other rational with denominator no bigger than b.

The output should have 167 lines total, and start and end like this:

3/1
13/4
16/5
19/6
22/7
179/57
...
833719/265381
1146408/364913
3126535/995207

Shortest program wins.

Golfscript, 71 70 69 chars

2\!:^2^..292^15.2/3]{(.)2/.9>+{\+.((}*;.}do;;]-1%{^0@{2$*+\}/"/"\n}/;

(Assumes that you don't pass it anything on stdin)

I don't want to hear any more whinging by people who don't have built-in constants for pi. I don't even have floating point numbers!

See http://en.wikipedia.org/wiki/Continued_fraction#Best_rational_approximations for the background.

# No input, so the stack contains ""
2\!:^2^..292^15.2/3]
# ^ is used to store 1 because that saves a char by allowing the elimination of whitespace
# Otherwise straightforward: stack now contains [2 1 2 1 1 1 292 1 15 7 3]
# Pi as a continued fraction is 3+1/(7+1/(15+1/(...)))
# If you reverse the array now on the stack you get the first 10 continuants followed by 2
# (rather than 3)
# That's a little hack to avoid passing the denominator 1000000

{
    # Stack holds: ... [c_n c_{n-1} ... c_0]
    (.)2/.9>+
    # Stack holds ... [c_{n-1} ... c_0] c_n (1+c_n)/2+((1+c_n)/2 > 9 ? 1 : 0)
    # (1+c_n)/2 > 9 is an ad-hoc approximation of the "half rule"
    # which works in this case but not in general
    # Let k = (1+c_n)/2+((1+c_n)/2 > 9 ? 1 : 0)
    # We execute the next block k times
    {
        # ... [c_{n-1} ... c_0] z
        \+.((
        # ... [z c_{n-1} ... c_0] [c_{n-1} ... c_0] z-1
    }*
    # So we now have ... [c_n c_{n-1} ... c_0] [(c_n)-1 c_{n-1} ... c_0] ...
    #                    [(c_n)-k+1 c_{n-1} ... c_0] [c_{n-1} ... c_0] c_n-k
    ;
    # Go round the loop until the array runs out
    .
}do

# Stack now contains all the solutions as CFs in reverse order, plus two surplus:
# [2 1 2 1 1 1 292 1 15 7 3] [1 2 1 1 1 292 1 15 7 3] ... [6 3] [5 3] [4 3] [3] [2] []
# Ditch the two surplus ones, bundle everything up in an array, and reverse it
;;]-1%

# For each CF...
{
    # Stack holds ... [(c_n)-j c_{n-1} ... c_0]
    # We now need to convert the CF into a rational in canonical form
    # We unwind from the inside out starting with (c_n)-j + 1/infinity,
    # representing infinity as 1/0
    ^0@
    # ... 1 0 [c_n-j c_{n-1} ... c_0]
    # Loop over the terms of the CF
    {
        # ... numerator denominator term-of-CF
        2$*+\
        # ... (term-of-CF * numerator + denominator) numerator
    }/

    # Presentation
    "/"\n
    # ... numerator "/" denominator newline
}/

# Pop that final newline to avoid a trailing blank line which isn't in the spec
;


Display a tally (in varying bases) Tallying is a simple counting system that works in base 5. There are various different tallying systems used around the world, but the one that is used in most English-speaking countries is perhaps the most simple - count units by marking vertical lines, then for each 5th mark put a horizontal line through the previous collection of four. This clusters the tally marks in groups of 5 (and makes them easier to quickly count).

You are going to write a program that displays tally marks up to a given value. But, tallying in only base 5 is boring! Therefore, your program should also be able to display tallies in different bases.

Input

The input will be either one or two non-negative integer values separated by a comma (e.g. 9 or 8,4). The first number is the value that should be displayed by the tally. The second value is the base of the tally. If the second value is not given, use base 5.

Output

The output will be the inputted value represented as ASCII art tally marks. Here are some examples you can test your program against - your output should match them exactly!

Input: 12 or 12,5

 | | | |   | | | |   | |
-+-+-+-+- -+-+-+-+-  | |
 | | | |   | | | |   | |

Input: 7,3

 | |   | |   |
-+-+- -+-+-  |
 | |   | |   |

Input: 4,2

 |   |
-+- -+-
 |   |

Input: 6,1 or 6,10 (notice the leading spaces)

 | | | | | |
 | | | | | |
 | | | | | |

Note also that base 1 is intended to be inconsistent - only vertical lines should be used.

If either of the inputted values is 0, there should be no output whatsoever (and your program should end gracefully).

Rules

This is code-golf, so the shortest correct implementation (in bytes) wins.
Input/output can be in any suitable medium (e.g. stdin/stdout, file...).
Input can be in the form of multiple command-line arguments or separated by spaces, etc. if it is more suitable for your target language.
Trailing newlines are allowed in the output. Trailing spaces are not. This rule only applies when there is an output (i.e. not when the inputted value is 0).
Your code must default to base 5 when no base is input.

Python 2 - 111 108 119 144 140 136 135 134 - Try it

Ok, let's give it a try:

i=input()
n,b=[(i,5),i][i>[]]
o=b-1
a=[n,n%b][b>1]*' |'
m=(b>1)*n/b
s=(' |'*o+'  ')*m+a
print(s+'\n'+('-+'*o+'- ')*m+a+'\n'+s)*(b*n>0)

Edit: I've overlooked that there should be no output if n==0 or b==0. This costs me 11 characters. :(

Edit: Ok, after fixing the second issue mentioned in the comments my solution basically converged to the one from BeetDemGuise.


Change the rules of Life Life-like cellular automaton are cellular automaton that are similar to Conway's Game of Life, in that they operate on a (theoretically) infinitely large square grid, where each cell has exactly 8 neighbours, and is one of 2 states, namely alive and dead.

However, these Like-like versions are different in a crucial way: the rules for a given cell to come alive and the rules for a given cell to survive to the next generation.

For example, classic Game of Life uses the rule B3/S23, meaning that it takes 3 alive cells to birth a new one, and either 2 or 3 living neighbours to survive. For this challenge, we will assume that neighbours do not include itself, so each cell has exactly 8 neighbours.

Your task is, given a starting configuration, a birth rule, a survival rule and a positive integer (the number of generations to be run), simulate the Life-like automaton using those rules for the number of generations given in the shortest code possible. The starting configuration will be a square matrix/2-dimensional array or a multiline string, you may choose. The others may be given in any reasonable format and method.

For example, if the birth rule was 12345678 (any living neighbours), the survival rule was 2357 and the starting configuration was

0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0

the next two generations would be

Generation 1:           Generation 2:

0 0 0 0 0               1 1 1 1 1
0 1 1 1 0               1 1 0 1 1
0 1 0 1 0               1 0 1 0 1
0 1 1 1 0               1 1 0 1 1
0 0 0 0 0               1 1 1 1 1

If the number of generations given was 10, the output would be something along the lines of

0 1 1 1 0
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
0 1 1 1 0

You do not have to handle changes that happen outside of the bounds given by the input matrix, however, all cells outside the matrix begin dead. Therefore, the input matrix may be any size, up to the maximum value your language can support. You do not have to output the board between generations.

This is a code-golf so the shortest code wins.

Test cases

These use the B/S notation to indicate the rules used

B2/S2, generations = 100, configuration:

1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0

Output:

0 0 0 0 0 0 0 0
0 1 0 0 0 0 1 0
1 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

B1357/S2468, generations = 12, configuration:

1 0 1 0 1 0
0 1 1 0 1 0
1 0 0 0 0 0
0 0 0 0 0 1
1 1 1 1 1 0
0 1 1 0 0 1

Output:

0 1 0 0 0 0
0 1 1 1 1 0
0 1 0 1 1 0
1 1 1 0 0 0
0 0 1 1 1 0
0 1 1 0 0 0

If you need to generate more test cases, you can use this wonderful simulator. Please make sure to limit the board size

MATL, 24 23 bytes
xx:"tt3Y6Z+1Gm<8M2Gmb*+

Inputs are:

Array with birth rule
Array with survival rule
Number of generations
Matrix with initial cell configuration, using ; as row separator.

Try it online! Or see test cases: 1, 2.
For a few bytes more you can see the evolution in ASCII art.
Explanation
xx      % Take two inputs implicitly: birth and survival rules. Delete them
        % (but they get copied into clipboard G)
:"      % Take third input implicitly: number of generations. Loop that many times
  tt    %   Duplicate twice. This implicitly takes the initial cell configuration
        %   as input the first time. In subsequent iterations it uses the cell
        %   configuration from the previous iteration
  3Y6   %   Push Moore neighbourhood: [1 1 1; 1 0 1; 1 1 1]
  Z+    %   2D convolution, maintaining size
  1G    %   Push first input from clipboard G: birth rule
  m     %   Ismember: gives true for cells that fulfill the birth rule
  <     %   Less than (element-wise): a cell is born if it fulfills the birth rule
        %   *and* was dead
  8M    %   Push result of convolution again, from clipboard M
  2G    %   Push second input from clipboard G: survival rule
  m     %   Ismember: gives true for cells that fulfill the survival rule
  b     %   Bubble up the starting cell configuration
  *     %   Multiply (element-wise): a cell survives if it fulfills the survival
        %   rule *and* was alive
  +     %   Add: a cell is alive if it has been born or has survived, and those
        %   are exclusive cases. This produces the new cell configuration
        % Implicit end loop. Implicit display


Print the total length of all "quoted" characters Rules

In this challenge, I'm going to redefine the definition of "quotes" a bit.

Quotation marks (AKA quotes) are any identical characters used in pairs in various writing systems to set off direct speech, a quotation, or a phrase. The pair consists of an opening quotation mark and a closing quotation mark, which is the same character(case-sensitive).
If there are quote-pairs overlapping each other,

If a pair nesting another, both pairs are still valid.
If a pair not nesting another, the first starting pair remains valid. The other is no longer considered as a pair.

When counting quoted characters(length of a pair of quotes),

The quotes themselves don't count.
Each pair's length is counted independently. Overlapping doesn't affect another.

Goal

Your goal is to print the total length of all valid quotes. This is code golf, therefore the code with the fewest bytes wins.

Examples

Legend:
    <foo>: Valid quotes
    ^    : Cannot be paired character

Input   : ABCDDCBA
`A`  (6): <BCDDCB>
`B`  (4):  <CDDC>
`C`  (2):   <DD>
`D`  (0):    <>
Output  : 12

Input   : ABCDABCD
`A`  (3): <BCD>
`B`  (0):  ^   ^
`C`  (0):   ^   ^
`D`  (0):    ^   ^
Output  : 3

Input   : AABBBBAAAABA
`A`  (0): <>    <><> ^
`B`  (0):   <><>    ^
Output  : 0

Input   : ABCDE
Output  : 0

Input   : Print the total length of all "quoted" characters
`r` (40):  <int the total length of all "quoted" cha>
`n` (14):    <t the total le>
`t` (15):     < >   <o>       <h of all "quo>
` `  (7):      ^   <total>      <of>   ^        ^
`h`  (0):        ^             ^                  ^
`e`  (8):         < total l>                 ^          ^
`o`  (0):            ^           ^         ^
`a`  (0):              ^            ^              ^ ^
`l`  (0):               ^ ^          <>
`"`  (0):                               ^      ^
`c`  (0):                                        ^    ^
Output  : 84

Input   : Peter Piper picked a peck of pickled peppers
`P`  (5): <eter >
`e`  (9):  <t>     ^      <d a p>           <d p>  ^
`r`  (0):     ^     ^
` `  (3):      ^     ^      <a>    <of>       ^
`i`  (5):        <per p>
`p`  (3):         <er >        ^       ^       ^ <>
`c`  (8):               <ked a pe>       ^
`k`  (7):                ^        < of pic>
`d`  (0):                  ^                 ^
Output  : 40

Input   : https://www.youtube.com/watch?v=dQw4w9WgXcQ
`h` (27): <ttps://www.youtube.com/watc>
`t`  (0):  <>            ^          ^
`/`  (0):       <>               ^
`w` (14):         <><.youtube.com/>         <4>
`.`  (7):            <youtube>
`o`  (0):              ^       ^
`u`  (1):               <t>
`c`  (0):                     ^      ^             ^
`Q`  (8):                                  <w4w9WgXc>
Output  : 57

APL (Dyalog Unicode), 36 bytesSBCS

Full program. Prompts for input from stdin.

≢∊t⊣{t,←'(.)(.*?)\1'⎕S'\2'⊢⍵}⍣≡⍞⊣t←⍬

Try it online!

t←⍬ set up an accumulator t (for total)

⍞⊣ discard that in favour of string input from stdin (symbol: quote in console)

{…}⍣≡ apply the following anonymous lambda until stable (fix-point; previous ≡ next)

 ⊢⍵ on the argument

 …⎕S'\2' PCRE Search for the following, returning group 2 for each match:

  (.) any character (we'll call this group 1)
  (.*?) as few characters as possible (we'll call this group 2)
  \1 the group 1 character

 t,← update t by append that to t's current value

t⊣ discard that (the final list of no matches) in favour of t

≢ count the number of characters in that


As close to flat as possible Write a program or function that fulfills the following

Scores less than 101 bytes under normal code-golf rules
Takes no input1 and always outputs a single integer.
Every integer is a possible output.

Your score will be the probability of the most frequent integer occurring, with a lower scoring being the goal.  That is \$\mathrm{sup}\left\{P(x)|x\in\mathbb{Z}\right\}\$.

Since a few of these properties are not program decidable, you should be ready to provide a proof that your answer is valid and obtains the score it claims.

1 You may optionally take a stream of random bits, or a subroutine which produces random bits on each call as an input to provide randomness.  Each bit will be uniform and independent of other bits.

05AB1E, score 0.5 / 1000!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

bug fix thanks to FryAmTheEggman

+1 ! thanks to ExpiredData

 [₄!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!LΩ#¼]¾D±)Ω

(dont't) Try it online! (will timeout).

Try it online without the factorials

[           ]            # loop:
 ₄                       #  1000
  !!...!                 #  take the factorial, 88 times
        LΩ               #  pick a random number from 1 to that many
          #              #  if the number was 1, exit the loop
           ¼             #  increment counter_variable
             ¾           # after the loop: push counter_variable
              D±         # push its bitwise negation
                )        # wrap the two in a list
                 Ω       # pick a random element of that list

Any integer would work instead of 1000!!...!, so this approach could score as low as 0.5 / BB(89), where BB is 05AB1E's Busy Beaver function.


Wolstenholme numbers The generalised harmonic number of order \$m\$ of \$n\$ is
$$H_{n,m} = \sum^n_{k=1} \frac 1 {k^m}$$
In this challenge, we'll be considering the generalised harmonic numbers of order \$2\$:
$$H_{n,2} = \sum^n_{k=1} \frac 1 {k^2}$$
This sequence begins \$1, \frac 5 4, \frac {49} {36}, \frac {205} {144}, \dots\$ and converges to \$\frac {\pi^2} 6\$ as \$n \to \infty\$.
However, we will only be considering the numerators of this sequence, which forms another sequence known as the Wolstenholme numbers (A007406):
1, 5, 49, 205, 5269, 5369, 266681, 1077749, 9778141, ...

You are to take a positive integer \$x\$ as input. \$x\$ is guaranteed to be a Wolstenholme number. You should output the next term in the sequence of Wolstenholme numbers, i.e. given the numerator of \$H_{n,2}\$, output the numerator of \$H_{n+1,2}\$
You may input and output in any convenient format. Your program should not fail due to floating point errors, meaning that attempts that calculate via the generalised harmonic numbers will be invalid if not using rational numbers. Your program should work theoretically for any valid input, but it is acceptable to fail for inputs that may be outside your language's integer maximum.
You may assume that no element is repeated in the sequence. If it turns out that there are any duplicate values in the Wolstenholme numbers sequence, any and all behaviour is acceptable when passed such values as input.
This is code-golf, so the shortest code in bytes wins
Test cases
        x ->       out
        1 ->         5
        5 ->        49
       49 ->       205
      205 ->      5269
     5269 ->      5369
     5369 ->    266681
   266681 ->   1077749
  1077749 ->   9778141
  9778141 ->   1968329
  1968329 -> 239437889
239437889 -> 240505109

J, 39 35 30 28 bytes
(]{~1+i.~)1*.[:+/\_2^~1+i.,]

Try it online!
-5 thanks to Bubbler's observation that the numerator is the LCM of the fraction and 1.
-2 thanks to Bubbler for a transformation.
Note: The approach below relies on the assumption that every Wolstenholme number is greater than or equal its index, which was kindly proved by Greg Martin.

[:+/\_2^~1+i.,] Generates the sequence up to n+1, where n is the input: Scan sum +/\ of 1 over 1% the square of *: one plus 1...+ the integers from 0 to the input i.@>:.
1*. Numerators only.
(]{~1+i.~) Finds index of the input in previous result, adds 1, and plucks from previous result.


Partition a square grid into parts of equal area This challenge is based on the following puzzle: You are given an n by n grid with n cells marked. Your job is to the partition the grid into n parts where each part consists of exactly n cells, each containing exactly one marked cell.

Example

Here is a puzzle on the left and its (unique) solution on the right:

Challenge

You will be given a set of n zero-indexed coordinates in any reasonable format.

[(0,0), (0,3), (1,0), (1,1), (2,2)]

And your job is to write a program that returns any valid parition (again, in any reasonable format).

[
  [(0,0), (0,1), (0,2), (1,2), (1,3)],
  [(0,3), (0,4), (1,4), (2,4), (3,4)],
  [(1,0), (2,0), (3,0), (4,0), (4,1)],
  [(1,1), (2,1), (3,1), (3,2), (4,2)],
  [(2,2), (2,3), (3,3), (4,3), (4,4)]
]

If the puzzle has no solution, the program should indicate that by throwing an error or returning an empty solution.

Input/Output Examples

[(0,0)]               => [[(0,0)]]

[(0,0), (1,1)]        => [
                          [(0,0), (1,0)],
                          [(0,1), (1,1)]
                         ]

[(0,0), (0,1), (1,0)] => [] (no solution)

[(0,0), (0,1), (0,2)] => [
                          [(0,0), (1,0), (2,0)],
                          [(0,1), (1,1), (2,1)],
                          [(0,2), (1,2), (2,2)],
                         ]

[(0,0), (0,2), (1,2)] => [
                          [(0,0), (1,0), (2,0)],
                          [(0,1), (0,2), (1,1)],
                          [(1,2), (2,1), (2,2)],
                         ]

Scoring

This is code-golf, so shortest code wins.

JavaScript (ES7), 166 bytes
Outputs a matrix of integers that describe the partition, or \$false\$ if there's no solution.

a=>(m=a.map(_=>[...a]),g=(n,X,Y,j=0,i)=>a[n]?a[j]?m.some((r,y)=>r.some((v,x)=>++v|(X-x)**2+(Y-y)**2-1?0:g(r[x]=n,x,y,j+1,i|x+[,y]==a[n])?1:r[x]=v)):i&&g(n+1):1)(0)&&m

Try it online!
How?
We first build a square matrix \$m\$ of size \$N\times N\$, where \$N\$ is the length of the input:
m = a.map(_ => [...a])

Each row of \$m\$ consists of a copy of the input, i.e. an array of \$N\$ coordinate pairs. The important point here is that all cells of \$m\$ are initialized to non-numeric values. We'll be able to detect them by applying the prefix increment operator ++.
The recursive function \$g\$ takes a pointer \$n\$ into the input, the coordinates \$(X,Y)\$ of the previous cell, a counter \$j\$ that holds the number of filled cells in the current area, and a flag \$i\$ that is set when the marked cell is found in the area:
g = (n, X, Y, j = 0, i) => a[n] ? a[j] ? ... : i && g(n + 1) : 1

We test \$a[n]\$ to know if all areas have been processed and we test \$a[j]\$ to know if enough cells have been filled in the current area.
The main part of \$g\$ looks for the next cell of \$m\$ to fill by iterating on all of them:
m.some((r, y) =>          // for each row r[] at position y in m[]:
  r.some((v, x) =>        //   for each cell of value v at position x in r[]:
    ++v |                 //     if this cell is already filled (i.e. v is numeric)
    (X - x) ** 2 +        //     or the squared Euclidean distance between
    (Y - y) ** 2 -        //     (X, Y) and (x, y)
    1 ?                   //     is not equal to 1:
      0                   //       this is an invalid target square: do nothing
    :                     //     else:
      g(                  //       do a recursive call to g:
        r[x] = n,         //         pass n unchanged and fill the cell with n
        x, y,             //         pass the coordinates of the current cell
        j + 1,            //         increment j
        i |               //         update i:
        x + [,y] == a[n]  //         set it if (x, y) = a[n]
      ) ?                 //       if the result of the call is truthy:
        1                 //         return 1
      :                   //       else:
        r[x] = v          //         reset the cell to NaN
  )                       //   end of inner map()
)                         // end of outer map()


Removing unique elements from string I came upon this question, because it seems to be very common use-case to find unique characters in string. But what if we want to get rid of them?

Input contains only lower case alphabets. Only letters from a to z are used. Input length may be from 1 to 1000 characters.

Example:
input: helloworld
output: llool

Objective: Shortest code wins
Language: Any of the top 20 of TIOBE languages

(GolfScript, 15 13 characters)
:;{.;?);>?)},

GolfScript is not one of the top 20, but a codegolf without GolfScript... (run it yourself)
Previous Version:
(run script)
1/:;{;\-,;,(<},


Half-reverse a binary string This is a follow-up question to my Puzzling.SE question: I asked if there’s a function f mapping Boolean strings to Boolean strings, so that f(f(b)) = reverse(b) for all input strings b. (By reverse, I mean the function that reverses the order of bits.)

The above link contains a positive answer, with proof, by the great f'', but you might want to ponder the question for yourself before looking.

Implement such a function f in as few bytes as possible.

You may either read input from STDIN, or take a function argument; and either write the result string to STDOUT, or return it.
Either way, you may work with actual strings of two distinct bytes or characters of your choice (say 0 and 1, or \x00 and \x01), or with arrays/lists of truthy and falsy values. Pick two values and stick with those, though.
The result of a single application of f must be a binary string itself: no silly answers like b -> if b starts with 'x' then reverse(b[1:]) else 'x' + b...
Your function should be total; in particular, the input may be the empty string, or one bit long, etc. There’s no upper bound for the string’s length.
It should also be pure: don’t keep any global state between function calls; the input string must completely determine the output string.

Python 2, 64 69 bytes

def f(s):p=(s+s).find(s,1);return[s[~p::-1],s+s[:p]][len(s)/p%2]

Ungolfed:
def f(s):
    p = (s+s).find(s,1)
    n = len(s)/p
    return s[:p][::1|n%-2] * -~(n-1^1)

This finds the string's period, i.e. the minimal p such that s is a string of length p repeated n times (I found a golfy method on SO). Then if n is odd, it adds one more repetition of the period. If n is even, it removes one repeat of the period and reverses it.
Thanks to @Sp3000 for helping to implement the function mapping between 1<->2, 3<->4, etc.


Monday Mini-Golf #4: JARVIS (Just Another Rather Vast set of Integer Sequences) Monday Mini-Golf: A series of short code-golf questions, posted (hopefully!) every Monday.
(Sorry I'm late again; I was away from my computer  basically all of yesterday and today.)

Us programmers (especially the code-golfers) sure love arbitrary integer sequences. We even have an entire site dedicated to these sequences that currently has around 200,000 entries. In this challenge, we'll be implementing yet another set of these sequences.

Challenge

Your challenge is to write a program or function that takes in an integer N, and outputs a sequence of base 10 integers, where each next integer is determined in this way:

Start at 1.
For each digit D in the previous integer's base 10 representation:

If D is 0, add one to the current integer.
Otherwise, multiply the current integer by D.

Details

You may assume that 0 < N < 231.
You must output each integer in the sequence, starting with the input number, until a number less than 10 is reached.
The output may be an array, or a string separated by spaces, commas, newlines, or a combination of these.
A trailing space and/or newline is allowed, but not a trailing comma.
There should never be any leading zeroes.

Examples

Example 1: 77

This example is fairly straightforward:

77 = 1*7*7 = 49
49 = 1*4*9 = 36
36 = 1*3*6 = 18
18 = 1*1*8 = 8

Thus, the proper output is 77 49 36 18 8.

Example 2: 90

Here we have:

90 = 1*9+1 = 10
10 = 1*1+1 = 2

So the output would be 90 10 2.

Example 3: 806

Read the equations left-to-right:

806 = 1*8+1*6 = 54 (((1*8)+1)*6)
 54 = 1*5*4   = 20
 20 = 1*2+1   = 3

Output should be 806 54 20 3.

Test-cases

The first number in each line is the input, and the full line is the expected output.

77 49 36 18 8
90 10 2
249 72 14 4
806 54 20 3
1337 63 18 8
9999 6561 180 9
10000 5
8675309 45369 3240 25 10 2
9999999 4782969 217728 1568 240 9
1234567890 362881 2304 28 16 6

As a reference, here's the proper next integers from 10 to 100:

Current | Next
--------+-----
     10 |  2
     11 |  1
     12 |  2
     13 |  3
     14 |  4
     15 |  5
     16 |  6
     17 |  7
     18 |  8
     19 |  9
     20 |  3
     21 |  2
     22 |  4
     23 |  6
     24 |  8
     25 | 10
     26 | 12
     27 | 14
     28 | 16
     29 | 18
     30 |  4
     31 |  3
     32 |  6
     33 |  9
     34 | 12
     35 | 15
     36 | 18
     37 | 21
     38 | 24
     39 | 27
     40 |  5
     41 |  4
     42 |  8
     43 | 12
     44 | 16
     45 | 20
     46 | 24
     47 | 28
     48 | 32
     49 | 36
     50 |  6
     51 |  5
     52 | 10
     53 | 15
     54 | 20
     55 | 25
     56 | 30
     57 | 35
     58 | 40
     59 | 45
     60 |  7
     61 |  6
     62 | 12
     63 | 18
     64 | 24
     65 | 30
     66 | 36
     67 | 42
     68 | 48
     69 | 54
     70 |  8
     71 |  7
     72 | 14
     73 | 21
     74 | 28
     75 | 35
     76 | 42
     77 | 49
     78 | 56
     79 | 63
     80 |  9
     81 |  8
     82 | 16
     83 | 24
     84 | 32
     85 | 40
     86 | 48
     87 | 56
     88 | 64
     89 | 72
     90 | 10
     91 |  9
     92 | 18
     93 | 27
     94 | 36
     95 | 45
     96 | 54
     97 | 63
     98 | 72
     99 | 81
    100 |  3

You can find this list expanded to 10000 here.

Scoring

This is code-golf, so shortest valid code in bytes wins. Tiebreaker goes to submission that reached its final byte count first. The winner will be chosen next Monday, Oct 19. Good luck!

Edit: Congrats to your winner, @isaacg, using Pyth yet again for 14 bytes!

Pyth, 15 14 bytes

.uu|*GHhGjNT1Q

1 byte thanks to Dennis

Test Suite

This challenge feels like it was made for Pyth's reduce functions. One reduce over the digits, one reduce until the value stops changing, and we're good.