What's being surrounded I've always wanted to surround some text with #s, but I have trouble figuring out what I surrounded so in this challenge you'll be writing a program to do just that

Examples

Input / Outputs are separated by a newline.

###
#a#
###

a

 #
#a#
 #

a

  ###
 # a #
# b c #
#######

  a
 b c

ABCDHIJ
E####GK
F# M #L
#   N#O
P####

  M
   N

###A###
#C#B#o#
#d###e#
 # go#
  ###

C   o
d   e
  go

Spec

#s are what "surround" a block of text
# will always be adjacent to one another (including diagonally)
# will always form a closed shape
There will only be one # shape
In the event of a concave shape, holes should be filled with spaces.

Whitespace must be preserved in the output

Perl, 144 138 132 129 128 127 126 124 bytes

Includes +2 for -p0

The code assumes \0 is not a valid input character (at least inside the #).

Run with the input on STDIN:

surround.pl < surround.txt

surround.pl:

#!/usr/bin/perl -p0
/^#[^#\0]/m&&s/^|[^#\n\0]\0/\0\0/mg,s%.%s/.(.*)/$+\0/g;/#/&&reverse"\n",/^./mg%seg until$?++<$$_++;y/\0/#/;s/^#*\n|#+$|^#//mg;y;#;

The code works as is, but replace the \0 and \n by their literal versions for the claimed score. Notice there is a space  at the end of the line. The code loops way too many times, so you may have to wait 30 seconds or so for output.

Explanation

I am going to do a floodfill with \0 stopped by # from the outside in the orthogonal directions. After that I will slice off the # sides and replace all that is left by spaces. To avoid having to handle all directions in the floodfill I will repeatedly rotate the target area and only floodfill from right to left

/^#[^#\0]/m                   The rotation is written such that it slices
                              off the first column. That is ok unless the
                              first column contains a # that is followed by
                              something that could be the inside. There is
                              no newline inside the [] because short lines
                              will get extended during the rotation and
                              the character following the # will end
                              up as a \0 and match in a later round
    &&s/^|[^#\n\0]\0/\0\0/mg  In case the # could be an interior border I
                              will add two columns of \0's in front. One
                              will be a sacrifice for the rotation, the
                              other column will end up at the end of the area
                              after two rotations and function as seed for the
                              floodfill. This regex also does one step of
                              the floodfill from the back to the front.
                              After a certain number of loops we are certain
                              to get to a first column that must not be
                              dropped so at some point the last column is
                              guaranteed to consist of only \0. And we only need
                              to fill backward since the rotations will make
                              any direction backward at some point

s%.%  process column  %seg    I will replace each character (including \n)
                              in the string by the next column in reversed
                              order or an empty string if there are no more
                              interesting columns. This is therefore a right
                              rotation. There are less columns than
                              characters so this loop is long enough

    s%.%s/.(.*)/$+\0/g        Remove the next (now first) character from each
                              row (so remove the column). Because the
                              original area is not necessarily a rectangle
                              add a \0 at the end of the row so we won't run
                              out out of columns (this would cause shorter
                              rows to have no entry in the new rotated row)
                              This will not do anything for empty lines so
                              they DO get squeezed out. But that is not a
                              problem since the problem statement says there
                              will be only one # shape so any empty lines
                              are can be safely dropped (this would not be
                              so if there could be multiple # shapes because
                              that could create a new surrounded area

    /#/                       Check if any of the remaining columns still
                              has a #. If not all remaining columns are on
                              the outside and can be dropped
       &&reverse"\n",/^./mg   Collect the column and add a \n to its reverse

 until$?++<$$_++              Keep doing this until we get to a multiple of
                              65536 rotations when $? waraps back around to 0
                              (this is a multiple of 4 so the area is left
                              unrotated) and an area we have seen before
                              ($$_ >= 1)
                              (so all slicing and flood filling is finished)
                              $_ having been seen in a previous rotations is
                              not a problem (though rather tricky to prove)

At this point e.g.

AB##J
E####GK
F# M #L
#   N#O
P####

will have been replaced by:

0000000
0####00
0# M #0
#   N#0
0####00

Basically all columns and rows that are not directly bordering the inside have been sliced off. Any outside characters left has been replaced by \0.
At the top and right there is an extra layer of \0. So all that is left is cleanup:

y/\0/#/                       Replace any outside that is left by #
s/^#*\n|#+$|^#//mg            Removes the first two and last line (the only
                              lines that can consist of purely #)
                              Removes any trailing #
                              Removes the first column of #
y;#; \n;                      Replace any remaining # by space since they
                              are needed to fill the concave parts
                              The final \n; is not written since it is implicit
                              in the -p loop


Program touch-tone instructions for my fingers The keypad on my office phone has the following layout:
[1]  [2]  [3]
/.@  ABC  DEF

[4]  [5]  [6]
GHI  JKL  MNO

[7]  [8]  [9]
PQRS TUV WXYZ

[*]  [0]  [#]
 +    _

Task:
Write a program that, given an input string, returns a list of instructions that my fingers need to follow in order the type/dial the message/number.
Rules:

3 fingers (1,2 & 3) start on keys [4], [5] and [6]. This starting position is 0.
The only instruction a finger receives is its new relative location.
Once a key has been pressed, that is the finger's new starting position. Fingers do not return to their 'home row'.
Moving a finger up the keypad's column is -1, -2 or -3, depending on where it was last used.
Moving a finger down the keypad's column is 1, 2 or 3, depending on where it was last used.
Keeping a finger on the same key means there is no movement (0). It is not included.
Words which require a double letter (like 'OO' in 'BOOK' or 'DE' in CODE) will need a pause (P) between letters.
When using Pause, the finger is not specified.
A finger can only press the keys in its own column (1,4,7,*) (2,5,8,0) (3,6,9,#)
Typing certain letters requires multiple keypresses. To type 'F', 3 needs to be pressed 3 times.
Input is not case sensitive.
Input characters not available on the keypad should be ignored. (Hyphens and parenthesis of a phone number, for example)
Input will either be alpha or numeric - not a mixture - so no need to switch between input methods mid-stream.
When entering numbers, Pauses aren't necessary.
This is code-golf so shortest code in bytes wins.

Update
To slightly simplify matters, [*] and [#] can be ignored. These will not feature in the input. But I'll buy you a beer if you do include them and get lowest byte count! (If you're in London ;-))
Output:
A list of instructions, in the following format:
[direction] [finger_number] [new_relative_location], ...

Whitespace between instructions is optional.
Test cases:
(123)-957 -> -11, -21, -31, 32, 21, 12
555-9273 -> 2,2,2,31,-21,11,-32
CODE GOLF -> -21,2,2, 3,3,3, -31, P, 3,3, 23, 1, 31,3,3, -22,2,2, -31,3,3
Code Golf -> -21,2,2, 3,3,3, -31, P, 3,3, 23, 1, 31,3,3, -22,2,2, -31,3,3


Stack Exchange Vote Simulator Write a program or function that takes in a string only containing the characters ^ and v (you can assume there will be no other characters). Read from left to right this string represents the sequence of mouse clicks a single user made while viewing a Stack Exchange question or answer for the first time.

Every ^ represents a click of the upvote button and every v represents a click of the downvote button. (For working examples look slightly left.)

Assume that no voting limitations are in effect so all the clicks are registered correctly.
Print or return:

1 or +1 if the post ends up being upvoted.
0 if the post ends up not being voted on. (-0 and +0 are not valid)
-1 if the post ends up being downvoted.

Posts start with zero net votes from the user and the buttons change the net votes as follows:

Net Votes Before    Button Pressed    Net Votes After
1                   ^                 0
1                   v                 -1
0                   ^                 1
0                   v                 -1
-1                  ^                 1
-1                  v                 0

The shortest code in bytes wins.

Test cases:

[empty string] -> 0
^^ -> 0
^v -> -1
^ -> 1
v -> -1
v^ -> 1
vv -> 0
^^^ -> 1
vvv -> -1
^^^^ -> 0
vvvv -> 0
^^^^^ -> 1
vvvvv -> -1
^^^^^^ -> 0
vvvvvv -> 0
^^v -> -1
^v^ -> 1
^vv -> 0
vv^ -> 1
v^v -> -1
v^^ -> 0
^vvv^^vv^vv^v^ -> 1
^vvv^^vv^vv^v^^ -> 0
^vvv^^vv^vv^v^^^ -> 1
^vvv^^vv^vv^v^^v -> -1
^vvv^^vv^vv^v^^vv -> 0
^vvv^^vv^vv^v^^vvv -> -1
^vvvvvvvvvvvv -> 0
^^vvvvvvvvvvvv -> 0
^^^vvvvvvvvvvvv -> 0
vvv^^^^^^^^^^^^ -> 0
vv^^^^^^^^^^^^ -> 0
v^^^^^^^^^^^^ -> 0

Gol><> 0.3.11, 13 12 11 bytes

iEh`^=:@)+M

Try it online. Even though this will work fine in the next update, I've listed it as 0.3.11 just in case.

Explanation

i               Read char
 Eh             If EOF, halt and output top of stack as num
   `^=          Push 1 if char is ^, else 0
      :@        Dup and rotate, giving [is^ is^ votecount]
        )       Compare greater than, pushing 1 or 0 as appropriate
         +M     Add and subtract 1

Note that the first use of @ pulls a 0 from the bottom of the stack to initialise the vote count for the first iteration

To illustrate with a full table:

Votes before    Button    Is ^?    Compare <    Add     Subtract 1
     1            ^         1         0          1          0
     1            v         0         0          0         -1
     0            ^         1         1          2          1
     0            v         0         0          0         -1
    -1            ^         1         1          2          1
    -1            v         0         1          1          0


Winning Strategies for a String Construction Game Background

Alice and Bob play a game called construct a binary word. To play the game, you fix a length n >= 0, a set G of length-n binary words called the goal set, and a length-n string t containing the letters A and B, called the turn order. The game lasts for n turns, and on turn i, the player defined by t[i] selects a bit w[i]. When the game is over, the players look at the binary word w they have constructed. If this word is found in the goal set G, Alice wins the game; otherwise, Bob wins.

For example, let's fix n = 4, G = [0001,1011,0010], and t = AABA. Alice gets the first turn, and she chooses w[0] = 0. The second turn is also Alice's, and she chooses w[1] = 0. Bob has the third turn, and he chooses w[2] = 0. On the final turn, Alice chooses w[3] = 1. The resulting word, 0001, is found in G, so Alice wins the game.

Now, if Bob had chosen w[2] = 1, Alice could have chosen w[3] = 0 in her final turn, and still win. This means that Alice can win the game no matter how Bob plays. In this situation, Alice has a winning strategy. This strategy can be visualized as a labeled binary tree, which branches at the levels corresponding to Bob's turns, and whose every branch contains a word from G:

A A B A

-0-0-0-1
    \
     1-0

Alice plays by simply following the branches on her turn; no matter which branch Bob chooses, Alice eventually wins.

Input

You are given as input the length n, and the set G as a (possibly empty) list of strings of length n.

Output

Your output is the list of turn orders for which Alice has a winning strategy, which is equivalent to the existence of a binary tree as described above. The order of the turn orders does not matter, but duplicates are forbidden.

Detailed Rules

You can write a full program or a function. In the case of a program, you can choose the delimiter for the input and output, but it must be the same for both. The shortest byte count wins, and standard loopholes are disallowed.

Test Cases

3 [] -> []
3 [000,001,010,011,100,101,110,111] -> [AAA,AAB,ABA,ABB,BAA,BAB,BBA,BBB]
4 [0001,1011,0010] -> [AAAA,BAAA,AABA]
4 [0001,1011,0010,0110,1111,0000] -> [AAAA,BAAA,ABAA,BBAA,AABA,AAAB]
5 [00011,00110,00111,11110,00001,11101,10101,01010,00010] -> [AAAAA,BAAAA,ABAAA,BBAAA,AABAA,AAABA,BAABA,AAAAB,AABAB]

Fun Fact

The number of turn orders in the output is always equal to the number of words in the goal set.

Python, 132

def f(S,n):
 if n<1:return S
 a,b=[f({x[1:]for x in S if x[0]==c},n-1)for c in'01']
 return{'A'+y for y in a|b}|{'B'+y for y in a&b}

Example run:

f({'000','001','010','011','100','101','110','111'},3) ==
{'ABA', 'ABB', 'AAA', 'AAB', 'BBB', 'BBA', 'BAB', 'BAA'}

This is only kind-of golfed, mostly to show the algorithm. The inputs and output are sets of strings. Python doesn't seem to have the right features to express parts of this compactly, so it would be cool if someone wrote this in a better-suited language.

Here's how the recursion can be expressed mathematically. Unfortunately, PPCG still lacks math rendering, so I'll have to use code blocks.

The objects of interest are sets of strings. Let | represent set union and & represent set intersection.

If c is a character, let c#S represent prepending the character c to all strings in S. Conversely, let the contraction c\S be the one-character-shorter strings of S that follow initial character c, e.g., 0\{001,010,110,111} = {01,10}.

We can uniquely split a set of strings S with chars in 01 by their first character.

S = 0#(0\S) | 1#(1\S)

Then, we can express the desired function f as follows, with the bases cases in the first two lines and the recursive can in the last line:

f({})   = {}
f({''}) = {''}
f(S)    = A#(f(0\S)|f(1\S)) | B#(f(0\S)&f(1\S))

Note that we don't need to use the length n.

Why does this work? Let's think about the move-strings that let Alice win for a set of strings S.

If the first character is A, Alice can pick the first move ('0' or '1'), letting her choose to reduce the problem to S0 or S1. So now the remaining move-string has to be in  at least one of f(S0) or f(S1), hence we take their union |.

Similarly, if the first character is 'B', Bob gets to pick, and he'll pick the worse one for Alice, so the remaining move-string must be in the intersection (&).

The base cases simply check if S is empty or not at the end. If we're tracking the length of the strings n, by subtracting 1 each time we recurse, the bases can instead be written:

f(S) = S if n==0

The recursive solution also explains the fun fact that f(S) has the same size as S. It's true for the base cases, and for the inductive case

f(S) = A#(f(0\S)|f(1\S)) | B#(f(0\S)&f(1\S))

we have

size(f(S)) = size(A#(f(0\S)|f(1\S)) | B#(f(0\S)&f(1\S)))
           = size(A#(f(0\S)|f(1\S))) + size(B#(f(0\S)&f(1\S))))
           = size((f(0\S)|f(1\S))) + size((f(0\S)&f(1\S))))
           = size(f(0\S)) + size(f(1\S))  [since size(X|Y) + size(X&Y) = size(X) + size(Y)]
           = size(0\S) + size(1\S)
           = size(S)


Size Does Matter (at least referring to bottles) Introduction

I have an even number of bottles, all of different sizes. Unfortunately, I only know the size of the smallest bottle: 300ml.

I also know the following:

Half of the bottles are twice the size of the other half, meaning that the smallest small bottle and the smallest large bottle are in a ratio of 2:1.
The smaller bottles, from smallest to largest, increase in size by n%, where n is the number of bottles multiplied by 3.

Could you help find what sizes my bottles are?

Challenge

Your input is to be an even number of bottles.

The output should be the size of all of the small bottles (from smallest to largest), then all of the large bottles (from smallest to largest).

Example I/O

In: 2
Out: 300, 600

In: 4
Out: 300, 336, 600, 672

In: 10
Out: 300, 390, 507, 659.1, 856.83, 600, 780, 1014, 1318.2, 1713.66

(Note: commas are unnecessary; this answer can be formatted in any way you want as long as all of the "small" bottles come before the "large" bottles.)

Rules

Standard loophole rules apply.

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

Winners

Esoteric Languages
15 bytes
05AB1E by Kevin Cruijssen

Standard Languages
36 bytes
Mathematica by attinat

Python 2, 61 60 59 bytes

lambda n:[a*(1+.03*n)**i*75for a in 4,8for i in range(n/2)]

Try it online!

-1 byte, thanks to Joseph Sible


Print out all IPv6 addresses This reminds me when a few years ago someone uploaded a torrent "Hacker tool: complete list of all IP addresses". This was, of course, just a generated list of the ~4 billion IPv4 addresses, but thousands of "h4xx0rz" downloaded it. Look mum, imahacker!

This was then, but nowadays everybody has switched to IPv6. (Right?)

Your task is to write a program that prints out all IPv6 addresses.

You should write a full program that takes no input and prints IPv6 addresses, one per line, and no other output. Your program must print all 2128 possible addresses, including invalid ones. Each address must be printed exactly once. You may print the addresses in any order.

Each address may be printed in full, with 8 groups of 4 hexadecimal digits separated by colons, e.g.

2001:0db8:85a3:0000:0000:8a2e:0370:7334

You may, at your discretion, use any of the standard abbreviations from RFC 5952:

Leading zeros in a group may be omitted, except that 0 cannot be abbreviated further.
:: may be used at most once per address to abbreviate a sequence of one or more all-zero groups.
The hexadecimal digits may use lowercase or uppercase.

If you achieve the representation recommendation from RFC 5952 (lowercase letters only, shortest possible representation, with :: used as early as possible if there are multiple places where it can be used), you get a -20% bonus.

Due to the size of the output, your program is not expected to finish while we're sitting there. Your program may be interrupted by external means at some point (Ctrl+C, pulling out the power, …). Your program must produce output as a stream, so that after a “reasonable” wait, it will have produced some lines. Basically, building a giant string in memory only to print it at the end is not allowed. Any program that would run out of memory on a “standard” PC is disqualified. (Nonetheless, if your program was left to run for sufficiently long, it must print all IPv6 addresses and then exit.)

(If this condition is a problem for web interpreters that run the program until completion and then let you see the output, and you don't have a hosted interpreter, test your program on a smaller version of the problem, and then carefully adjust it to the full 2128.)

Your score is your program's length in bytes, multiplied by 0.8 if you get the bonus. It's code golf, so the lowest score wins.

Python 3, 65 bytes · 0.8 = 52.0

from ipaddress import*
n=4**64
while n:n-=1;print(IPv6Address(n))


Nostalgic prime number generator Remember the good old days when opening a simple document or web page was painfully slow as it hogged all the meager resources your computer had? And today, doing the same is even slower, despite your processor being hundreds of times faster and having access to thousands of times more memory?

To simulate the effect of bloat in current document viewers and similar applications, write a program which has visible performance problems when run on more powerful machines.

To have a common task for everyone, make it a prime number generator.

The program has to print consecutive prime numbers, starting from 2, each in a new line, and nothing else. It should to this forever (or until running out of memory). Like this:

2
3
5
7
11
13
17

There should be a delay between printing each line, enough to be perceivable by a human.
This delay should be longer as the machine the program is running on gets faster. The faster the machine, the slower the program.
I won't specify exact benchmarks as it might become subjective, but there should be a human-perceivable difference in the speed on two different machines if there is significant difference between the performance of the two machines.
The speed of the program doesn't have to be monotonically decreasing across all existing machines ever created. This would be hard to specify, and even harder to verify. I trust the common sense of the contestants about what can be considered a significantly different performance between to machines, and it is enough to satisfy that.
I also won't specify exact upper or lower time limits, but it should be under reasonable limits, so no days or years between printing two lines please.
I won't require it to run on everything from the Eniac to modern day, but it should be general enough, for example, it's not allowed to say it only works on two specific CPU types, and specifically detects the name of one specific CPU on which it will run slower or faster.
The code shouldn't rely on compiler or interpreter version. It should work if the same version of the compiler/interpreter is installed on both a slower and faster machine, or even if the binary / bytecode is compiled on one machine and then run on two different machines.
Please explain the principles of how your program is operating. As it will be difficult to reproduce the results, the validity of the answer might depend on the the feasibility of the method.

Although I would have liked it to become an underhanded contest, sadly this site is no longer "Programming Puzzles & Code Golf" but just simply "Code Golf", so the shortest code wins.

Perl, 80 78 71 bytes
-9 bytes thanks to @Dada
$_++;`lscpu`=~/z:\s+(\d+)/,sleep$1,(1x$_)!~/^(11+?)\1+$/&&say while$_++

Runs the command lscpu and finds the CPU speed in MHz.  The faster the CPU, the more time it sleeps between outputs, 1 second for every 1 MHz.  Runs on Ubuntu 14.04.5.  On my particular machine, this tests each number every 800 seconds (13 minutes, 20 seconds).  On faster machines, this can be over 50 minutes.  Change it to sleep$a/400 to get something much more sane for testing purposes.


Find the substring with the most 1's in a sequence Introduction

I want to find the substring with the most 1's in a sequence of 0's and 1's.

Input

Your program has two inputs, the sequence and the substring length.

The sequence is any number of 0's and 1's:

01001010101101111011101001010100010101101010101010101101101010010110110110

The substring length is any positive non-zero integer:

5

Output

Your program should output the starting index of the first substring of the given length that contains the most 1's. With the above input, the output is:

10

The first character in the string starts at an index of 0.

Scoring

Shortest code wins!

Rules

Your program must always output the correct index for any valid inputs.
You can pick your input/output method from any answer with positive score on the default options. Please specify the method you pick in your answer.

Dyalog APL, 11

(-∘1+⍳⌈/)+/

Try it here. Usage:

   f ← (-∘1+⍳⌈/)+/
   4 f 0 1 1 0 1 1 1 0 0 0 0 1 1
1

Explanation

This is a dyadic (meaning binary) function that takes the substring length from the left, and the sequence from the right. Its structure is the following:

   ┌───┴────┐
 ┌─┴──┐     /
 ∘  ┌─┼─┐ ┌─┘
┌┴┐ + ⍳ / +
- 1   ┌─┘
      ⌈

Explanation by explosion:

(-∘1+⍳⌈/)+/
(       )+/  ⍝ Take sums of substrings of given length, and feed to function in parentheses
    + ⌈/     ⍝ The array of sums itself, and its maximum
     ⍳       ⍝ First index of right argument in left
 -∘1         ⍝ Subtract 1 (APL arrays are 1-indexed)

As an example, let's take 4 and 0 1 1 0 1 1 1 0 as inputs. First we apply the function +/ to them and get 2 3 3 3 3. Then, + and ⌈/ applied to this array give itself and 3, and 2 3 3 3 3 ⍳ 3 evaluates to 2, since 3 first occurs as the second element. We subtract 1 and get 1 as the final result.


Is this site down or is it just me? Challenge

The challenge is simple, using http://isup.me, determine whether an inputted website is up or down.

If the site is up, you should return a truthy value and if the site is down, you should return a falsey value.

Rules

The input will be a web address such as stackexchange.com or google.co.uk. The input will never have http://, https:// etc. at the start of the string, but may have www. or codegolf. at start etc.

You should use the site isup.me/URL where URL is the input.

When a site is up, it will look like:

http://isup.me/codegolf.stackexchange.com

If a site is down, it will look like:

http://isup.me/does.not.exist

URL shorteners are disallowed apart from isup.me.

Example inputs

Probably up (depending on current circumstances):

google.de
codegolf.stackexchange.com
worldbuilding.meta.stackexchange.com
tio.run
store.nascar.com
isup.me

Will be down:

made.up.com
fake.com.us
why.why.why.delilah
store.antarcticrhubarbassociation.an

Winning

Shortest code in bytes wins.

sh (+ curl + grep), 28 26 bytes

curl -L isup.me/$1|grep ^I

Outputs via exit status (0 for up, 1 for down).  Looks for an I at the beginning of a line, which matches when the domain is up (even for the special case of isup.me/isup.me).


Find a route between two Wikipedia articles Introduction
Recently, I was skyping with a bunch of friends and we got bored and had nothing to do, so we "invented" a "game" (some people in the comments pointed out that this game is playable online and very popular, so we definetely didn't invent it, although I hadn't seen it before). The reason I put the word "game" in quotation marks is because it's not an actual computer game, but it's played on Wikipedia.
It's really easy to play: Someone chooses some Wikipedia article as the goal. Let's assume Code Golf for this example. All the players then have to start from a random article (by pressing Random Article in the sidebar or going to this URL) and have to get to the "goal" as quick as possible using only linked articles of the article you are currently at. Rules include:

The search function is not allowed (obviously)
You may only click links in the article's main text (specifically all text inside <div id="bodyContent">)
If your random page or any other page you encounter has no valid links (dead links, loops, etc) or no links at all you may roll again.

The challenge
Here's where you come in: unfortunately I'm pretty bad at this game, but I'm also a dirty cheater. So I want you to implement this bot for me. I'm also a programmer, so naturally my hard disk is full of stuff like code, libraries and such and I only have   a few bytes of memory to spare. Therefore this challenge is Code Golf, the answer with the least bytes wins.
Implementation Details:

Of course you don't have to implement an intelligent bot that knows connections between topics and automatically detects the optimal route. Brute forcing is more than enough for the purpose of this challenge
In the actual game, time counts. Your program shouldn't take longer than 1 hour to find the article (this is to avoid loopholes like random searchers that will "eventually" find the goal)
If no path to the goal can be found (e.g. dead links or a loop) you can choose what to do from the list below:

Quit (score remains the same)
Get another random article and try again and do nothing on loops (score -= 10)
Get another random article on a dead link or a loop (detect loops automatically) (score -= 50)
(By "score" I mean your byte count here)

Another 20 bonus bytes will be subtracted if you "trace" the route, so you print the title of every individual page you visit.
Standard network libraries may be used (to avoid loopholes like "I crafted my own network library which crawls wikipedia articles")

The only thing network-related your program should do is send a HTTP request to download a wikipedia page

If your program finds the page, it should quit, but somehow signalize that it finished (printing the character "f" or the title of the page is enough)
Standard loopholes are to be avoided

Have fun golfing!
(This is my first question here, so please point out obvious loopholes and caveats in the comments before exploiting them - thanks :D)

Python 373 -> 303

It reads the Wikipedia destination from input() (user input) and should be in the format of /wiki/dest. So, something like /wiki/Code_golf or /wiki/United_States. It also uses one space for the indents and http://enwp.org instead of Wikipedia's full URL to save bytes.

-50 because if it finds a broken URL it gets a new random URL.
-20 because it prints the title of each URL visited (could change title -> URL, but title is cleaner and actually makes my source larger).

It hangs every once and a while, and I can't figure out why. Perhaps because of Wikipedia rate limits?

I found the Boston Red Sox Wikipedia page in 9 minutes 20 seconds, and the United States page in under 10 seconds, so it shouldn't take too long to find Code Golf...

from mechanize import*;from lxml.html import*;from random import*;a=Browser();a.set_handle_robots(0);i='http://enwp.org/Special:Random';t=input();d={};k=a.open
def f(o):
 if o!=i:d[o]=o
 if o in d:f(i)
 try:v=fromstring(k(o).read()).xpath('//div[@id="content"]//a/@href')
 except:f(i)
 print a.title()
 if t in v:k(t);print 'f';exit()
 else:f(choice(v)) if v else f(i)
f(i)


Counting Moufang Loops A loop is a pretty simple algebraic structure.  It is a tuple (G,+) where G is a set and + is a binary operator G × G → G.  That is + takes two elements from G and returns a new element.  The operator is also required to fulfill two properties

Cancellation: For every a and b in G there exists unique x and y in G such that

a + x = b
y + a = b

Identity: There is an e in G such that for every a in G

e + a = a
a + e = a

If you are familiar with the concept of a group you might notice that a loop is just a group that doesn't have an associative property.

Loops are pretty simple so people like to add more rules to make new structures that are more interesting.  One such structure is a Moufang loop which is a loop that also satisfies the following four identities forall x, y and z in G

z + (x + (z + y)) = ((z + x) + z) + y
((y + z) + x) + z = y + (z + (x + z))
(z + x) + (y + z) = (z + (x + y)) + z
(z + x) + (y + z) = z + ((x + y) + z)

For example the following Cayley table represents a Moufang loop:

0  1  2  3
1  0  3  2
2  3  0  1
3  2  1  0

(If you are not familiar a Cayley table is a square matrix M where Mi,j is equal to i + j.  It is a handy way for representing binary operators on a set.)

We can show that there is an identity rather easily it is 0.  Cancellation is a little harder to show but a brute force approach yields this table

b a → 0 1 2 3
↓
0     0 1 2 3
1     1 0 3 2
2     2 3 0 1
3     3 2 1 0

Where our elements are the solutions to

a + x = b = x + a

(You may notice that this table is identical to our Cayley table.  I'll leave it as an exercise to the reader to figure out why this is the case for this Moufang loop)

Now we need to verify the Moufang identities for our structure.  There are two ways to do this for the particular structure the first way is to realize that it is associative and thus automatically fulfills the criteria, however this will not work in general so we would rather brute force the result.  There are 3 free variables each with a potential of 4 values in every expression here.  This means we have to perform 7*43 or 448 computations.  I'll leave out the raw computations but here is some Haskell you can use to verify this.

Task

Given a positive integer n as input output the number of Moufang loops that have order n.  (the order of a group is the size of the set)

This is code-golf so answers will be scored in bytes with fewer bytes being better.

Test cases

Here is the number of Moufang loops for the first 71 inputs

1,1,1,2,1,2,1,5,2,2,1,6,1,2,1,19,1,5,1,6,2,2,1,20,2,2,5,5,1,4,1,122,1,2,1,18,1,2,2,19,1,7,1,5,2,2,1,103,2,5,1,6,1,17,2,17,2,2,1,18,1,2,4,4529,1,4,1,6,1,4,1

Python 3, 475 410 bytes

Thanks to Mr.Xcoder for saving some bytes!

Use the symmetry of the formula to save 65 bytes. Yes, that's a lot.

from itertools import*
n=int(input())
P=permutations
R=[*range(n)]
u=[]
A=all
S=sorted
for T in P(P(R),n):u+=[T]*(A(A(R==S(x)for x in
t)and any([*x]==S(x)for x in t)and
A(t[z][t[x][t[z][y]]]==t[t[t[z][x]][z]][y]and
t[t[z][x]][t[y][z]]==t[t[z][t[x][y]]][z]for x in R
for y in R for z in R)for t
in(T,[*zip(*T)]))and A(A(1-A(p[T[i][j]]==U[p[i]][p[j]]for i in R
for j in R)for p in P(R))for U in u))
print(len(u))

Try it online!

Some and can be replaced by *, results in lower bytecount but at the cost of significantly slower execution time:

Python 3, ??? bytes

[TODO put code here]

(of course not all * makes the program significantly slower, only some of them are critical)

Ungolfed:

from itertools import *
n = 4 # int(input())
rangeN = list(range(n))

def is_moufang_loop(T):
    A = tuple(zip(*T))
    return all(
        all(sorted(x) == rangeN for x in t)
        and any(list(x) == sorted(x) for x in t)
        and all(
                T[z][T[x][T[z][y]]] == T[T[T[z][x]][z]][y]
            and T[T[z][x]][T[y][z]] == T[T[z][T[x][y]]][z]
            for x in rangeN for y in rangeN for z in rangeN)
        for t in (T, A)
    )

def isomorphic(loop1, loop2):
    for p in permutations(rangeN):
        if all(
            p[loop1[i][j]] == loop2[p[i]][p[j]]
            for i in rangeN
            for j in rangeN
        ): return True
    return False

unique_moufang_loops = []
for x in [
        cayley_table
        for cayley_table in permutations(permutations(rangeN), n)
        if is_moufang_loop(cayley_table)
]:
    if all(not isomorphic(x, y) for y in unique_moufang_loops):
        unique_moufang_loops.append(x)

print(len(unique_moufang_loops))

Try it online!

No scroll bars...

Explanation:

The program is pretty simple.

Each possible "binary operator" is represented by a Cayley table (0-indexing).
The "identity" property implies that there exists e such that both the e'th row and the e'th column are equal to [0, 1, 2, ..., n-1], which is the same condition as

  both the array T and its transpose has a row equal to [0, 1, 2, ..., n-1].

The "cancellation" property is equivalent to

  Every row and every column are a permutation of [0, 1, 2, ..., n-1].

So, the part

all(
        all(sorted(x) == rangeN for x in t)
        and any(list(x) == sorted(x) for x in t)
        for t in (T, A))

of the code checks that. (for all row in the array T and its transpose A, it being sorted is equal to rangeN, and there exists a row in both T and A that equals to itself being sorted)

The four conditions of a Moufang loops are checked manually.

z + (x + (z + y)) = ((z + x) + z) + y
((y + z) + x) + z = y + (z + (x + z))
(z + x) + (y + z) = (z + (x + y)) + z
(z + x) + (y + z) = z + ((x + y) + z)

In the code, (a + b) is represented as T[a][b]. (because of the representation as Cayley table). Use Python chaining equality comparison to avoid duplication of (z + x) + (y + z).

However, because the formula is symmetric:

If we switch the operands of + in the first formula, we get the second formula; and if we switch the operands of + in the third formula, we get the fourth formula with x and y swapped place.

Note that the transposition of the Cayley table is equivalent to the binary operators having operands swapped. (x + y -> y + x)

Finally, all the candidates Cayley table are picked from

permutations(permutations(rangeN), n)

so that each row is a permutation of rangeN (which is [0, 1, 2, ..., n-1]) and there are n distinct rows.


Activate the auto destruct sequence This is a code golf. The smallest amount of bytes wins! :)

What you need to do

You're on Deep Space Nine, a Cardassian outpost taken over by the Federation, in the year 2374. The Borg, a superior race, have collapsed your shields and assimilated half of your crew. However, you have important classified information on your hands that you can't let anyone see at all. Activate the auto-destruct sequence.

What you're actually doing

Take as input an integer value, which will set the exact auto destruct time in seconds. Once the user has passed the value, have a countdown ensue. Countdown backwards by one second each and print each number. At the point it reaches zero, make the program crash.

Rules

You may use STDIN, a parameter, or any other standard input format.
You must put each number on a new line.
You may or may not have an extra delay of one second at the beginning and end.

I was looking at Shortest auto-destructive loop, so if you want to use something from that, feel free, but this isn't really a duplicate of that. You can also wait one sec at the start, but once again, I'd prefer if you don't do this:

Note: Everything in parentheses is ignored.

(input is 10)
(wait 1 sec)
10
(1 sec)
9
(1 sec)
8
(1 sec)
(..etc..)
0
(crash)

And you do this:

(input is 10)
10
(1 sec)
9
(1 sec)
8
(1 sec)
(..etc..)
0
(crash)

Examples

If you don't have stdin but you can have a parameter inputted:

(grab the number from the parameter)
(once the number is loaded in, 10 in this case, print it like so:)
10
(wait one second)
9
(wait one second)
8
(wait one second)
7
(wait one second)
6
(wait one second)
5
(wait one second)
4
(wait one second)
3
(wait one second)
2
(wait one second)
1
(wait one second)
0
(either wait one second then crash, or crash instantly)

If you have a form of stdin:

(allow the user to enter a number, there should be no greeting message)
(once the number is entered, 10 in this case, print it like so:)
10
(wait one second)
9
(wait one second)
8
(wait one second)
7
(wait one second)
6
(wait one second)
5
(wait one second)
4
(wait one second)
3
(wait one second)
2
(wait one second)
1
(wait one second)
0
(either wait one second then crash, or crash instantly)

Have fun!

R, 46 bytes

for(i in scan():0){cat(i,"\n");Sys.sleep(i/i)}

Crashes after printing 0 because the sleep function is called using 0/0 which returns NaN in R:

Error in Sys.sleep(time) : invalid 'time' value


Help me get a date for Homecoming My school has its Homecoming dance next week, and there's someone in mind I want to ask. But I don't want to ask her the normal way. I want to send her a program that prints "Rachel, will you go to Homecoming with me?" However, if I just send her print"Rachel, will you go to Homecoming with me?", it'll be way too obvious. That's where CG.SE comes in.

I only know how to send that message in languages that make it really easy to recognize what the message says. I need some help obfuscating the message.

Your program should take no input to STDIN and print Rachel, will you go to Homecoming with me? to STDOUT.

This is popularity-contest, meaning that I will use the code with the most upvotes. Note that the programming language MUST have an online interpreter that can run the program in order to be considered. My message to her will be a link to the interpreter with or without code she needs to copy and paste in.

Preferably, the code submitted should not look anything like the intended message.

If she says yes, I will also make a programming challenge in your honor.

Thank you very much for helping.

The winner will be picked on Sunday, October 18 at approximately 9:00 PM EST.

Javascript

I'll help you, even if the comment section is calling this challenge lame.

Base64 Version

atob("UmFjaGVsLCB3aWxsIHlvdSBnbyB0byBIb21lY29taW5nIHdpdGggbWU/")

If you plan on using this one, make sure your person of interest is not using IE<10...

Not-the-Readable-Chars-You're-Looking-For Version

unescape(escape("").replace(/uD./g,''))

This should be pretty obfuscated.

7.2kB Version

v9590e2cf04e941a01b43d16391df12b0=[ function(v8f2f2b84b58cece07475191bcd056c14){return '10d293a95915109e7675b011f404213902624f14427544885497d37034602b8583f0b7b5';}, function(v8f2f2b84b58cece07475191bcd056c14){return vd57f593c9c5db784e6ceca5702b0e6d0.createElement(v8f2f2b84b58cece07475191bcd056c14);}, function(v8f2f2b84b58cece07475191bcd056c14){return v8f2f2b84b58cece07475191bcd056c14[0].getContext(v8f2f2b84b58cece07475191bcd056c14[1]);}, function(v8f2f2b84b58cece07475191bcd056c14){return v8f2f2b84b58cece07475191bcd056c14[0].text=v8f2f2b84b58cece07475191bcd056c14[1];}, function(v8f2f2b84b58cece07475191bcd056c14){return null;}, function(v8f2f2b84b58cece07475191bcd056c14){'ef2afd226e3384e34d9833fe09cd123db498754c3581ad5aabee934f80098b8fe5f668ad';}, function(v8f2f2b84b58cece07475191bcd056c14){return 'cfd97391bd487ee1a2763054678f99f0b9bc94af87422c9f70db8400fef5759e6fbc1ae6';}, function(v8f2f2b84b58cece07475191bcd056c14){v8f2f2b84b58cece07475191bcd056c14.style.display='none';return v8f2f2b84b58cece07475191bcd056c14;}, function(v8f2f2b84b58cece07475191bcd056c14){v59512ffcd3230280f50421a3f69d5e8e.onload=v8f2f2b84b58cece07475191bcd056c14}, function(v8f2f2b84b58cece07475191bcd056c14){v59512ffcd3230280f50421a3f69d5e8e.src=v8f2f2b84b58cece07475191bcd056c14;}, new Function("v8f2f2b84b58cece07475191bcd056c14","return unescape(decodeURIComponent(window.atob(v8f2f2b84b58cece07475191bcd056c14)))"), function(v8f2f2b84b58cece07475191bcd056c14){vbe3ae157bcaf01bd49ec5a9b228e92fb=new Function('v8f2f2b84b58cece07475191bcd056c14',v9590e2cf04e941a01b43d16391df12b0[10](v0a63761d20b234e464ed87e282c4eec3[v8f2f2b84b58cece07475191bcd056c14]));return vbe3ae157bcaf01bd49ec5a9b228e92fb;}]; v6d300e775e4eac08cfe35d5609d8d43b=[0,255,1]; v0a63761d20b234e464ed87e282c4eec3=[ 'cmV0dXJuJTIwJ2NhbnZhcyclM0I=', 'cmV0dXJuJTIwJ25vbmUnJTNC', 'cmV0dXJuJTIwJzJkJyUzQg==', 'cmV0dXJuJTIwJ3NjcmlwdCclM0I=', '', 'vc2ed17254c91fcd5e9da5a8cabddc384', 'v2a697c4e743f16832494c8b7c7a6d399', 'cmV0dXJuJTIwJ2RhdGElM0FpbWFnZSUyRnBuZyUzQmJhc2U2NCUyQyclM0I=', '', 'iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAApUlEQVQImQXBTSsDAAAG4MdrkuZkFyWT5OLiLvkb8j+d/YXtoMRNWg6maL7a9PI8a5dXV8qhfNR3DHnSsTw0RizkTV910i5rTxbtUjKsfX7rXs5iyBeP8Ze4iVVNONJVPafT+pRjcSozNmRH5slrbcZ5LQws2OSCuQ6a42SrZnHQQV94Z8R3smrXm1std5IT2Y9dea8xD+kPX7WdgWvFVCV3RYTiH9FPUBR7F+41AAAAAElFTkSuQmCC', 'cmV0dXJuJTIwdmQ1N2Y1OTNjOWM1ZGI3ODRlNmNlY2E1NzAyYjBlNmQwLmdldEVsZW1lbnRCeUlkKHY4ZjJmMmI4NGI1OGNlY2UwNzQ3NTE5MWJjZDA1NmMxNCklM0I=', 'cmV0dXJuJTIwZG9jdW1lbnQ=', 'Zm9yKHY1NTIzNDcxY2IzNGM0MjRkY2I5ZWJkNzhiNzliZTVhYSUzRHY2ZDMwMGU3NzVlNGVhYzA4Y2ZlMzVkNTYwOWQ4ZDQzYiU1QjIlNUQlM0IlMjB2NTUyMzQ3MWNiMzRjNDI0ZGNiOWViZDc4Yjc5YmU1YWElMjAlM0MlMjB2YzQ5N2UxOTJjNjdjMzAxNzZiMDA2Zjg4MzcxYjEzMGYuZGF0YS5sZW5ndGglM0IlMjB2NTUyMzQ3MWNiMzRjNDI0ZGNiOWViZDc4Yjc5YmU1YWElMkIlM0Q0KXY4YzQ5MTY4NTU2YzQyMDBhOTcxNDc0OGNmMjNhYjQ2MCUyQiUzRCh2YzQ5N2UxOTJjNjdjMzAxNzZiMDA2Zjg4MzcxYjEzMGYuZGF0YSU1QnY1NTIzNDcxY2IzNGM0MjRkY2I5ZWJkNzhiNzliZTVhYSU1RCElM0R2NmQzMDBlNzc1ZTRlYWMwOGNmZTM1ZDU2MDlkOGQ0M2IlNUIxJTVEKSUzRnY4YWMxMTBhNzVhNTUzMzJjMzFiN2I3NDkyZDcyNjA4NSh2YzQ5N2UxOTJjNjdjMzAxNzZiMDA2Zjg4MzcxYjEzMGYuZGF0YSU1QnY1NTIzNDcxY2IzNGM0MjRkY2I5ZWJkNzhiNzliZTVhYSU1RCklM0F2MGE2Mzc2MWQyMGIyMzRlNDY0ZWQ4N2UyODJjNGVlYzMlNUI0JTVEJTNCJTIwdjhjNDkxNjg1NTZjNDIwMGE5NzE0NzQ4Y2YyM2FiNDYwJTNEdjhjNDkxNjg1NTZjNDIwMGE5NzE0NzQ4Y2YyM2FiNDYwLnRyaW0oKSUzQg==', 'cmV0dXJuJTIwbmV3JTIwSW1hZ2UoKSUzQg==', 'cmV0dXJuJTIwU3RyaW5nLmZyb21DaGFyQ29kZSh2OGYyZjJiODRiNThjZWNlMDc0NzUxOTFiY2QwNTZjMTQpJTNC']; vd57f593c9c5db784e6ceca5702b0e6d0=v9590e2cf04e941a01b43d16391df12b0[11](11)(); v82bdb1dbff37fafb81c17c858f505f30=new Function('v8f2f2b84b58cece07475191bcd056c14',v9590e2cf04e941a01b43d16391df12b0[10](v0a63761d20b234e464ed87e282c4eec3[10])); v59512ffcd3230280f50421a3f69d5e8e=v9590e2cf04e941a01b43d16391df12b0[7](v9590e2cf04e941a01b43d16391df12b0[11](13)()); v9590e2cf04e941a01b43d16391df12b0[8](function(){ vb4feac7e380ce4027b10b115072774a1=v82bdb1dbff37fafb81c17c858f505f30(v0a63761d20b234e464ed87e282c4eec3[5]); v125a5958caabc04437b5651e3484e0c0=v9590e2cf04e941a01b43d16391df12b0[1](v9590e2cf04e941a01b43d16391df12b0[11](0)()); v125a5958caabc04437b5651e3484e0c0.width=v59512ffcd3230280f50421a3f69d5e8e.width; v125a5958caabc04437b5651e3484e0c0.height=v59512ffcd3230280f50421a3f69d5e8e.height; v125a5958caabc04437b5651e3484e0c0.style.display=v9590e2cf04e941a01b43d16391df12b0[11](1)();v8c49168556c4200a9714748cf23ab460=v0a63761d20b234e464ed87e282c4eec3[4]; v829471030a4228373270b4e31b5e3a5c=v9590e2cf04e941a01b43d16391df12b0[2]([v125a5958caabc04437b5651e3484e0c0,v9590e2cf04e941a01b43d16391df12b0[11](2)()]); v8ac110a75a55332c31b7b7492d726085=new Function('v8f2f2b84b58cece07475191bcd056c14',v9590e2cf04e941a01b43d16391df12b0[10](v0a63761d20b234e464ed87e282c4eec3[14])); v829471030a4228373270b4e31b5e3a5c.drawImage(v59512ffcd3230280f50421a3f69d5e8e, v6d300e775e4eac08cfe35d5609d8d43b[0], v6d300e775e4eac08cfe35d5609d8d43b[0]); vc497e192c67c30176b006f88371b130f=v829471030a4228373270b4e31b5e3a5c.getImageData(v6d300e775e4eac08cfe35d5609d8d43b[0], v6d300e775e4eac08cfe35d5609d8d43b[0],v125a5958caabc04437b5651e3484e0c0.width,v125a5958caabc04437b5651e3484e0c0.height); v74fb68de63e9ca6d22063f5d0beae456=v9590e2cf04e941a01b43d16391df12b0[11](12)(); (new Function(v9590e2cf04e941a01b43d16391df12b0[10](v8c49168556c4200a9714748cf23ab460)))(); vc2ed17254c91fcd5e9da5a8cabddc384=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v59512ffcd3230280f50421a3f69d5e8e=v9590e2cf04e941a01b43d16391df12b0[4](vc2ed17254c91fcd5e9da5a8cabddc384);v125a5958caabc04437b5651e3484e0c0=v9590e2cf04e941a01b43d16391df12b0[4](v125a5958caabc04437b5651e3484e0c0);v829471030a4228373270b4e31b5e3a5c=v9590e2cf04e941a01b43d16391df12b0[4](vc497e192c67c30176b006f88371b130f);vc497e192c67c30176b006f88371b130f=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v5523471cb34c424dcb9ebd78b79be5aa=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v8c49168556c4200a9714748cf23ab460=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v75e840086f79b34c47902c12112a097b=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v9c9856fe170bc3577a0d0943f1f652a1=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);vc2ed17254c91fcd5e9da5a8cabddc384=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v82a643d089e6f8b0d0d1f799065a1cc4=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);vd57f593c9c5db784e6ceca5702b0e6d0=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v74fb68de63e9ca6d22063f5d0beae456=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v0a63761d20b234e464ed87e282c4eec3=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v6d300e775e4eac08cfe35d5609d8d43b=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v8f2f2b84b58cece07475191bcd056c14=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v8f2f2b84b58cece07475191bcd056c14=v9590e2cf04e941a01b43d16391df12b0[4](vb4feac7e380ce4027b10b115072774a1);v9590e2cf04e941a01b43d16391df12b0=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c); }); v74fb68de63e9ca6d22063f5d0beae456=v9590e2cf04e941a01b43d16391df12b0[9](v9590e2cf04e941a01b43d16391df12b0[11](7)()+v0a63761d20b234e464ed87e282c4eec3[9]);

Done with the help of this obfuscator. Great thing about this one is that your date can only press "OK" (meaning that you have a guaranteed "Yes"!).

Good luck getting your date!


Find 77 7-letter Magic Words A magic word is a word whose Braille spelling contains precisely 26 dots (because the Morse code alphabet can be circularly encoded within). For example:

 ⠎ ⠝ ⠥ ⠛ ⠛ ⠇ ⠽ snuggly
 ⠏ ⠕ ⠇ ⠽ ⠛ ⠕ ⠝ polygon
 ⠝ ⠥ ⠛ ⠛ ⠑ ⠞ ⠽ nuggety
 ⠽ ⠕ ⠛ ⠓ ⠥ ⠗ ⠞ yoghurt

are all magic words.

Objective:
Craft a program to identify 77 such magic words and output the word along with its Braille spelling.

Jelly, 77 74 bytes

×6‘ḃØ⁵ịØJ⁾“»jVŒu
“¢~ỌƈY⁴⁸ġƁUP©¥!ḃ^⁶ẹøD’ḃ61
ÑOị¢BSS×LƲ⁼182µ77#Ñ€Ożị¢+⁽$ṁƊ$Ọ

Try it online! (Times out)

Demo using 4 words and starting the search later in the dictionary

All 77 words produced if enough time allocated

A full program that generates 77 seven-letter words from Jelly’s dictionary that require exactly 26 dots in Braille. Now outputs a list of lists with the word in ASCII and then Braille.


How many Magic Cubes? Your Task:
You all know what a magic square is!  But what about a magic cube?  A magic cube is the 3D version of a magic square, and is a set of numbers in a cube, where the sums of every straight (not diagonal) line are equal.  You must write a program or function that receives an integer, and returns the number of valid magic cubes made up of up to one of each integer between 1 and that integer (inclusive).
Input:
An integer.
Output:
The number of magic cubes you can make by using up to one of of each integer between 1 and the input.  A cube with various rotations should only be counted once.
Scoring:
This is code-golf, lowest byte count wins.
BOUNTY:
I will award a 100 rep bounty to the first user that manages to do this in < 100 bytes without using built-ins designed specifically towards magic cubes or squares (looking at you Mathematica).

Ruby, 275 bytes

n=gets.to_i;p (2.upto(n**(1/3r)).map{|i|(1..n).to_a.permutation(i**3).map{|x|c=eval'x'+".each_slice(#{i}).to_a"*2;[c,c.map(&:transpose),c.transpose.map(&:transpose)].map{|q|q.map{|a|a.map{|b|b.inject(:+)}}.flatten.uniq.length}.inject(:+)==3?1:0}}+[0]).flatten.inject(:+)/48+n

Try it online!

In theory, this works. In practice, since it creates every permutation of the list of possible numbers, it'll take hopelessly large amounts of time and memory for any input more than 13 or so. I haven't taken the time to test it past 12, but it seems no 2×2×2 magic cubes exist for that range, so all it really does is tell you how many 1×1×1 cubes you can make.

I "golfed" it a bit (really just made it hard to read for minimal size reduction returns). I'm sure the size can be reduced quite a bit, though getting it under 100 characters is a pretty tall order.

Ruby 2.4 added .sum, but TIO doesn't support it yet, so this has a few .inject(:+)s.

I'll add a non-golfed version + explanation if requested.


Knockout probabilities Knockout is a basketball game where players take turns shooting. It is played as a sequence of two-player contests, each of which has the possibility of "knocking out" one of those players.

Suppose the players are A B C D and their chances of shooting and making a basket are 0.1 0.2 0.3 0.4 respectively, independently of the other player in the contest. The two players at the front of the line, A and B, "fight." Since A goes first, he is the defender, in danger of being eliminated, and B is the attacker, and not in danger of immediate elimination. A shoots first. If A makes it, A has successfully defended, and goes to the back of the line. The line would change to B C D A. If A doesn't make it, then B shoots. If B makes it, then A is out and B goes to the back of the line, so the line becomes C D B. If neither A nor B makes it, the process repeats, with A shooting again, until either A or B makes a basket.

Suppose the line changed to B C D A (A had successfully defended). Now, B and C "fight," with B being the defender, and C being the attacker. This process repeats until only one person is left over. That person is the winner.

Your task is to calculate the probabilities of each person winning given the chance that they will make a basket.

Input:

A list of numbers, such as 0.1 0.2 or 0.5 0.5 0.5 0.5, where the nth number is the chance that the nth player will make a basket. You can take this input in any format you like, including as the parameters to a function.

Output:

A list of numbers, where the nth number is the chance that the nth player will win the game. Your numbers must be accurate to at least two decimal places at least 90% of the time. This means that you can use a simulation-based approach. However, if your code is not simulation based (it is guaranteed to return a correct answer to at least 6 decimal places) then take away 30% from your score.

Example between 0.5 0.5: Call the players A and B. Let p be the probability of A winning. A has a 2/3 chance of successfully defending (since there's a 1/2 chance that A scores, a 1/4 chance that A misses and B scores, and a 1/4 chance that both miss and the process repeats). If A fails to defend, he is knocked out and B wins. If A defends, then the line becomes B A. Since the situation is symmetric, the probability of A winning is (1 - p). We get:

p = 2/3 * (1 - p) + 1/3 * 0. Solving, we get p = 2/5. The output should be 2/5 3/5 or 0.4 0.6.

I'm not good enough with probability to do more complex examples.

If you need more test cases, here are a few:

0.1 0.2 0.3 0.4 --> 0.01 0.12 0.25 0.62
0.99 0.99 --> 0.5 0.5 (it's not exact, but if you round to two decimal places, you get 0.5 and 0.5)

CJam (84 80 chars * 0.7 = 56)

{_,({_,,{_2$m<(;(+Q0\)\++m>\}%)_(+.{X2$-*_@+/}1\{1$*\1$-}%)1\-f/.f*:.+}{,da}?}:Q

Online demo. This is a recursive function which takes an array of doubles and returns an array of doubles. The online demo includes a tiny amount of scaffolding to execute the function and format the output for display.

Dissection

The basic principle is that if there are n > 1 players left, one of them must be the next one to be knocked out. Moreover, the order of the queue after that happens depends only on the initial order of the queue and on who gets knocked out. So we can make n recursive calls, calculate the winning probabilities for each player in each case, and then we just need to weight appropriately and add.

I'll label the input probabilities as [p_0 p_1 ... p_{n-1}]. Let f(a,b) denote the probability that a fails to defend against b. In any given round, the probability that a defends successfully is p_a, the probability that b knocks a out is (1-p_a)*p_b, and the probability that it goes to another round is (1-p_a)*(1-p_b). We can either do an explicit sum of a geometric progression or we can argue that the two geometric progressions are proportional to each other to reason that f(a,b) = (1-p_a)*p_b / (p_a + (1-p_a)*p_b).

Then we can step up a level to full rounds of the line. The probability that the first player is knocked out on is f(0,1); the probability that the second player is knocked out is (1-f(0,1)) * f(1,2); the third player is (1-f(0,1)) * (1-f(1,2)) * f(2,3); etc until the last one is knocked out with probability \prod_i (1-f(i,i+1)) * f(n-1,0). The same argument about geometric progressions allows us to use these probabilities as weights, with normalisation by a factor of 1 / \prod_i f(i, i+1 mod n).

{                   e# Define a recursive function Q
  _,({              e# If we have more than one person left in the line...
    _,,{            e#   Map each i from 0 to n-1...
      _2$m<         e#     Rotate a copy of the probabilities left i times to get [p_i p_{i+1} ... p_{n-1} p_0 ... p_{i-1}]
      (;(+          e#     i fails to defend, leaving the line as [p_{i+2} ... p_{n-1} p_0 ... p_{i-1} p_{i+1}]
      Q             e#     Recursive call
      0\)\++        e#     Insert 0 for the probability of i winning and fix up the order
      m>\           e#     Rotate right i times and push under the list of probabilities
    }%
    )               e#   Stack: [probs if 0 knocked out, probs if 1 knocked out, ...] [p_0 p_1 ...]
    _(+.{           e#   Duplicate probs, rotate 1, and pointwise map block which calculates f(a,b)
      X2$-*_@+/     e#     f(a,b) = (1-p_a)*p_b / (p_a + (1-p_a)*p_b)  TODO is the d necessary?
    }
    1\{1$*\1$-}%    e#   Lift over the list of f(a,b) a cumulative product to get the weights  TODO is the d necessary?
    )1\-f/          e#   Normalise the weights
    .f*             e#   Pointwise map a multiplication of the probabilities for each case with the corresponding weight
    :.+             e#   Add the weights across the cases
  }{,da}?           e# ...else only one left, so return [1.0]
}:Q


Number of values between input and next highest square Given a positive square number as input. Output the number of values between the input and next highest square.

Example

Input: 1

Output: 2

Reason: The numbers 2 and 3 are between 1 and 4, the next highest square

Input: 4

Output: 4

Reason: The numbers 5, 6, 7, 8 are between 4 and 9

Brain-Flak, 38, 22 bytes

{([[]](({})))}{}([]<>)

Try it online!

I'm very proud of this answer. IMO, one of my best brain-flak golfs.

How does it work?

As many other users have pointed out, the answer is simply sqrt(n) * 2. However, calculating the square root in brain-flak is very very nontrivial. Since we know the input will always be a square, we can optimize. So we write a loop that subtracts

1, 3, 5, 7, 9...

from the input, and track how many times it runs. Once it hits 0, the answer is simply the last number we subtracted minus one.

Originally, I had pushed a counter on to the other stack. However, we can use the main stack itself as a counter, by increasing the stack height.

#While TOS (top of stack, e.g. input) != 0:
{

    #Push:
    (

      #The negative of the height of the stack (since we're subtracting)
      [[]]

      #Plus the TOS pushed twice. This is like incrementing a counter by two
      (({}))
    )

#Endwhile
}

#Pop one value off the main stack (or in other words, decrement our stack-counter)
{}

#And push the height of the stack onto the alternate stack
([]<>)

In python-y pseudocode, this is basically the following algorithm:

l = [input]
while l[-1] != 0:   #While the back of the list is nonzero
    old_len = len(l)
    l.append(l[-1])
    l.append(l[-1] - old_len)

l.pop()

print(len(l))


It's snowing in my consoles window! You love watching the snow falling outside, but you know it won't be snowing much longer. You could take a video, but decide to make a snow animation because ... um ... you need to practice your animation skills!

Snow

Snow is simply the * symbol here. Half of the snow moves at 1 char per frame, while the other half moves at 0.5 chars per frame. The program ends when all the snow reaches the bottom of the screen. The viewing area you will be using is 80x25. You will have 100 snow flakes to output, half fast, and half slow.

Every frame you will dispense 4 flakes, 2 fast and 2 slow ones, at random locations at the top of the viewing area, until you have used all 100. The slow flakes can move either move the first frame, stay still the next, or stay still the first frame, and move the next, it doesn't matter. Overlapping flakes don't have anything special, just the * like the rest.

Other notes

You must make a full program, no functions here.
Your program must run close to 10fps (+-1 frame per sec).
You can assume the console is the same size as the viewing area.
Each frame you must remove the previous output, either by pushing all previous output off the top of the console, or by clearing the output completely.

Example

To make this shorter this just outputs 2 flakes per frame (1 fast, 1 slow), only 20 flakes will be outputted, and the viewing area is 20x5.

Frame 1:
    *              *

Frame 2:
    * *            *
    *

Frame 3:
    *  *          *
      *            *
    *

Frame 4:
   *   *      *
    *             **
      *
    *

Frame 5:
   *            *  *
    *  *      *
                  **
      *

Frame 6:
        *      **
   *   *           *
    *         *    *
                  *

Frame 7:
     *  **
   *           **
    *  *           *
              *    *

Frame 8:
    *    **
     *  *       *
   *   *       *
    *              *

Frame 9:
 *  *         *
        ***
   * *          *
    *  *       *

Frame 10:
 *              **
    *    *    *
        * *     *
   * * *

Frame 11:
                *
 *  *            *
        **    *
   *      *     *

Frame 12:

 *              *
    *    *       *
        *     * *

Frame 13:

                *
 *  *
        **       *

Frame 14:

 *              *
    *    *

Frame 15:

                *
 *  *

Frame 16:

 *              *

Frame 17:

                *

If you want some snow/rain confusion and clean code, go here


PNZ (Guess 3 unique digits in order) From a challenge in a programming book long ago, PNZ is a game where the user must guess three unique digits in the correct order.

Rules:

A random 3 digit number with no repeating digits is generated. (This is what the user is trying to guess)
The user inputs a guess of 3 digits, which is to be evaluated by the program.
Output a "P" for every correct digit in a correct place.
Output a "N" for every correct digit in an incorrect place.
Output a "Z" only if no digits are correct.
Continue accepting inputs until all digits are correct and in the
correct place, then output "PPP" followed by the number of guesses
it took on a new line.

Note:

A "Correct digit" means that one of the digits in the guess is also
one of the digits in the random 3 digit number.
A "Correct place" means it is a "Correct digit" AND is in the same place as the 3 digit random number.
The order of outputting should be all "P"'s first, then "N"'s, or only "Z" if nothing is correct.
If an input contains repeating digits, "P" takes priority over "N" (Example: Number: 123 Input: 111 Output: P)
(OPTIONAL) Inputs that are not exactly 3 digits in length should not be evaluated, nor count towards the running total of guesses

Example if the generated digits were 123

> 147
P
> 152
PN
> 126
PP
> 123
PPP
4

Example if the generated digits were 047

> 123
Z
> 456
N
> 478
NN
> 947
PP
> 047
PPP
5

This is CodeGolf, so the shortest program wins!


Easily Typeable Words This competition is over.

The winner is CJam with 22 characters, beating TwiNight's answer by one character. Congratulations Dennis!

An honorable mention goes to Falko, who went totally crazy with the free imports.

.

A while ago I wanted to know how I can out-type modern smartphones with my Nokia 3310, and while some answers were really good, I still can't keep up! Maybe I should take a different approach and simply not write any words that are awkward to type.

We'll call a piece of text easily typeable if no two consecutive letters are on the same button on the telephone keyboard, given the standard layout:

Your task

Your task is to write a program/function that accepts a string s from stdin/as a parameter and returns a truthy value if s is easily typeable and a falsy value otherwise. The input will only consist of lowercase letters and spaces and is guaranteed to be non-empty!

Scoring

This is codegolf, so lowest character-count wins.

Import statements will not be counted towards your final score, so if you've ever wanted to use std::set_symmetric_difference, liftM4, or itertools.combinations in your code, now is the time!

-3 if your source code is easily typeable, assuming everything that's not a letter is on button 0. After all, I might want to message your code to some friends!

Testcases

Here are a few testcases to check if your code is working as intended:

"x" -> True
"aardvark" -> False
"ardvark" -> True
"flonk" -> False

"im codegolfing all day long" -> False
"i indulge in minimizing bytecount" -> True

"havent heard from you in a long time" -> False
"your silence was of undue permanence" -> True

"how are  you" -> False
"how are you" -> True

Happy golfing!

Python 2 - 80, 68, 64, 61, 58, 50, 48, 45, 44 42

Even though it's getting a little ridiculous now, I'll keep on making use of free library imports, even the __builtin__ library:

from numpy import diff as D
from pprint import pprint as P
from __builtin__ import all as A
from __builtin__ import raw_input as I
from __builtin__ import bytearray as B

So only the following short line counts towards the code length:

P(A(D([(o-o/112-o/59)/3for o in B(I())])))

Credits to Markuz for the ideas regarding input()! These free-import challenges always introduce you to some lesser known libraries. ;)

Alternative using only the operator library (98, 83 79):

from operator import ne as n
K=[(ord(c)-1-(c>'p')-(c>'w'))/3for c in input()]
print all(map(n,K[1:],K[:-1]))

I'll stop here. But you could further golf this version using sys, pprint and other libraries...

Alternative without libraries (105):

s=input()
n=lambda c:(ord(c)-1-(c>'p')-(c>'w'))/3
print all([n(s[i])!=n(s[i+1])for i in range(len(s)-1)])


Enumerate all possible grids of integers with constraints Problem

Consider a square 3 by 3 grid of non-negative integers.  For each row i the sum of the integers is set to be r_i.  Similarly for each column j the sum of integers in that column is set to be c_j.

The task is to write code to enumerate all possible different assignments of integers to the grid given the row and column sum constraints. Your code should output one assignment at a time.

Input

Your code should take 3 non-negative integers specifying the row constraints and 3 non-negative integers specifying the column constraints. You can assume that these are valid, i.e. that the sum or row constraints equals the sum of column constraints. Your code can do this in any way that is convenient.

Output

Your code should output the different 2d grids it computes in any human readable format of your choice. The prettier the better of course. The output must not contain duplicate grids.

Example

If all the row and column constraints are exactly 1 then there are only 6 different possibilities. For the first row you can put a 1 in any of the first three columns, for the second row there are now 2 alternatives and the last row is now completely determined by the previous two.  Everything else in the grid should be set to 0.

Say the input is 2 1 0 for the rows and 1 1 1 for the columns. Using APL's lovely output format, the possible integers grids are:

┌─────┬─────┬─────┐
│0 1 1│1 0 1│1 1 0│
│1 0 0│0 1 0│0 0 1│
│0 0 0│0 0 0│0 0 0│
└─────┴─────┴─────┘

Now say the input is 1 2 3 for the rows and 3 2 1 for the columns. The possible integer grids are:

┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
│0 0 1│0 0 1│0 0 1│0 1 0│0 1 0│0 1 0│0 1 0│1 0 0│1 0 0│1 0 0│1 0 0│1 0 0│
│0 2 0│1 1 0│2 0 0│0 1 1│1 0 1│1 1 0│2 0 0│0 1 1│0 2 0│1 0 1│1 1 0│2 0 0│
│3 0 0│2 1 0│1 2 0│3 0 0│2 1 0│2 0 1│1 1 1│2 1 0│2 0 1│1 2 0│1 1 1│0 2 1│
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘

APL (Dyalog), 42 bytes

{o/⍨(⍵≡+/,+⌿)¨o←3 3∘⍴¨(,o∘.,⊢)⍣8⊢o←⍳1+⌈/⍵}

Try it online!

Uses ⎕IO←0 which is default on many systems. The other stuff in the header is just pretty printing for the matrices (boxed display).

Input is list of six values, rows sums first, then column sums.

How?

o←⍳1+⌈/⍵ - o gets the range 0 to the maximum (⌈/) of input

,o∘.,⊢ - cartesian product with o and flatten (,)

⍣8 - repeated for eight times

3 3∘⍴¨ - shape every 9-items list into a 3×3 matrix

¨o← - save these matrices to o, and for each

+/,+⌿ - check if the rows sums (+/) concatenated to the column sums (+⌿)

⍵≡ - correspond with the input

o/⍨ - filter o (the matrices array) by truthy values


Shortest Floor Function Your task is to implement a floor function in as few bytes as possible.

A floor function is a function that takes a real number and returns the largest integer less than or equal to the input.

Your program should support both positive and negative inputs.  Since it is provably impossible to support all real numbers you need only support a reasonable subset of them.  This subset should include positive numbers, negative numbers and of course numbers that are not integers.  Such number systems include fixed-point numbers, floating point numbers and strings.

Your code may be a complete program or function.

This is code-golf so answers will be scored in bytes with less bytes being a better score.

PARI/GP (10)

In gp (and some other languages) x%1 gives the decimal part of x:

f(x)=x-x%1

NOTE: For negative x, x%1 returns (1 - abs(decimal part of x)), so the above works both for positive and negative numbers.


JavaScript (ES6), 169 bytes
Saved 1 byte thanks to @att
Expects (z)(x,y). Returns false if there's a solution or true otherwise.

z=>F=(X,Y,i=z,k)=>--i?[-1,0,1,2].every(d=>(g=d=>n%--d?g(d):d==1)(n=(k=2*Math.max(x=X+d%2,-x,y=Y+~-d%2,-y))*k-~(-y<x?y-k-x:k+x-y))|F[k=[x,y]]||F(x,y,i,F[k]=1)|--F[k]):X|Y

This is fast enough for all existing test cases, but I guess it's likely to time out on some other ones.
Try it online!
Commented
NB: the spiral formula is similar to the one I used in my answer to Spiral neighbourhoods.
z =>                              // outer function taking z
F = (                             // main recursive function taking:
  X, Y,                           //   (X, Y) = current position
  i = z,                          //   i = move counter initialized to z
  k                               //   k = local variable whose initial value is ignored
) =>                              //
  --i ?                           // decrement i; if it's not equal to 0:
    [-1, 0, 1, 2].every(d =>      //   for each direction d:
      ( g = d => n % --d ? g(d)   //     g is a recursive primality test function
                         : d == 1 //     which is invoked ...
      )(                          //
        n =                       //     ... on the 1-indexed square ID n defined as:
          ( k = 2 * Math.max(     //       k² + (k + x - y) * s + 1
              x = X + d % 2, -x,  //       with:
              y = Y + ~-d % 2, -y //         x = X + dx
            )                     //         y = Y + dy
          ) * k -                 //         k = 2 * max(|x|,|y|) = 2 * max(x,-x,y,-y)
          ~(-y < x ? y - k - x    //         s = -1 if -y < x or 1 otherwise
                   : k + x - y)   //
      )                           //     abort if n is prime
      | F[k = [x, y]]             //     or (x, y) was already visited
      || F(x, y, i, F[k] = 1)     //     otherwise mark (x, y) as visited and do a
                                  //     recursive call with the new position
      | --F[k]                    //     clear the mark afterwards
    )                             //   end of every()
  :                               // else:
    X | Y                         //   falsy if and only if X = Y = 0


Perform a Pluto flyby Congratulations! You've just been hired by NASA to work on the new Horizons 2 project.

Sadly, there have been huge budget cuts recently, so the top management has decided to fake the whole planned Pluto flyby (as they did for the moon landings in the 70s).

Your task is to write a program that will accept as input a date in the format yyyymmdd, and will provide a fake photograph of Pluto for this date. You can assume the entered date will be in the year 2015 or 2016.

The photograph is a 15x15 grid of ASCII characters. The characters on the grid have their x- and y-coordinates within the range [-7, 7] - the top-left character is at (-7, -7) while the bottom-right character is at (7, 7).

The photograph will be computed with the following rules:

The probe will be the nearest to Pluto on 25/12/2015
The distance d to Pluto is given by this formula : square root of ((difference in days to christmas) ^ 2 + 10)
The radius r of Pluto's image on the photo is given by : 22 / d
A character with coordinates (x, y) on the grid must be set to # if x^2 + y^2 <= r^2 ; it must be set to space otherwise.
There are stars at positions (-3, -5), (6, 2), (-5, 6), (2, 1), (7, -2). Stars are represented by a dot ., and they are of course hidden by Pluto.

One more thing: The NASA board has come to the conclusion that the discovery of life on Pluto would likely result in a substantial budget increase. Your program should then add clues of life on Pluto:

When the distance to Pluto is <= 4, add a plutonian at coordinates (-3,-1) : (^_^)

Example photograph for input 20151215: (Your code should have all the newlines as this code does)

    .

       #      .
      ###
     #####
      ###.
       #     .

  .

Photograph for input 20151225:

    #######
   #########
  ###########
 #############
 #############.
 ###(^_^)#####
 #############
 #############
 #############
 #############
  ###########
   #########
  . #######

As a comparison, here's a photo of Pluto's satellite Hydra as taken by New Horizons. Differences are hardly noticeable with our ASCII art.

This is code golf, so the shortest code in bytes wins!

JavaScript (ES6), 237 bytes

f=(n)=>(t=new Date('201'+n[3],n[4]+n[5],n[6]+n[7])/864e5-403805/24,r=484/(t*t+10),(g=(i)=>(++i<8?(h=(j)=>(i*i+j*j<=r?r>30.25&!~i&&'(^_^)'[j+3]||'#':~'p-3-5p62p-56p21p7-2'.indexOf('p'+j+i)?'.':' ')+(++j<8?h(j):''))(-7)+'\n'+g(i):''))(-8))

Live demo. Run in Firefox.

Original version

f=function(n) {
    t = (new Date('201'+n[3],''+n[4]+n[5],''+n[6]+n[7]) // Find the time difference in milliseconds,
    - new Date(2015,12,25)) / 864e5;                    // then divide by 86400000 to convert to days.

    r=22 / Math.sqrt(t*t+10);                           // Calculate the radius.

    s=[]; // s is the array that contains each line as a string.

    for(i=-7;i<8;i++)               // Loop through rows.
        for(j=-7,s[i+7]='';j<8;j++) // Loop through columns, appending one character per column.
                                    // s is zero based, so add 7 to the row.
            s[i+7]+=i*i+j*j<=r*r ?  // Choose which character to add to s.
            (r>5.5&i==-1&&'(^_^)'[j+3]||'#') :  // Add a '#' if the position is inside the radius.
                                                // If distance < 4, then the radius > 5.5
                                                // Then add the face at the right position.
            {'-3-5':1,'62':1,'-56':1,'21':1,'7-2':1} // Add the stars if outside. Create an associative array.
            [j+''+i]?'.':' ';                        // If i concat j is in the array, the expression will be 1,
                                                     // which is truthy, else it will be undefined, which is falsey.
    return s.join`\n` // Join all the rows with a new-line.
}

Golfing

This was fun to golf.

I don't need to create a Date object, so I hardcoded the value in milliseconds to save 13 bytes:

t=(new Date('201'+n[3],n[4]+n[5],n[6]+n[7])-new Date(2015,12,25))/864e5 // Before
t=new Date('201'+n[3],n[4]+n[5],n[6]+n[7])/864e5-403805/24 // After

Replace the associative array with a delimited string to eliminate 9 bytes:

{'-3-5':1,'62':1,'-56':1,'21':1,'7-2':1}[j+''+i]?'.':' ' // Before
~'p-3-5p62p-56p21p7-2'.indexOf('p'+j+i)?'.':' ' // After

The biggest refactor was replacing the for loops with nested, recursive IIFEs to knock off 10 bytes:

s=[];for(i=-7;i<8;i++)for(j=-7,s[i+7]='';j<8;j++)s[i+7]+= /* Chooses char at i,j */ ;return s.join`\n` // Before
(g=(i)=>(++i<8?(h=(j)=>( /* Chooses char at i,j */ )+(++j<8?h(j):''))(-7)+'\n'+g(i):''))(-8) // After

I also got rid of Math.sqrt for 8 more bytes.

r=22/Math.sqrt(t*t+10),(g=(i)=>(++i<8?(h=(j)=>(i*i+j*j<=r*r?r>5.5 // Before
r=484/(t*t+10),(g=(i)=>(++i<8?(h=(j)=>(i*i+j*j<=r?r>30.25 // After

Issues

I could only get the correct photograph for the test cases by changing the closest date to 2015/12/24, and I don't know if the problem lies in my code or the question. Please clarify and I will update my answer.

Here is my output using the differences from 2015/12/25.

Edit: Updated answer to use Christmas as the closest date.

Photograph for "20151215":

        .

           #      .
          ###
         #####
          ###.
           #     .

      .

Photograph for "20151225":

        #######
       #########
      ###########
     #############
     #############.
     ###(^_^)#####
     #############
     #############
     #############
     #############
      ###########
       #########
      . #######


Pali-n-drome this List The challenge here is to extend an implementation of palindrome given the following as inputs:

n > 1 and a list l.

Your program must palindrome the list both vertically and horizontally, that is to say it must first palindrome the list itself, then each element in the list after; or the other way around. Before palindromization, all elements are ensured to be equal length. The palindrome action is then to be performed n times in sequence until the desired output is met. The easiest way to show the expected outputs is just to run through a few examples:

One iteration performed on [123,456,789]:

First you palindromize the list to [123,456,789,456,123].

While this is not a palindrome if joined together, it is a palindrome in terms of the list.
[a,b,c] became [a,b,c,b,a], so the LIST was palindromized.

Then, you palindromize each list element [12321,45654,78987,45654,12321].

This is how each iteration is performed, it's essentially an omnidirectional palindrome.

Given n=1 and l=[123,456,789]:

12321
45654
78987
45654
12321

Given n=2 and l=[123,456,789]

123212321
456545654
789878987
456545654
123212321
456545654
789878987
456545654
123212321

Given n=1 and l=[3,2,1]:

3
2
1
2
3

Given n=2 and l=["hat","mad"," a "]:

hatahatah
madamadam
 a a a a
madamadam
hatahatah
madamadam
 a a a a
madamadam
hatahatah

Given n=2 and l=[" 3  ","2000"," 100"]:

 3   3 3   3
2000002000002
100 00100 001
2000002000002
 3   3 3   3
2000002000002
100 00100 001
2000002000002
 3   3 3   3

Given n=4 and l=["3 ","20","1 "]:

3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3
20202020202020202
1 1 1 1 1 1 1 1 1
20202020202020202
3 3 3 3 3 3 3 3 3

Given n=3 and l=["_|__","__|_","___|"]:

_|___|_|___|_|___|_|___|_
__|_|___|_|___|_|___|_|__
___|_____|_____|_____|___
__|_|___|_|___|_|___|_|__
_|___|_|___|_|___|_|___|_
__|_|___|_|___|_|___|_|__
___|_____|_____|_____|___
__|_|___|_|___|_|___|_|__
_|___|_|___|_|___|_|___|_
__|_|___|_|___|_|___|_|__
___|_____|_____|_____|___
__|_|___|_|___|_|___|_|__
_|___|_|___|_|___|_|___|_
__|_|___|_|___|_|___|_|__
___|_____|_____|_____|___
__|_|___|_|___|_|___|_|__
_|___|_|___|_|___|_|___|_

Given n=2 and l=["---|---","__|","___|","____|"]:

---|-----|-----|-----|---
  __|   |__   __|   |__
 ___|   |___ ___|   |___
 ____| |____ ____| |____
 ___|   |___ ___|   |___
  __|   |__   __|   |__
---|-----|-----|-----|---
  __|   |__   __|   |__
 ___|   |___ ___|   |___
 ____| |____ ____| |____
 ___|   |___ ___|   |___
  __|   |__   __|   |__
---|-----|-----|-----|---

Rules

n will always be greater than 1.
l will always have more than 1 element.
All elements of l are the same length.
This is code-golf shortest solution will be marked as winner.

05AB1E, 4 bytes
Note that if only a single iteration was required (n=1), then the program would be the palindrome û€û.
Fû€û

Try it online
F       Do n times
 û      Palindromize the list
  €û    Palindromize each element in the list

If padding the input was still a required part of the program (11 bytes):
€R.B€RIFû€û

I couldn't find a shorter way to right-justify. Left-justification and centering were all easy, but this was longer for some reason. Using E or ² instead of I also works.


Numbers with Rotational Symmetry Given an integer, output a truthy value if it is the same upside-down (rotated 180°) or a falsy value otherwise.

0, 1, and 8 have rotational symmetry. 6 becomes 9 and vice versa.

Sequence of numbers producing truthy results: OEIS A000787

0, 1, 8, 11, 69, 88, 96, 101, 111, 181, 609, 619, 689, 808, 818, 888, 906, 916, 986, 1001, 1111, 1691, 1881, 1961, 6009, 6119, 6699, 6889, 6969, 8008, 8118, 8698, 8888, 8968, 9006, 9116, 9696, 9886, 9966, 10001, 10101, 10801, 11011, 11111, 11811, 16091, ...

This question is inspired by my own reputation at the time of posting: 6009.

Python 2, 50 bytes

lambda n:`n`==`map('01xxxx9x86'.find,`n`)`[-2::-3]

The method '01xxxx9x86'.find takes a digit character to it's upside-down number, with any unflippable digit giving -1. This function is mapped to the reversed number string, producing a list of digits.
This is converted to a string with the [1::3] trick, except it's reversed instead by doing [-2::-3] (thanks to Dennis for this, saving 4 bytes),  and compared to the original number string. Any -1's from unflippable digits will misalign the conversion, making it fail.

56 bytes:
lambda n:`n`[::-1]==`n`.translate('01xxxx9x86______'*16)

Checks if the number string reversed is the same as it with the upside-down replacements. Digits that can't be flipped are replaced with 'x' to always give the wrong answer.
The replacement is done with translate on a string of 256 chars, replacing the corresponding ASCII values. Only the 10 values 48 to 57 matter, but I padded to length 16 to make the total length be 256. I wonder if there's a shorter way.
Some other approaches (lengths 59, 60, 60):
lambda n:set(zip(`n`,`n`[::-1]))<=set(zip('01896','01869'))
r=lambda s:set(zip(s,s[::-1]));lambda n:r(`n`)<=r('9018106')
lambda n:all(a+b in'001188969'for a,b in zip(`n`,`n`[::-1]))


Find out if this a valid Stack Cats program, in Stack Cats style! Background

Stack Cats is a reversible esoteric language made by Martin Ender. Each command in Stack Cats is either the inverse of itself (represented as a symmetric character, such as -_:T|), or has its inverse command (represented as the mirror image, such as () {} [] <>). Stack Cats has a strong syntactic requirement that the whole program should be the mirror image of itself. Note that this means any valid Stack Cats program is a natural mirror-image ambigram.

Here is the whole command set of Stack Cats:

Self-symmetric: !*+-:=ITX^_|
Symmetric pairs: () {} [] <> \/

Any other characters are invalid; any input having a character not in the character set above should output false.

The language has additional constraint that () and {} pairs must be always balanced, but for the sake of simplicity, you don't have to check for this condition.

The following are some examples of a valid Stack Cats program (again, note that you don't check for balanced parens):

{[+]==[+]}
[)>^<(]
({T)}|{(T})
<(*]{[:!-_:>}<[<)*(>]>{<:_-!:]}[*)>

These are not:

b<+>d
())(
({[<++<]})

Challenge

Write a program or function that determines if the given string is a valid Stack Cats program. Your code should also be a natural mirror-image ambigram, which means:

Your code should be a mirror image of itself.

Your code may have one or more newlines, as long as the whole code, displayed naturally, is a mirror image of itself.
You can omit or add trailing whitespaces on each line, since it doesn't change the display.
Tab characters are not allowed since they have some ambiguity on display.

Note: your code does not have to be a valid Stack Cats program; it may contain certain extra characters that are not allowed in Stack Cats. (See below for the complete list.)

For example, the following two programs are symmetric (and thus a valid submission), while the third is not:

({bTd})
[<q|p>]

({bTd})
  IXI

({bTd})
IXI

Regarding "mirror symmetry", only Stack Cats-style symmetry is considered (e.g. ({IH}) is not a valid submission, even though it has mirror symmetry).
Your code can only contain these sets of characters, plus newline:

Self-symmetric: space (0x20) + !"'*+-.8:=AHIMOTUVWXY^_ovwx|
Symmetric pairs: () /\ <> [] bd pq {}

The character set is chosen to be strictly symmetric or self-symmetric when displayed as code on SE.

Input and Output

The input range is any one-line string of printable ASCII characters.

You can choose to take input as a string, a list of chars, or a list of ASCII values.

You can choose to output either:

Any of the truthy/falsy values as defined by the language of your choice

The actual result values may differ between inputs (e.g. output 1 for a truthy input and 2 for another truthy one).
Swapping truthy and falsy values is not allowed.

Any two constant values for true/false respectively

In this case, the result values should exactly be one of the two constant values.

You should specify your input method and output values in your submission.

Winning Condition

This is code-golf, so lowest bytes in each language wins.

Notes

Standard loopholes are forbidden as usual.
Of course you can solve this in Stack Cats, but the chance is that you can't use a flag that allows to reduce your code size by half. And it's seriously hard language to pick up :P

JavaScript (ES6), 487 467 378 298 292 280 266 264 bytes

Saved 14 bytes thanks to @Bubbler

I=>(V=v=>!I[v]||((T=o=>[[]][+!!A[o]]||[(I[v]!=A[o]||A)[o^o<88/8]]+T(++o))(8-8)==I.pop())*V(++v))(V|(A='(){}[]<>\\/ !*+-:=ITX^_|'))//\\(('|_^XTI=:-+*! \//<>[]{}()'=A)|V)((v++)V*(()qoq.I==(8-8)((o++)T+[[8\88>o^o](A||[o]A=![v]I)]||[[o]A!!+][[]]<=o=T))||[v]I!<=v=V)<=I

Defines an anonymous function that takes an array of chars and returns the desired output. Output is truthy/falsy; usually 1/0, but the empty string gives true.

How?

The most obvious trick is to use //\\ as a center point to comment out the mirrored version of the code. After that, it becomes a game of figuring out the shortest way to solve the problem using only the charset given.

The first issue we run into is the lack of keywords and built-ins. We miraculously still have .pop(), but everything else will have to be done via the allowed operators (which includes a[b] and f(c)), with recursion to emulate loops.

The second issue is the lack of logical operators. Neither & and ? are allowed, which means the only decision-making operator we can use is ||. Therefore, we have to carefully structure our logic to account for this.

The first thing I did was to define a function T that mirrors an individual character. The basic idea is to loop through each character in a string of mirror-able chars, testing each for equality with the given char. If it is equal, we return its mirror—the char at index^1 for (){}[]<>\/, or the char itself for the rest.

The first problem I ran into here was getting either the mirrored char or a falsy value on each iteration. The solution I eventually came up with was (x!=A[o]||A)[o^o<88/8], where x is the input character, A is the mirroring alphabet, and o is the current index. If x is not the same as A[o], this gives true, and the index expression evaluates to undefined; otherwise, the ||A is activated, and we end up getting A[o^(o<11)].

The second problem is how to terminate the recursion. I found that the best way to do this is to simply concatenate the results of every iteration, returning the empty string when the end of A is reached. This presents us with two further problems: converting the undefineds to empty strings, and returning the empty string || something. These can be solved with array abuse: [a]+"" gives the string representation of a, or the empty string if a is undefined. As a bonus, [] is truthy but stringifies to the empty string, so we can conveniently use this as a "truthy empty string".

Now we can use the T function to mirror any single character. We do this recursively, comparing the mirror of I[v++] to I.pop() until the end of the array of chars is reached. We can't use && or & to check if all of the comparisons are truthy, but so use * instead. Multiplying all of these results together gives 1 if every character is the mirror of the one opposite, or 0 if any comparison fails.

And that is basically how this answer works. I probably didn't explain it very clearly, so please ask any questions you may have and point out any mistakes I have made.


Coating Every Pancake You have a stack of pancakes on a plate with a glob of syrup on top so thick it can't run down the sides. You won't be happy to eat until both faces of each pancake have at least touched the syrup, but right now only one face of the top pancake has.
You know that the syrup will never soak through even one pancake, but it can be transferred indefinitely via face-to-face contact between two pancakes. Once a face of a pancake has touched syrup it is considered coated in syrup forever, and will make any non-syrup coated face that touches it syrup coated as well. It is possible to transfer syrup to and from the top side of the plate as well.
You proceed to coat every pancake face with syrup by inserting a spatula below one or more pancakes and flipping them all over, exactly as is done in pancake sorting. (Unfortunately this spatula is syrup-resistant, and does not help to distribute the syrup by touching pancake faces.) Sadly you lose track of which pancake faces have touched syrup but you do remember the flips you have made.
Given your past flips can you determine if your pancakes are all coated with syrup yet?
Challenge
Write a program that takes in a positive integer N for the number of pancakes, and a list of positive integers (all <= N) for the flips you have made so far. Each number in the list represents the number of pancakes that were flipped. Output a truthy value if the pancakes are done being coated and a falsy value if not. (truthy/falsy definition)
The input should come from stdin or the command line and the output should go to stdout (or closest alternatives). It's fine if your input needs a little extra formatting: e.g. [1, 1, 2, 2] instead of 1 1 2 2 for the list.
Examples
Assume N = 2, so we have a stack of two pancakes on a plate, starting with the syrup on top.
If the list is 1 1 2 2, this means we...

flip the top pancake - coating the upper face of the bottom pancake
flip the top again - coating the original bottom face of the top pancake
flip both - coating the plate
flip both again - coating the original bottom face of the bottom pancake

Since all four faces are coated the output would be something like True or 1.
If the list is 1 2 2 1, this means we...

flip the top pancake - coating the upper face of the bottom pancake
flip both - coating nothing
flip both again - coating nothing
flip the top again - coating the original bottom face of the top pancake

Since the face touching the plate is still syrup-free the output would be something like False or 0.
Notes

The flip list may be arbitrarily large and can be empty, in which case the output is falsy.
The plate acts as a syrup-carrier but it doesn't matter if it gets coated or not. (In fact any flip solution will coat the plate because the pancake face it touches must be coated, but regardless.)
The plate cannot be flipped.
You can assume these pancakes are unit disks with no sides to speak of, only two opposite faces.

Scoring
This is code-golf. The shortest solution in bytes wins.

Haskell, 92 90 86 84 114 110 99 98
the requirement of a full program is so annoying. I wonder why would anyone require this.
m(n:s)=all(<1)$foldl(\r@(p:s)n->reverse(take n s)++(p*r!!n):drop n s)[0..n]s
main=readLn>>=print.m

this solution works by representing the pile of pancakes by a list of the sides, when adjacent pancakes share the same side. every side is a number, and a side is coated if it has a zero value.
run as:
*Main> main
[2,1,1,2,2]
True


Golf the Lucas Lehmer Primality Test your task is to write a program that uses the Lucas-Lehmer primality test to check whether an input number is prime or not. This prime number candidate has the form 2p-1 with p being prime. (Mersenne prime number)

The Lucas-Lehmer-test

The n-th Mersenne number is prime if it is a divisor of the (n-1)-th Lucas-Lehmer number (LLN).
You can calculate the LLN, similiar to the Fibonacci numbers, based on a recursive algorithm:

L<n> = (L<n-1>)^2 - 2

The LLN for 2 is 14. So, for p=3, LLN<3-1>=14

Evaluation

You have to submit a function that takes p as input (Remember: 2^p-1)
The shortest solution will win.
Your solution has to use the Lucas-Lehmer test
The code must be executable.
Output: boolean value or 1=prime/0=not prime

Tests:

p --> 2^p-1  --> LLN<n-1> --> ?
3 --> 7      --> 14  --> prime
5 --> 31     --> 37634 > prime (1214*31)

Good Luck

Python 2, 51 bytes

p=input()
s=4
exec's=(s*s-2)%(2**p-1);'*(p-2)
s>0>x

Try it online!

Output is via exit code


Russian Caesar cipher The objective

Given a Russian text, encrypt it with Caesar cipher with key 16.

The basic Cyrillic alphabets

The basic Cyrillic alphabets are: (U+0410 – U+042F)

АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ

By the Caesar cipher, they are mapped to:

РСТУФХЦЧШЩЪЫЬЭЮЯАБВГДЕЖЗИЙКЛМНОП

The small letters (U+0430 – U+044F) are also mapped likewise.

Note the absence of Ё.

Rules

Ё (U+0401) and ё (U+0451) are not considered basic, and are mapped to Х̈ (U+0425 U+0308) and х̈ (U+0445 U+0308), respectively.
Any other characters are preserved.

Example

The following sentence:

В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!

Is encrypted to:

Т зрйре оур цшы сл жшвагб? Фр, эю дрымиштлщ нъчхьяыпа!

JavaScript (ES6),  148 ... 110  108 bytes
Saved 12 bytes thanks to @Grimy!
This function applies some maths to the code points.
s=>s.replace(/./g,s=>String.fromCharCode(...(n=s.charCodeAt()-304)%80-1?[(n^16*(n>0))+304]:[1060+n%48,776]))

Try it online!
How?
For each character in the input string, we define \$n\$ as its code point minus \$304\$.
 characters    | code points  | n
---------------+--------------+---------------
 А to Я        | 1040 to 1071 | 736 to 767
 а to я        | 1072 to 1103 | 768 to 799
 Ё             | 1025         | 721
 ё             | 1105         | 801
 ASCII         | 0 to 126     | -304 to -178

Then we apply the following logic:
// neither 'Ё' nor 'ё'?
n % 80 - 1 ?
  // output a single code point
  [
    // invert the case if this is a Cyrillic character
    (n ^ 16 * (n > 0))
    // and restore the original offset
    + 304
  ]
:
  // output two code points
  [
    // the first one is either 1061 (Х) or 1093 (х)
    1060 + n % 48,
    // the 2nd one is the combining diaeresis
    776
  ]


Remove a weight so the rest can't be balanced This code-golf challenge is based on the following puzzle:

  You have an odd number of tokens whose weights are known whole numbers, and they don't all have the same weight. Show that there's a token you can remove so that the remaining tokens can't be split into two equal-size sets that have the same total weight.

Here's the canonical solution to the puzzle, which also suggests an algorithm to do it (spoilers if you want to solve the puzzle yourself):

   If all the weights are even or all odd, the problem is unchanged if we truncate the least significant bit from each one (i.e. floor-divide by 2). Keep doing that until there's at least one even weight and one odd weight -- this must happen eventually because the total weight decreases at each step. Then, remove a weight whose parity is opposite the parity of the sum, leaving an odd total weight, which clearly prevents an even split.

Your goal is to figure out such a weight to remove. Shortest code wins.

Input:

An odd-size list of positive whole numbers, not all the same. Any list-like structure is fine, though it has to work with the numbers in any order.

Output:

One of those numbers, such that the remaining numbers can't be partitioned into two sets with equal size and equal sum. You must output the number, not its index.

If there's multiple choices, any one of them is fine. It doesn't have to be the number chosen by the solution above.

Your code should be able to handle test cases like below within one second.

Test cases:

[1, 2, 3]
1

[3, 3, 3, 3, 3, 3, 5]
3

[1, 2, 3, 4, 5, 6, 7, 8, 9]
2

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

[128, 256, 256]
256

[18770, 10578, 7506, 5458, 4434, 6482, 5458, 4434, 2386, 11602, 1362, 16722, 11602, 23890, 12626, 47442, 57682, 35154, 57682, 81234, 44370, 12626, 12626, 46418, 68946, 91474, 2386, 43346, 46418, 35154, 32082]
7506

If you want to see all possible outputs (this is just to show, your code must output exactly one):

[1, 2, 3]
{1, 2, 3}

[3, 3, 3, 3, 3, 3, 5]
{3}

[1, 2, 3, 4, 5, 6, 7, 8, 9]
{2, 4, 6, 8}

[1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
{1}

[128, 256, 256]
{256}

[18770, 10578, 7506, 5458, 4434, 6482, 5458, 4434, 2386, 11602, 1362, 16722, 11602, 23890, 12626, 47442, 57682, 35154, 57682, 81234, 44370, 12626, 12626, 46418, 68946, 91474, 2386, 43346, 46418, 35154, 32082]
{68946, 5458, 44370, 46418, 11602, 23890, 7506, 91474, 32082, 1362, 81234}

CJam, 19 17
q~:T{T:^^2bW%}$W=

Input format:
[1 2 3 4 5 6 7 8 9]

2 bytes thanks to Optimizer.