Distance between two points in n-dimensional space Here is another simple one:
The Challenge
Given two points in an n-dimensional space, output the distance between them, also called the Euclidean distance.

The coordinates will be rational numbers; the only limits are the restrictions of your language.
Lowest dimension is 1, highest is whatever your language can handle
You may assume that the two points are of the same dimension and that there will be no empty input.
The distance has to be correct to at least 3 decimal places. If your language does not support floating point numbers, output the nearest whole number.

Rules

As usual, function or full program allowed.
Input may be taken from STDIN, command line- or function arguments.
Input format is up to you, specify which one you used in your answer.
Output may be provided by printing to stdout or return value.
This is code-golf so lowest byte-count wins! In case of a tie, the earlier answer wins.

Test cases
Each point is represented by a list of length n.
[1], [3] -> 2
[1,1], [1,1] -> 0
[1,2], [3,4] -> 2.82842712475
[1,2,3,4], [5,6,7,8] -> 8
[1.5,2,-5], [-3.45,-13,145] -> 150.829382085
[13.37,2,6,-7], [1.2,3.4,-5.6,7.89] -> 22.5020221314

Happy Coding!

MATL, 2 bytes
ZP

Try it online!
The ZP function (corresponding to MATLAB's pdist2) computes all pairwise distances between two sets of points, using Euclidean distance by default. Each set of points is a matrix, and each point is a row. In this case it produces a single result, which is the distance between the two points.


Telling time in French Bonjour, PPCG ! Quelle heure est-il ? This means what time is it in French, for that is exactly what this challenge is about.

Telling time in French (at least formally) is a bit different from telling time in English. Telling the time starts out with Il est (It is). Then, you put the hour followed by heures (o'clock). (In case you don't know French numbers, here's a list: http://blogs.transparent.com/french/french-numbers-learn-how-to-count-from-1-to-1000/). If it is 1 o'clock, do une heure for this. For noon, use midi (with no heures), and for midnight use minuit.

Unless the minutes is 00, you then follow it with the number of minutes. There are a few exceptions to this however. For 15 minutes, you want to say et quart, and for 30 minutes you want to say et demi. For anything after 30 minutes, you increase the hour number by one, then add the word moins and 60 - the minutes. So 6:40 P.M is Il est sept heures moins vingt (vingt = 20). 45 minutes would be moins le quart.

Finally, you end it with the time of day. For the morning (1 A.M to 12 P.M), you say du matin. For the afternoon (subjective, but I'll define it as 1 P.M to 5 P.M), you say de l'apres-midi (technically there should be an accent above the e, but eh). And for night (5 P.M to 12 A.M) you say du soir. Note that for midnight and noon (minuit and midi) you don't put any of these afterwards -- the time of day is implied based on which one you use.

As you've probably already ascertained, the challenge here is to print out the current local time in French using these rules. Here's what sample output should look like at assorted times. (The time in the parenthesis does not have to be printed obviously, it's just there so you know what times are):

Il est sept heures du matin. (7:00 A.M)
Il est deux heures de l'apres-midi. (2:00 P.M)
Il est une heure du matin. (1:00 A.M)
Il est huit heures du soir. (8:00 P.M)
Il est midi. (12:00 P.M, Noon)
Il est minuit. (12:00 A.M, Midnight)
Il est cinq heures vingt du soir. (5:20 P.M)
Il est six heures et quart du matin. (6:15 A.M)
Il est neuf heures et demi du matin. (9:30 A.M)
Il est quatre heures moins dix de l'apres-midi. (3:50 P.M, not 4:50!)
Il est midi moins le quart. (11:45 A.M)

This is code-golf, so shortest code wins. Good luck!

EDIT: The period is required.

PHP - 521 473 bytes

I've added some newlines for readability:

$w=split(A,'AuneAdeuxAtroisAquatreAcinqAsixAseptAhuitAneufAdixAonzeAdouzeAtreizeA
quatorzeAAseizeAdix-septAdix-huitAdix-neufAvingtAvingt et une');$h=idate('H');if(
$r=($m=idate('i'))>30){$h=++$h%24;$m=60-$m;}echo'Il est '.($h?$h==12?midi:$w[$h%12]
.' heure'.($h%12<2?'':s):minuit).($r?' moins':'').($m==15?($r?' le ':' et ').quart
:($m==30?' et demi':($m?' '.($m<22?$w[$m]:"$w[20]-".$w[$m%10]):''))).($h%12?($h-=$r
)<12?' du matin':($h<17?" de l'après-midi":' du soir'):'').'.';

The method used to converting a number to its numeral in French is inspired by this answer on an other challenge by edc65.

Here is the ungolfed version:

/** Define numerals **/
$numerals = [
    '', 'une', 'deux', 'trois', 'quatre',
    'cinq', 'six', 'sept', 'huit', 'neuf',
    'dix', 'onze', 'douze', 'treize', 'quatorze',
    '', 'seize', 'dix-sept', 'dix-huit', 'dix-neuf',
    'vingt', 'vingt et une'
];

/** Get current time **/
$hours = idate('H');
$minutes = idate('i');

/** Check if we need to count in reverse **/
$reverse = $minutes > 30;
if ($reverse) {
    $hours = ($hours + 1) % 24;
    $minutes = 60 - $minutes;
}

echo 'Il est ';

/** Print hours **/
if ($hours === 12) {
    echo 'midi';
}
else if ($hours === 0) {
    echo 'minuit';
}
else
{
    echo $numerals[$hours % 12] .' heure';
    if ($hours % 12 !== 1) {
        echo 's';
    }
}

/** Print minutes **/
if ($reverse) {
    echo ' moins';
}

if ($minutes === 15)
{
    if ($reverse) {
        echo ' le ';
    }
    else {
        echo ' et ';
    }

    echo 'quart';
}
else if ($minutes === 30) {
    echo ' et demi';
}
else if ($minutes !== 0)
{
    echo ' ';

    if ($minutes < 22) {
        echo $numerals[$minutes];
    }
    else {
        echo $numerals[20] .'-'. $numerals[$minutes % 10];
    }
}

/** Print daytime **/
if ($hours % 12 !== 0)
{
    if ($reverse) {
        --$hours;
    }

    if ($hours < 12) {
        echo ' du matin';
    }
    else if ($hours < 17) {
        echo " de l'après-midi";
    }
    else {
        echo ' du soir';
    }
}

echo '.';


How many partitions do I have? The partition number of a positive integer is defined as the number of ways it can be expressed as a sum of positive integers. In other words, the number of integer partitions it has. For example, the number 4 has the following partitons:

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

Hence, it has 5 partitions.
This is OEIS A000041.

Task
Given a positive integer N determine its partition number.

All standard rules apply.

The input and output may be handled through any reasonable mean.

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

Test Cases

Input | Output

1  |  1
2  |  2
3  |  3
4  |  5
5  |  7
6  |  11
7  |  15
8  |  22
9  |  30
10 |  42

Mathematica, 11 bytes

PartitionsP

Explanation

¯\_(ツ)_/¯


Create shortest log organizer Create the shortest script that organizes all the logs by month and date.

Rules

Syntax

organize <folder to scan> <folder to place logs>

folder cannot be root
the two folder should be different and not contain one another

Behaviour

The script should scan all the *.log files in <folder to scan> and copy them to <folder to place logs> in sub-folders corresponding to the year and month of the last modified  time of the log file, named like year_month.

Example:

organize /var/log/apache2 /temp/logs

would give folder structure like this:

/temp/logs/
|-- 2014_01
|-- 2014_02
|-- 2014_03
|-- 2014_04
|-- 2014_05

Languages, environment

All languages and OSs are permitted but need to be specified.

But since this is a code-golf question, script languages (python, bash, windows batch) will be more fit from the start.


Find the number of subgroups of a finite group Definitions

You can skip this part if you already know the definitions of groups, finite groups, and subgroups.

Groups

In abstract algebra, a group is a tuple (G, ∗), where G is a set and ∗ is a function G × G → G such that the following holds:

Closure: for all x, y in G, x ∗ y is also in G (implied by the fact that ∗ is a function G × G → G).
Associativity: for all x, y, z in G, (x ∗ y) ∗ z = x ∗ (y ∗ z).
Identity: there exists an element e in G such that for all x in G, x ∗ e = x = e ∗ x.
Inverse: for each x in G, there exists an element y in G such that x ∗ y = e = y ∗ x, where e is the identity element mentioned in the previous bullet point.

Finite groups

A finite group is a group (G, ∗) where G is finite, i.e. has finitely many elements.

Subgroups

A subgroup (H, ∗) of a group (G, ∗) is such that H is a subset of G (not necessarily proper subset) and (H, ∗) is also a group (i.e. satisfies the 4 criteria above).

Examples

Consider the dihedral group D3 (G, ∗) where G = {1, A, B, C, D, E} and ∗ is defined below (a table like this is called a Cayley table):

∗ | 1   A   B   C   D   E
--+----------------------
1 | 1   A   B   C   D   E
A | A   B   1   D   E   C
B | B   1   A   E   C   D
C | C   E   D   1   B   A
D | D   C   E   A   1   B
E | E   D   C   B   A   1

In this group, the identity is 1. Also, A and B are inverses of each other, while 1, C, D, and E are the inverses of themselves respectively (the inverse of 1 is 1, the inverse of C is C, the inverse of D is D, and the inverse of E is E).

Now, we can verify that (H, ∗) where H = {1, A, B} is a subgroup of (G, ∗). For the closure, refer to the table below:

∗ | 1   A   B
--+----------
1 | 1   A   B
A | A   B   1
B | B   1   A

where all possible pairs of elements in H under ∗ give a member in H.

The associativity does not require checking, since elements of H are elements of G.

The identity is 1. This must be the same with the group identity. Also, the identity in a group must be unique. (Can you prove this?)

For the inverse, check that the inverse of A is B, which is a member of H. The inverse of B is A, which is also a member of H. The inverse of 1 is still itself, which does not require checking.

Task

Description

Given a finite group (G, ∗), find the number of its subgroups.

Input

For a group (G, ∗), you will receive a 2D array of size n × n, where n is the number of elements in G. Assume that index 0 is the identity element. The 2D array will represent the multiplication table. For example, for the group above, you will receive the following 2D array:

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

For example, you can see that 3 ∗ 1 = 5 because a[3][1] = 5, where a is the 2D array above.

Notes:

You can used 1-indexed 2D array.
The row and the column for the identity can be omitted.
You may use other formats as you see fit, but it must be consistent. (i.e. you may want the last index to be identity instead, etc.)

Output

A positive number representing the number of subgroups in the group.

For example, for the group above, (H, ∗) is a subgroup of (G, ∗) whenever H =

{1}
{1, A, B}
{1, C}
{1, D}
{1, E}
{1, A, B, C, D, E}

Therefore, there are 6 subgroups, and your output for this example should be 6.

Hints

You can read the articles that I linked to. Those articles contain theorems about groups and subgroups that might be useful to you.

Scoring

This is code-golf. Answer with lowest byte-count wins.

Mathematica, 62 48 bytes

Count[Subsets@First@#,x_/;Union@@#[[x,x]]==x]-1&

Pure function expecting a 1-indexed 2D array. Counts the number of Subsets of the First row of the input array that are  closed under the group operation. Since this will include the empty set, we subtract 1. Note that a nonempty subset of a finite group that is closed under the group operation is in fact a subgroup, (and vice versa, by definition).

Strictly speaking I don't check that the subset x is closed under the group operation, I restrict the multiplication table to the subset x and check that it contains precisely the elements of x. Clearly this implies that x is closed with respect to the group operation. Conversely, any subgroup x will contain 1 and thus x will be a subset of the elements appearing in the restricted multiplication table, and since x is closed under the group operation, it must equal x.


How many spaces are there? Your task is to input a string, and output the number of spaces in the string.

This is code-golf, so least number of bytes win. Your

Test Cases

Double quotes are not part of the test cases.

"test" => 0
"Hello, World!" => 1
"C O D E G O L F" => 7
"      " => 6

APL (Dyalog Extended), 3 bytesSBCS

+/=

Try it online!

+/ sum the mask where = equal to the prototypical element of that element, which is space for characters.


Return the integers with square digit-sums Introduction and Credit

We all know and love our awesome rules to test whether a number is divisble by 11 or 3, which is just some clever sum over the digits of the number. Now this challenge takes this to a new level, by requiring you to compute the sum of the digits and then checking whether the result is a perfect integer square, neither of which operations usually can be done very short. As this property is also very hard to see when looking at a number, we want this to be done for entire lists of numbers so we can save human work. So this is your challenge now!

This was an assignment at my university functional programming course. This assignment is now closed and has been discussed in class and I have my professor's permission to post it here (I asked explicitely).

Specification

Input

Your input is a list of non-negative integers, in any standard I/O format.
You may choose the list format as your language needs it

Output

The output is a list of integers, in any standard I/O format.

What to do?

Filter out every integer from the input list for which the sum of the digits is not a a square (of an integer).
The order of the elements may not be changed, e.g. if you get [1,5,9] you may not return [9,1]

Potential corner cases

0 is a non-negative integer and thus a valid input and 0 is also a valid integer root, e.g. 0 counts as an integer square.
The empty list is a valid input and output as well.

Who wins?

This is code-golf so the shortest answer in bytes wins!
Standard rules apply of course.

Test Cases

[1,4,9,16,25,1111] -> [1,4,9,1111]
[1431,2,0,22,999999999] -> [1431,0,22,999999999]
[22228,4,113125,22345] -> [22228,4,22345]
[] -> []
[421337,99,123456789,1133557799] -> []

Step-by-Step Example

Example input: [1337,4444]
Handling first number:
Sum of the digits of 1337: 1+3+3+7=14
14 is not an integer square, thus will be dropped!
Handling second number:
Sum of the digits of 4444: 4+4+4+4=16
16 is an integer square because 4*4=16, can get into the output list!
Example output: [4444]

Pyke, 6 bytes
#s,DBq

Try it here!
#      - Filter list on truthiness:
 s     -    digital_root(^)
  ,    -   sqrt(^)
    Bq -  int(^) == ^


Circularly moving sum Inspired by a question at Stack Overflow.
Given a non-empty array of integers x and a positive integer n, compute the sum of each sliding block of length n along the array x, circularly filling the missing values at the left with values from the right as follows:

the first block contains the first entry of x, preceded by n-1 circularly shifted entries;
the second block has the first and second entries of x, preceded by n-2 circularly shifted entries; and so on.

The output array y has the same size as x. It is possible for n to exceed the length of x, and then the values of x are circularly reused several times.
Examples
Example 1 (values are reused only once)
x = [2, 4, -3, 0, -4]
n = 3

give as output
y = [-2, 2, 3, 1, -7]

where

-2 is the sum of the block [0, -4, 2] (the first two values come from the circular shifting)
2 is the sum of [-4, 2, 4] (the first value comes from the circular shifting)
3 is the sum of [2, 4, -3] (no circular shifting necessary anymore)
1 is the sum of [4, -3, 0]
-7 is the sum of [-3, 0, -4].

Example 2 (values are reused several times)
x = [1, 2]
n = 5

give
y = [7, 8]

where

7 is the sum of the block [1, 2, 1, 2, 1] (the first four values have been circularly reused)
8 is the sum of the block [2, 1, 2, 1, 2] (the first three values have been circularly reused)

Additional rules

The algorithm should work for arrays of arbitrary size and for arbitrary integer values. It is acceptable if the program is limited by data type or memory restrictions; but positive as well as negative integer values must be handled.
Input/output can be taken/produced by any reasonable means.
Programs or functions are allowed, in any programming language. Standard loopholes are forbidden.
Shortest code in bytes wins.

Test cases
x, n, -> y

[2, 4, -3, 0, -4], 3          ->  [-2, 2, 3, 1, -7]
[1, 2], 5                     ->  [7, 8]
[2], 7                        ->  [14]
[-5, 4, 0, 1, 0, -10, -4], 4  ->  [-19, -15, -5, 0, 5, -9, -13]
[-5, 4, 0, 1, 0, -10, -4], 1  ->  [-5, 4, 0, 1, 0, -10, -4]
[-2, -1, 0, 1, 2, 3], 5       ->  [4, 3, 2, 1, 0, 5]
[-10, 0, 10], 4               ->  [-10, 0, 10]

MATL, 11 10 9 7 bytes
3 Bytes saved thanks to @Luis!
:gyn&Z+

The first input is the size of the window and the second input is the array
Try it at MATL Online
Explanation
       % Implicitly grab the first input (n)
       %     STACK: { 3 }
:      % Create the array [1...n]
       %     STACK: { [1, 2, 3] }
g      % Convert it to a logical array, yielding an array of 1's of length n
       %     STACK: { [1, 1, 1] }
y      % Implicitly grab the second input and duplicate it
       %     STACK: { [2, 4, -3, 0, -4], [1, 1, 1], [2, 4, -3, 0, -4]}
n      % Determine the length of the array
       %     STACK: { [2, 4, -3, 0, -4], [1, 1, 1], 5}
&Z+    % Perform circular convolution
       %     STACK: { [-2, 2, 3, 1, -7] }
       % Implicitly display the result


print 1 to 100 without using recursion and conditions can we print 1 to 100 without using any if conditions and loops in c&c++?

Conditon:
main point is you must not use recursion...and doesnt hardcode code in it
for e.g

print(1 2 3..etc);

C (90) (79) (59) (47) (42) (40)

static int

x=1;a(){char b[8];printf("%d\n",x++);b[24]-=5*(1-x/101);}main(){a();return 0;}

The function a which prints the numbers does not call itself! I exploited a buffer overflow and changed the return address to make the program counter go over function a again as long as I need.

I don't know if this is considered to be a recursion, but I thought it would worth trying.
This code works on my 64-bit machines with gcc 4.6, for other platforms the last statement of function a, could be a little different.

Exp1: I allocated a dummy buffer on stack b, and then addressed a passed-by-end location, which is the location of return address. I anticipated the distance between start of buffer and return address location from disassembly of function a.

Exp2: Expression 5*(1-x/101), is 5 for all x<=100 and 0 for x=101. By looking at disassembly of main (in my case), if you decrease the return address by 5, you will set the PC to calling point of a again. In the updated codes, the return value of printf is used for checking loop condition.

Update: After applying ugoren's suggestions and some other changes:

x;a(){int b[2];b[3*(printf("%d\n",++x)&2)]-=5;}main(){a();}

Update2: After Removing function a:

x;main(){int b[2];b[6^printf("%d ",++x)&4]-=7;}

Update3:

x;main(b){(&b)[1|printf("%d ",++x)&2]-=7;}

Update4: Thanks to mbz :)

x;main(b){(&b)[3|printf("%d ",++x)]-=7;}


Equalizing fractions When I was in grade 3, we were taught how to solve a very simple math problem. It was equaling the denominators of two or more fractions.
Let's take two proper fractions:-
$$
\frac{1}{2},\frac{2}{3}
$$
First we will take the Least Common Multiple of the denominators of the two fractions, the LCM of \$2,3\$ are \$6\$. Then we divide the LCM (\$6\$) by the denominators of both fractions (\$6\$) and we get \$3,2\$ and serially multiply them with the numerators of the both fractions and get
$$
\frac{3}{6},\frac{4}{6}
$$
And that's the result.
Challenge
Take two or more fractions, and equalize their denominators.
I/O format
You can take an array/list of (numerator,denominator) pairs. Pre-defining them in TIO header is allowed. You can take in other better ways too.
Input: ((1,2),(2,3)) or
        1,2 2,3
        1/2 2/3
Output: (3,6),(4,6) or
        3,6 4,6
        3/6 4/6
Input:  ((1, 8), (5, 12))
       1,8 5,12
       1/8 5/12
Output: ((3, 24), (10, 24))
         3,24 10,24
         3/24 10/24
Input: ((1, 2),(2, 3),(4, 6))
Output: 3/6 4/6 4/6

Rules

Standard loopholes are forbidden. (except use of TIO headers to pre-define input)
Trailing whitespace in output is allowed.
If possible, please link to an online interpreter (e.g. TIO) to run your program on.
Please explain your answer. This is not necessary, but it makes it easier for others to understand.
Languages newer than the question are allowed. This means you could create your own language where it would be trivial to do this, but don't expect any upvotes.
This is code-golf, so shortest code in bytes wins!

JavaScript (Node.js), 63 bytes

f=(a,t=1)=>a.some(v=>t%v[1])?f(a,1+t):a.map(([p,q])=>[p*t/q,t])

Try it online!

JavaScript (Node.js), 63 bytes

f=(a,t,b=a.map(([p,q])=>[m=p*t/q,o&=m%1||t],o=t))=>o?b:f(a,-~t)

Try it online!
m=p*t/q cannot be changed to p*=t/q due to floating point errors. For example, 11*15/11 is 15, but 11*(15/11) is 14.999999999999998. :(

The first answer here will output [[6, 12], [6, 12]]  for input [[2, 4], [3, 6]].
The second one will output [[1, 2], [1, 2]] for input [[2, 4], [3, 6]].

JavaScript (Node.js), 62 bytes

@Arnauld had modified the code to make it work in 62 bytes. This one would support positive fractions.

f=(a,t,o=-~t,b=a.map(([p,q])=>[p*t/q,t+=p*t%q]))=>t<o?b:f(a,o)

Try it online!


Increment base-36 strings This is a code golf version of a similar question I asked on stack earlier but thought it'd be an interesting puzzle.
Given a string of length 10 which represents a base 36 number, increment it by one and return the resulting string.
This means the strings will only contain digits from 0 to 9 and letters from a to z.
Base 36 works as follows:
The right most digit is incremented, first by using 0 to 9

0000000000 > 9 iterations > 0000000009

and after that a to z is used:

000000000a > 25 iterations > 000000000z

If z needs to be incremented it loops back to zero and the digit to its left is incremented:

000000010

Further rules:

You may use upper case or lower case letters.
You may not drop leading zeros. Both input and output are strings of length 10.
You do not need to handle zzzzzzzzzz as input.

Test Cases:
"0000000000" -> "0000000001"
"0000000009" -> "000000000a"
"000000000z" -> "0000000010"
"123456zzzz" -> "1234570000"
"00codegolf" -> "00codegolg"

Japt, 13 bytes

n36 Ä s36 ù0A

Try it online! and Verify test cases

Takes input as a string

Explanation

n36            converts input to base 36
    Ä           +1
      s36       to base 36 string
          ù0A   left-pad with 0 to length 10


CSS attribute selector efficient "greater than selector" code The goal is to find a way better than the current best known way of encoding the index of a child HTML element, so that encoded indices have the following property.

if (index_i >= index_p) {
  assert(encoding(index_i).indexOf(encoding(index_p)) == 0);
}

if (index_i < index_p) {
  assert(encoding(index_i).indexOf(encoding(index_p)) !== 0);
}

The current best known way of doing this is with a form of unary encoding (without the usual trailing zero. So, for example, when index_p = 10:

encoding(index_p) == "11111111111" true
index_i = 9; encoding(index_i) == "1111111111" true
"11111111111".indexOf("1111111111") !== 0 true
"1111111111".indexOf("11111111111") == 0 true

Application

An application of this is being able to use document.querySelectorAll for obtaining all child elements "greater than" a certain index, via utilisation of the "starts with" attribute selector, ^=.

For example, if we have a set of 100 div elements, and each div element has been given an attribute ei equal to its encoded index value. If our goal is to obtain a list of the last 51 of div elements, one way to do this is to request:

document.querySelectorAll('div[ei^='+Array(50).join("1")+']');

However, if we have interesting numbers of divs (1000, 10000), then we use a lot of memory storing these attribute indexes. So we get the typical "memory" vs "speed" tradeoff for setting up this indexing system.

The question is : is there a way to do the same thing, using an encoded index, such that it is shorter than this pseudo-unary version?

Motivation

One motivation that contributes to this question post here is the following subtle point: the elements may not necessarily be in the indexed order.

This unusual occurrence is by no means something that one would expect in ordinary use of the DOM, but if we are absolutely positioning the elements based on their indices, and we are swapping, inserting and deleting the elements, then it is possible to have a meaningful piece of HTML where document order is actually not related to the rendering order that ends up meaning something to somebody. And in such a case, we may still need to look at a range of elements, such as, all elements with an index larger than 72, and with an indexing method with properties like those described above, then we can use the starts with attribute selector to gather together this set.

You could always try something of the form

<tag h="111" t="11111" o="1">

where you use your unary encoding for each of the hundreds (h), tens (t) and ones (o) attributes.

A greater-than CSS selector would then look like

tag[h^="1111"],tag[h="111"][t^="111111"],tag[h="111"][t="11111"][o^="1"] { ... }

but frankly, if your tags are just retaining some property that persists in spite of reordering, etc., why not just run a script that selects the last n marked tags on DOM load and assigns the class iamlast, then use the .iamlast CSS selector?


Find a point's position on the integral Hilbert curve The Hilbert curves are a class of space-filling fractal curves where every bend in the path is at a right angle and the curve as a whole fills up a square, with the property that sequences of consecutive segments are always displayed as contiguous blocks.

Traditionally, the curve is drawn as a series of very squiggly lines inside a square such that each segment becomes smaller and smaller until they fill up the whole square. However, like the Walsh matrix, it is also possible to represent the limit curve as a sequence of line segments connecting lattice points that grows infinitely until it fills up an entire quadrant of lattice points on the Cartesian plane.

Suppose we define such a curve as the integral Hilbert curve, as follows:

Start at the origin.
Move one unit right (R), one unit up (U), and one unit left (L). Down will be notated as D.
Let RUL be H_1. Then define H_2 as H_1 U I_1 R I_1 D J_1 where:

I_1 is H_1 rotated 90 degrees counterclockwise and flipped horizontally.
J_1 is H_1 rotated 180 degrees.

Perform the steps of H_2 after H_1 to complete H_2.
Define H_3 as H_2 R I_2 U I_2 L J_2, where:

I_2 is H_2 rotated 90 degrees clockwise and flipped vertically.
J_2 is H_2 rotated 180 degrees.

Perform the steps of H_3 after H_2 to complete H_3.
Define H_4 and other H_n for even n the same way as H_2, but relative to H_{n-1}.
Define H_5 and other H_n for odd n the same way as H_3, but relative to H_{n-1}.
The integral Hilbert curve is H_infinity.

We get a function f(n) = (a, b) in this way, where (a, b) is the position of a point moving n units along the integral Hilbert curve starting from the origin. You may notice that if we draw this curve 2^{2n}-1 units long we get the nth iteration of the unit-square Hilbert curve magnified 2^n times.

Your task is to implement f(n). The shortest code to do so in any language wins.

Example inputs and outputs:

> 0
(0, 0)
> 1
(1, 0)
> 9
(2, 3)
> 17
(4, 1)
> 27
(6, 3)
> 41
(7, 6)
> 228
(9, 3)
> 325
(24, 3)

Note that your solution's algorithm must work in general; if you choose to implement your algorithm in a language where integers are of bounded size, that bound must not be a factor in your program's code.


Optimizing the telephone keypad There seems to be this ongoing craze about people tediously learning new keyboard layouts like Dvorak or Neo because it supposedly makes them more productive. I argue that switching keyboard layouts is a bad idea, because it can take you months to get up to speed, and when you're finially 5% faster than the rest, you're screwed if you need to type on a computer that isn't your own.

Also, all these people forget where the real bottleneck in modern communication lies - the telephone keypad.

This is how your average telephone keypad looks like:

Letter 'r' is the third letter on button 7; so if you were to type the letter 'r' on a mobile phone, you would press button 7 three times, for 's' you'd press it 4 times, and for 'a' you'd press button 2 once.

Considering this, putting 'e' after 'd' was probably a bad decision - 'e' is the most commonly used letter in the english alphabet, so, if you were to label button 3 "EDF" instead of "DEF", you would save quite a lot of keystrokes.

Moreover, you've probably experienced yourselves that typing 2 letters that share the same button is a nuisance - if you want to write "TU", you can't just hit 8 three times, because that would result in 'V'. So usually you'd write 'T', then hit space, then hit backspace, and then write 'U', which equals 5 button presses instead of 3.

TL;DR

Given these two rules:

A letter is typed by pressing a button n times, where n is the position of where the letter is at on the button's label
Writing two letters that are typed using the same button requires an additional 2 button presses

What's the telephone keyboard layout that requires the least amount of button presses, given a specific text?
You should only use the buttons 2-9, 1 and 0 are reserved for special symbols.

Input

The text which you should find the optimal layout for is supplied via stdin. You don't need to handle anything other than the lowercase alphabet and can assume that the input consists of only that.
You can also assume that the input text is reasonably large and every letter is in there at least once, if that helps.

Output

I don't want to put too many constraints on the output, since that sometimes gives some languages advantages over others; so however your language shows arrays is fine, alternatively you can seperate each label with a newline.

There may be multiple possible optimal layouts, you can print any one of them.
Here's a simple example:

>> echo "jackdawslovemybigsphinxofquartz" | foo.sh
ojpt
avhz
cen
skm
dyf
wbq
ixu
lgr

Bonus Points

-35 if your algorithm is not brute-forcing all possible layouts (I'm looking at Haskell's `permutations' here)

-3 if your code fits inside a text message (140 chars) and you post a pic of you sending your code to a friend.

This is my first challenge on StackExchange. I'd be happy to hear whether you like it, or have any other feedback about it!

Perl, 333

$_=<>;$c{$&}++while/./g;@c=sort{$c{$b}<=>$c{$a}}keys%c;$d{$&.$1}++while/.(?=(.))/g;sub f{my$x=shift;if(my$c=pop@$x){for(grep!$_[$_],0..7){my@y = @_;$y[$_]=$c;f([@$x],@y)}}else{for(0..7){$z=$_[$_];$c+=$d{$z.$_}+$d{$_.$z}for@{$a[$_]}}$c<$m?($m=$c,@n=@_):1}}while(@c){$m= ~0;f[splice@c,0,8];push@{$a[$_]},$n[$_]for 0..7}print@$_,$/for@a

Here's an attempt to optimize for rule #2. After my comment, above, and in lieu of answers taking that rule into account (cf. high question rating), I thought that I owe some effort here...

Solutions that don't optimize for rule #2 can produce output very far from optimal. I checked long natural English text ("Alice in Wonderland", actually), pre-processed (lower case letters only), and e.g. Perl script from OJW's answer, result being

2: ermx
3: tdfz
4: alp
5: oub
6: ick
7: nwv
8: hgj
9: syq

er alone ruins it, plus some other pairs should never have ended on the same key...

Btw, zxqjvkbpfmygwculdrshnioate are letters sorted, frequency ascending, from that text.

If we try to solve it easy way (hoping for -35 bonus, maybe) and place letters one by one, choosing available key by minimal pair-wise count, we can end with e.g.:

slbx
hdmz
nrf
iuj
ogv
awk
tcp
eyq

I don't post code for this (wrong) solution here. E.g., note, c is more frequent than w and is placed first. tc (ct) pairs are obviously less frequent than ac (ca) - 43+235 against 202+355. But then w ends up with a -- 598+88. We end with pairs aw and tc (964 total), though it would be better ac and tw (635 total). Etc..

So, next algorithm tries to check each 8 remaining (or 2, if last) most frequent letters against letters already on the keypad, and to place them so that pair-wise count is minimal.

$_=<>;                          # Read STDIN.
$c{$&}++while/./g;              # Count letters (%c hash).
@c=sort{$c{$b}<=>$c{$a}}keys%c; # Sort them by frequency, ascending
$d{$&.$1}++while/.(?=(.))/g;    # (@c array), and count pairs (%d hash).

                                # Next is recursive sub that does the job.
                                # Some CPAN module for permutations
                                # would probably do better...
                                # Arguments are reference to array of what's
                                # left un-placed of current 8-pack of letters,
sub f{                          # and 8 element list of placed letters
    my$x=shift;                 # (or undefs).
    if(my$c=pop@$x){            # Pop a letter from 8-pack (if anything left),
        for(grep!$_[$_],0..7){  # try placing it on each available key, and
            my@y = @_;          # call sub again passing updated arguments.
            $y[$_]=$c;
            f([@$x],@y)
        }
    }else{                      # If, OTOH, 8-pack is exhausted, find sum of
        for(0..7){              # pairs count of current permutation (@_) and
            $z=$_[$_];          # letters placed in previous rounds (8-packs).
                                # @a is "array of arrays" - note, we didn't
                                # have to initialize it. First "8-pack" will
                                # be placed on empty keypad "automatically".
                                # We re-use undefined (i.e. 0) $c.

            $c+=$d{$z.$_}+$d{$_.$z}for@{$a[$_]}
        }
        $c<$m                   # Is sum for current placement minimal?
            ?($m=$c,@n=@_)      # Then remember this minimum and placement.
            :1
    }
}

while(@c){
    $m= ~0;                         # Initialize "minimum" with large enough
    f[splice@c,0,8];                # number, then call sub with each 8-pack
                                    # (and empty list of placed letters
                                    # from current round). On return,
                                    # @n will have optimal arrangement.
    push@{$a[$_]},$n[$_]for 0..7    # Then place it permanently on keypad.
}
print@$_,$/for@a                    # Show us what you've done.

Result is:

sdfz
hlmx
nrv
iyp
ogk
acq
twb
euj

I don't like the ac pair (The Cat being one of the characters, after all), but, still that's optimal letter placement for English, if my code is not wrong. Not exactly 'golfing' effort, just some working solution, ugly or not.


Golf Me A Text-Editor Golf Me a Text Editor

(similar challenges: Create a simple line editor and Line editor (more text here))

I seem to have forgotten which program to use to open, read, and write text files. Something like Noteleaf or VSBro or ... You see my conundrum. But never fear! I know some people who can write one. But I'm a bit limited on space, so shorter programs would be much appreciated.

The Challenge

Create a program, in your language of choice, that can open, read, and write plaintext files. The program should take input from your language's equivalent of STDIN and write the contents of the file to STDOUT (or equivalent). The program should close the file after the user is done with it (when they type 'q'). If the file does not exist, then the program should create a new one with the given filename. Editing is done line-by-line. The user gives the line number they wish to edit, and then give the new content of that line. If there is no content given, the line should be removed. Additional specifications are listed below.

Commands

filename?> - opens the specified file. If a file with the given name can not be found, create a new file. If the user types DELETE, then the program should prompt with delete?>.
delete?> - "deletes" the file. This is done by blanking it (i.e. replacing its contents with ""), which will suffice for this challenge. If the file can not be found, then print FILE NOT FOUND.
line?> - the given line number is where the text will be changed when content?> is given. If q is entered, then close the file and exit. If a is entered, then append a new empty line to the end of the file. If the index is out of bounds (i.e. does not exist (the text files can be 1 or 0 based indexed)) then print Error!.
content?> - input that is given here will replace that of the previous content of the line given earlier (line?>). If empty then delete that line (remove content from the line and shift all lines after it up one).

After each filename?> and content?> the contents of the file should be printed, as well as -- followed by the number of lines in the file.

Examples

A (rather bad) example program in Python3 can be found here.

Example deletions:

filename?>DELETE
delete?>passwords.txt

filename?>DELETE
delete?>evidence.txt
FILE NOT FOUND

Example run:

filename?>passwords.txt
password
admin
1234
********
p@$$w0rd
c0d3_1$_l!f3
--
6
line?>3
content?>12345678
password
admin
12345678
********
p@$$w0rd
c0d3_1$_l!f3
--
6
line?>4
content?>
password
admin
12345678
p@$$w0rd
c0d3_1$_l!f3
--
6
line?>a
password
admin
12345678
p@$$w0rd
c0d3_1$_l!f3

--
7
line?>9
Error!

line?>1
content?>passcode
passcode
admin
12345678
p@$$w0rd
c0d3_1$_l!f3

--
7
line?>5
content?>
password
admin
12345678
p@$$w0rd

--
6
line?>q

Remember, this is code-golf, so the shortest answer in bytes wins!

Bash, 388 375 characters

Note that I am aware that further clarifications may come which will invalidate my solution.
Feel free to carry out any necessary modification in the requirement.
I posted this because the challenge is complex and may help to see how someone else understood it when editing for clarification.

set -f
IFS=
read -pfilename?\> f
[ $f = DELETE ]&&{
read -pdelete?\> f
[ -f $f ]&&>$f||echo FILE NOT FOUND
exit
}
[ -f $f ]&&mapfile t<$f
echo "${t[*]}--"
while read -plineno?\> l;do
[ $l = q ]&&break
[ $l = a ]&&t+=('
')||{ ((l>=${#t[@]}))&&echo Error!&&continue
read -pcontent?\> c
[ $c ]&&t[l]="$c
"||t=(${t[@]::l} ${t[@]:l+1})
}
echo "${t[*]}--"
done
echo -n "${t[*]}">$f

Thanks to:

GammaFunction for suggesting set -f to make some quoting unnecessary (13 characters).


Last k digits of Powers of 2 For any integer \$r\$, there exists a
power of 2 each of whose last \$r\$ digits
are either 1 or 2.

Given \$r\$, find the smallest \$x\$ such that \$2^x\bmod{10^r}\$ consists of only 1 or 2.
For \$r=2\$, \$x=9\$, since \$2^9=5\color{blue}{\textrm{12}}\$
For \$r=3\$, \$x=89\$, since \$2^{89}=618970019642690137449562\color{blue}{\textrm{112}}\$
Note: for \$r=4\$, \$x\$ is \$=89\$ (again)
Input : \$r \leq 100\$
Output : \$x\$
Eg.

Input : 2
Ouput : 9
Input : 3
Ouput : 89

The program should run in a reasonable amount of time.
EDIT: The oeis sequence for this challenge is A147884.


Find All Distinct Gozinta Chains Gozinta Chains
(Inspired by Project Euler #606)
A gozinta chain for n is a sequence {1,a,b,...,n} where each element properly divides the next.
For example, there are eight distinct gozinta chains for 12:
{1,12}, {1,2,12}, {1,2,4,12}, {1,2,6,12}, {1,3,12}, {1,3,6,12}, {1,4,12} and {1,6,12}.

The Challenge
Write a program or function that accepts a positive integer (n > 1) and outputs or returns all the distinct gozinta chains for the given number.

Order in the chains matters (ascending), order of the chains does not.
On the off-chance it exists, you cannot use a builtin that solves the challenge.
This is code-golf.

Edit: Removing 1 as a potential input.

Python 3, 68 65 bytes
Edit: -3 bytes thanks to @notjagan

f=lambda x:[y+[x]for k in range(1,x)if x%k<1for y in f(k)]or[[x]]

Try it online!
Explanation
Each gozinta chain consists of the number x at the end of the chain, with at least one divisor to the left of it. For each divisor k of x the chains [1,...,k,x] are distinct. We can therefore for each divisor k find all of its distinct gozinta chains  and append x to the end of them, to get all distinct gozinta chains with k directly to the left of x. This is done recursively until x = 1 where [[1]] is returned, as all gozinta chains start with 1, meaning the recursion have bottomed out.
The code becomes so short due to Python list comprehension allowing double iteration. This means that the values found in f(k) can be added to the same list for all of the different divisors k.


A Radiation Hardened Palindromic Quine There are radiation hardened quines, palindromic quines, but has anyone tried both?!
I think not!

Rules

So the challenge here is to make a quine that if any symbol is deleted it prints its original source code, and the quine needs to be the same read forward and backwards(before radiation damage)! All code will be scored based on bytes required to write it.

Things to avoid

Do not use any programs that are capable of directly examining their code and outputting it (that even means programs that take their source and dump it into some sort of data)
Do not use anything that somehow cheats all of this (like a function that outputs itself and some other character... please)

DO YOUR BEST!!!

Gol><>, 78 bytes

\<"2ss}}l2%?:}a`(:&K&:&]r&[r~H>.!01<<\

\<<10!.>H~r[&r]&:&K&:(`a}:?%2l}}ss2"<\

Try it online!

Verification!

A variation on the radiation hardened quine I posted yesterday. It's a little more complex since it needs to reverse the copied section using the undocumented [] operators, as well as redirect the pointer in one copy. If you're a little confused about why it doesn't look like a palindrome, remember that ><> is a palindrome itself.


Totalling Troublesome T's Given a "T" shape on an x * y number grid, with length W on the top bar and H on the stem of the T, with the bottom of the T on the square numbered n: calculate the total of all of the numbers in the T shape. W must be an odd number and all must be positive integers.

Here are some examples of valid T's on a 9*9 grid:

Looking at the T where n=32, W=3 & H=4, you can see that the total is:4 + 5 + 6 + 14 + 23 + 32 = 84.

The Challenge

Your challenge is to create a program which, when given five positive integers, x, y, W, H and n, output the total of the T with those values (W must be odd, given an even number the program can output anything or even crash). The numbers may be inputted in any reasonable format. If the T does not fit on the given grid, then any output is acceptable.

Example Code (Python 3.6.2)

x = int(input())
y = int(input())
W = int(input())
H = int(input())
n = int(input())

total = 0

#"Stem" of the T
for i in range(H - 1):
    total += n - (x * i) #Decrease increment by length of row each time

#Top of the T
for i in range(-W//2 + 1, W//2 + 1): #Iterate over the width offset so that the center is zero
    total += (n - (x * (H - 1))) + i #Add the top squares on the T, one less to the left and one more to the right

print(total)

As with most challenges here this is code-golf, so the answer with the shortest code in bytes wins.

JavaScript (ES6), 32 30 bytes

Saved 2 bytes thanks to @Shaggy

(w,h,x)=>Q=n=>--h?n+Q(n-x):n*w

Takes input in a curried format: f(W,H,x,y)(n)

let f =
(w,h,x)=>Q=n=>--h?n+Q(n-x):n*w;

console.log(
  f(3, 4, 9, 9)(32)
);

How?

First we note that the sum of the T starting at n with height H can be broken down into two sums:

n
The sum of the T starting one row higher with height H - 1

By repeatedly adding n to the total, moving one row up, and subtracting 1 from H until it reaches 1, we end up summing the vertical stem of the T. Moving one row up is accomplished by subtracting x from n, since it can be observed that the difference between any cell and the one above is x.

When H reaches 1, we now have only the crossbar of width W left to sum. At this point n represents the center of the crossbar. We could sum the crossbar recursively as we did with the stem, but instead we take advantage of a fairly simple formula:

sum(n - a : n + a) = (n - a) + (n - (a-1)) + ... + n + ... + (n + (a-1)) + (n + a)
                   = (n - a) + (n + a) + (n - (a-1)) + (n + (a-1)) + ... + n
                   = 2n + 2n + ... + n
                   = n * (2a + 1)

In this case, our a is (W - 1) / 2, which makes

n * (2a + 1) = n * (((W - 1) / 2) * 2 + 1)
             = n * ((W - 1) + 1)
             = n * W

which is the sum of the crossbar.


ANNNOUNNNCCCEEERRR VOICCCEEE Write a function that takes a string of letters and spaces (no need to handle non-letters) and performs the ANNOUNCER VOICE translation algorithm as follows:

First, uppercase everything.
For each word,

Elongate each consonant cluster by tripling each letter; except, if the word begins with a consonant cluster, do not elongate that cluster. For example, other should become OTTTHHHEEERRR but mother should become MOTTTHHHEEERRR.
Elongate the final vowel by tripling it.

In both cases of elongation, if you're tripling a letter, first coalesce it with duplicate letters on either side. For example, hill should become HIIILLL and bookkeeper should become BOOKKKEEPPPEEERRR.
For the purposes of this challenge, y counts as a consonant.
Clarification/simplification: You may assume that each pair of words is separated by a single space, and that the input contains no consecutive spaces, and that the input will not be the empty string.
Shortest code wins!

Test vectors:

> sunday sunday
SUNNNDDDAAAYYY SUNNNDDDAAAYYY
> mia hamm
MIAAA HAAAMMM
> chester alan arthur
CHESSSTTTEEERRR ALLLAAANNN ARRRTTTHHHUUURRR
> attention please
ATTTENNNTTTIOOONNN PLEASSSEEE
> supercalifragilisticexpialidocious
SUPPPERRRCCCALLLIFFFRRRAGGGILLLISSSTTTICCCEXXXPPPIALLLIDDDOCCCIOUUUSSS
> moo
MOOO
> Aachen
AACCCHHHEEENNN
> Oooh
OOOHHH
> grifffest
GRIFFFEEESSSTTT
> k
K
> aaaabbbbc
AAAABBBBCCC

Here's a reference implementation which I would move to an answer except that as of this morning the question's been closed. :P

import itertools,re
def j(s):return re.match('^[AEIOU]+$',s)
def c(s):return ''.join(sum(([h,h,h]for h in[k for k,g in itertools.groupby(s)]),[]))
def v(s):
 while len(s)>=2 and s[-2]==s[-1]:s=s[:-1]
 return s+s[-1]+s[-1]
def a(n):
 r=''
 for w in n.split():
  if r:r+=' '
  ss=re.split('([AEIOU]+)', w.upper())
  for i,s in enumerate(ss):
   r += [v(s),s][any(j(t) for t in ss[i+1:])]if j(s)else[s,c(s)][i>0]
 return r
while 1:print a(raw_input('> '))

APL (Dyalog), 175 bytes

1↓' +'⎕R' '⊢'[AEIOU][^AEIOU]+ '⎕R{m/⍨1,3×2≠/m←⍵.Match}'([AEIOU])\1*([^AEIOU]*? )' ' [AEIOU]' ' [^ AEIOU]+' '([^AEIOU ])\1*'⎕R'\1\1\1\2' '&' '&' '\1\1\1'⊢'$| |^'⎕R'  '⊢1(819⌶)⍞

Try it online!

⍞ prompt for character input

1(819⌶) convert to uppercase (819 ≈ Big)

⊢ pass the result further (serves to separate the strings and the 1)

'$| |^'⎕R'  ' Replace:
 the end, any space, and the beginning
 → two spaces

⊢ pass the result further (serves to separate two groups of strings)

'([AEIOU])\1*([^AEIOU]*? )' ' [AEIOU]' ' [^ AEIOU]+' '([^AEIOU ])\1*'⎕R'\1\1\1\2' '&' '&' '\1\1\1' Replace:
 any number of identical vowels and any number of non-vowels and a space
 → the vowel thrice and the unmodified consonants
 a space and a vowel
 → themselves
 a space and a consonant cluster
 → themselves
 a run of identical consonants
 → three of those vowels

'[AEIOU][^AEIOU]+ '⎕R{…} Replace:
 a run of non-vowels and a space
 → the result of the following anonymous function with the namespace ⍵ as argument:
  ⍵.Match the text that was found
  m← assign that to m
  2≠/ pair-wise different-from
  3× multiply by three
  1, prepend one
  m/⍨ use that to replicate m

⊢ pass the result further (serves to separate two strings)

' +'⎕R' ' Replace:
 one or more spaces
 → with a single space

1↓ drop the initial letter (a space)


Taylor Series of a Function with Periodic Derivatives Taylor series are a very useful tool in calculating values of analytic functions that cannot be expressed in terms of elementary functions, using only information about that function at a single point.
In this challenge, you won't be actually doing any math with them, but merely making string representations of taylor series of functions with periodic derivatives.
Specs
You will takes a input three things:

A cycle of the derivatives of the function, including the original function as a list of strings, e.g. ["sin(x)", "cos(x)", "-sin(x)", "-cos(x)"].
A number a, the point around which to center the approximation.
A positive integer n, the number of terms of the series to output.

The general form for the nth term of a taylor series is:
f^(n)(a)/n!*(x-a)^n

where f^(n) is the nth derivative of f. Here is the taylor series of f in a better formatted image from wikipedia:
.
The above example with sin(x), and a of 1, and n of 6, would have an output of:
sin(1) + cos(1)*(x-1) - sin(1)/2*(x-1)^2 - cos(1)/6*(x-1)^3 + sin(1)/24*(x-1)^4 + cos(1)/120*(x-1)^5

You can do the whitespace want. However, you have to replace + - and - - with - and + respectively. Also, if the series is a maclaurin series, and a is 0, you cannot have (x-0). (x) and just x is fine, but not (x-0). Niether can you have ^0 nor ^1 nor /1 . Additionally, you must expand out the factorials in the denominators. Multiplication by juxtaposition is not allowed.
Test cases
["e^x"], 0, 4  ->  e^0 + e^0*x + e^0*x^2/2 + e^0*x^3/6
["sin(x)", "cos(x)", "-sin(x)", "-cos(x)"], 1, 6 -> sin(1) + cos(1)*(x-1) - sin(1)/2*(x-1)^2 - cos(1)/6*(x-1)^3 + sin(1)/24*(x-1)^4 + cos(1)/120*(x-1)^5
["e^(i*x)", "i * e^(i*x)", "-e^(i*x)", "-i*e^(i*x)"], 0, 7 -> e^(i*0) + i*e^(i*0)*x - e^(i*0)*x^2/2 - i*e^(i*0)*x^3/6 + e^(i*0)*x^4/24 + i*e^(i*0)*x^5/120 - e^(i*0)*x^6/720

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

JavaScript (ES6), 183 bytes

(c,a,n)=>[...Array(n)].map((_,i)=>(s=c[i%c.length].replace(/x/g,a),i?s=s.replace(/^-?/,c=>c?` - `:` + `)+(a>0?`*(x-${a})`:a<0?`*(x+${-a})`:`*x`):s,i>1?s+`^${i}/${f*=i}`:s),f=1).join``

Lots of tedious string manipulation. Explanation:

(c,a,n)=>                               Parameters
 [...Array(n)].map((_,i)=>(             Loop i from 0 to n-1
  s=c[i%c.length]                       Get the right element from the cycle
   .replace(/x/g,a),                    Substitute a in for x
  i?                                    If i > 0
   s=s.replace(/^-?/,c=>c?` - `:` + `)  Turn the sign into an operator
    +(a>0?`*(x-${a})`                   If a > 0 then * (x - a)
     :a<0?`*(x+${-a})`                  If a < 0 then * (x + -a)
     :`*x`)                             If a == 0 then * x
   :s,                                  No change if i < 1
  i>1?                                  If i > 1
   s+`^${i}/${f*=i}`                    Append ^ i / i!
   :s),                                 No change if i < 2
  f=1                                   0! == 1
 ).join``                               Join all the results together

170 bytes if you remove all the whitespace:

(c,a,n)=>[...Array(n)].map((_,i)=>(s=c[i%c.length].replace(/x/g,a),i?s=(s[0]=='-'?'':'+')+s+(a>0?`*(x-${a})`:a<0?`*(x+${-a})`:`*x`):s,i>1?s+`^${i}/${f*=i}`:s),f=1).join``


Tips for golfing in LOLCODE What general tips do you have for golfing in LOLCODE? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to LOLCODE. (e.g. "remove comments" is not an answer). Please post one tip per answer.

Define variables using the syntax variable R value rather than I HAS A variable ITZ value.

If you want to set a variable n equal to 1,

n R 1

is only 5 bytes, whereas

I HAS A n ITZ 1

is 15 bytes.


PARI GP

binomial(2*n,n)

Mathematica

Binomial[2n, n]


Take an input, a formula, and do f(x) What I want:
Take an input, x
Take a formula. It has to be capable of reading something in the format:

ax^m + bx^n + cx^o ... where m, n, o and any terms after that can represent any value.
coefficients, again for any number. For example, 6x^2. (That means 6(x^2))
Doesn't necessarily have to put up with spaces
times, divide, plus and minus
brackets - up to stacking of 5
ANY negative numbers
fractions
To the power of x , these can be integeric (<-- is not a word, but that is the best word I can make up!)
If x = 5, you can put -x to get -5 and -x^2 is -(x^2). You could use (-x)^2

After it interprets the formula, it has to plug x into the function, then output the value.
The Challenge:

Do it in as less bytes as possible
The lowest number of bytes wins!

Note: I feel that I have included everything here, but if I haven't please comment below, and I will answer it within the next 30 minutes!
Example
Key:
bp = Background Process

Give me an input, (x)

4

Give me a formula:

2^x

(bp) So I have to do 2 to the power of x, which is 2^4, which is 16
Output: 16

TI BASIC, 6 bytes
This might change, since the rules are still not totally stable, but I wanted to post this while I could.
:Prompt X,F
:F

Asks for X, then parses whatever formula is put into F and displays it.
If I could assume that X was already stored in the memory, it would be
TI BASIC (maybe), 0 bytes

Is this ok?Guess not. :-(


Check if point lies inside triangle Your goal is to determine whether a given 2D point X lies within the area of the triangle with given vertices A,B,C.

Write a function that takes in the coordinates of the test point X and the three triangle vertices (so that's 8 coordinates total) and returns True if the point lies inside that triangle, and False if it lies outside.

Don't worry about edge cases. If the point lies on the boundary of the triangle (edge or vertex) or the triangle is actually a line segment, your code can do whatever, including crashing. Also don't worry about numerical stability or floating-point precision.

Your code must be a named function. Code snippets will not be accepted.

Fewest characters wins.

Input:

Eight real numbers representing coordinates. The numbers will lie in the range (-1,1).

The exact input format is flexible. You could, for example, take in eight numbers, a list of eight numbers, a list of four points each given by a tuple, a 2*4 matrix, four complex numbers, two lists of the x-coordinates and y-coordinates, and so on.

The input needs to just be the numbers in some container, with no additional data. You can't use the input to do any preprocessing, nor may you require any constraints on the input, such as requiring the points be given in ascending y coordinate. Your input must allow any eight coordinates (though your code can behave arbitrarily in the edge cases mentioned earlier).

Please state your input format.

Output:

Either the corresponding Boolean True/False, the corresponding number 1/0, or the analogues in your language.

Test cases

The inputs are given a list [X,A,B,C] of four tuples, the test point first, then the three triangle vertices. I've grouped them into those whose outputs should be True and those that should be False.

True instances:

[(-0.31961, -0.12646), (0.38478, 0.37419), (-0.30613, -0.59754), (-0.85548, 0.6633)]
[(-0.87427, -0.00831), (0.78829, 0.60409), (-0.90904, -0.13856), (-0.80685, 0.48468)]
[(0.28997, -0.03668), (-0.28362, 0.42831), (0.39332, -0.07474), (-0.48694, -0.10497)]
[(-0.07783, 0.04415), (-0.34355, -0.07161), (0.59105, -0.93145), (0.29402, 0.90334)]
[(0.36107, 0.05389), (0.27103, 0.47754), (-0.00341, -0.79472), (0.82549, -0.29028)]
[(-0.01655, -0.20437), (-0.36194, -0.90281), (-0.26515, -0.4172), (0.36181, 0.51683)]
[(-0.12198, -0.45897), (-0.35128, -0.85405), (0.84566, 0.99364), (0.13767, 0.78618)]
[(-0.03847, -0.81531), (-0.18704, -0.33282), (-0.95717, -0.6337), (0.10976, -0.88374)]
[(0.07904, -0.06245), (0.95181, -0.84223), (-0.75583, -0.34406), (0.16785, 0.87519)]
[(-0.33485, 0.53875), (-0.25173, 0.51317), (-0.62441, -0.90698), (-0.47925, 0.74832)]

False instances:

[(-0.99103, 0.43842), (0.78128, -0.10985), (-0.84714, -0.20558), (-0.08925, -0.78608)]
[(0.15087, -0.56212), (-0.87374, -0.3787), (0.86403, 0.60374), (0.01392, 0.84362)]
[(0.1114, 0.66496), (-0.92633, 0.27408), (0.92439, 0.43692), (0.8298, -0.29647)]
[(0.87786, -0.8594), (-0.42283, -0.97999), (0.58659, -0.327), (-0.22656, 0.80896)]
[(0.43525, -0.8923), (0.86119, 0.78278), (-0.01348, 0.98093), (-0.56244, -0.75129)]
[(-0.73365, 0.28332), (0.63263, 0.17177), (-0.38398, -0.43497), (-0.31123, 0.73168)]
[(-0.57694, -0.87713), (-0.93622, 0.89397), (0.93117, 0.40775), (0.2323, -0.30718)]
[(0.91059, 0.75966), (0.60118, 0.73186), (0.32178, 0.88296), (-0.90087, -0.26367)]
[(0.3463, -0.89397), (0.99108, 0.13557), (0.50122, -0.8724), (0.43385, 0.00167)]
[(0.88121, 0.36469), (-0.29829, 0.21429), (0.31395, 0.2734), (0.43267, -0.78192)]

Javascript / ECMAScript 6, 161 159 158 / 152

Javascript:

function $(t,r,i,a,n,g,l,e){b=(-g*l+a*(-n+l)+i*(g-e)+n*e)/2;c=b<0?-1:1;d=(a*l-i*e+(e-a)*t+(i-l)*r)*c;f=(i*g-a*n+(a-g)*t+(n-i)*r)*c;return d>0&&f>0&&d+f<2*b*c}

ECMAScript 6 version (thanks m.buettner, saves 6 characters)

$=(t,r,i,a,n,g,l,e)=>{b=(-g*l+a*(-n+l)+i*(g-e)+n*e)/2;c=b<0?-1:1;d=(a*l-i*e+(e-a)*t+(i-l)*r)*c;f=(i*g-a*n+(a-g)*t+(n-i)*r)*c;return d>0&&f>0&&d+f<2*b*c}

Call it as such (returns true or false):

$(pointX, pointY, v1X, v1Y, v2X, v2Y, v3X, v3Y);

Uses some fancy barycentric coordinate math based on code from this answer. An ungolfed version for your reading enjoyment follows:

function $ (pointX, pointY, v1X, v1Y, v2X, v2Y, v3X, v3Y) {
  var A =  (-v2Y * v3X + v1Y * (-v2X + v3X) + v1X * (v2Y - v3Y) + v2X * v3Y) / 2;
  var sign = A < 0 ? -1 : 1;
  var s = (v1Y * v3X - v1X * v3Y + (v3Y - v1Y) * pointX + (v1X - v3X) * pointY) * sign;
  var t = (v1X * v2Y - v1Y * v2X + (v1Y - v2Y) * pointX + (v2X - v1X) * pointY) * sign;
  return s > 0 && t > 0 && s + t < 2 * A * sign;
}


Is it in the polygon? The challenge
Given point and a path of points, say whether or not the point is in the polygon that is created by the path.
Also return true if the point is on an edge of the polygon.
Input
A list of pairs of integers.
The first 2 integers represent the point.
The remaining pairs (3rd and 4th, 5th and 6th etc.) represent the vertices of the polygon.
The edges are in the order of the input pairs.
The path is assumed to loop back to the first point of the path.
The input is assumed to be valid.
No three points in the path are collinear.
ex. 123 82 84 01 83 42
Output
A truthy/falsy value.
Test cases
Input -> Output
0 0 10 10 10 -1 -5 0 -> true
5 5 10 10 10 50 50 20 -> false
5 5 0 0 0 10 1 20 6 30 10 -40 -> true
This is code-golf. Shortest answer in bytes wins.

Charcoal, 52 50 bytes
≔⪪Ａ²θＦ⟦Ｅ³§θ⊖ιθ✂θ¹⟧⊞υ↔ΣＥι⁻×§κ⁰§§ι⊕λ¹×§κ¹§§ι⊕λ⁰⁼⊟υΣυ

Try it online! Link is to verbose version of code. Explanation:
≔⪪Ａ²θ

Split the input into pairs of coordinates.
Ｆ⟦Ｅ³§θ⊖ιθ✂θ¹⟧

Calculate the area of three polygons: the one formed by taking the last, first and second points; the one formed from all of the points (including the test point); the one formed from all of the points except the test point.
⊞υ↔ΣＥι⁻×§κ⁰§§ι⊕λ¹×§κ¹§§ι⊕λ⁰

Use the shoelace formula to calculate the area of that polygon.
⁼⊟υΣυ

Check whether the last area equals the sum of the first two. If this is the case, then the point lies within the polygon.


Underhanded contest (?): Anti-Virus wars Prove anti-virus software is paranoid by making a program that simply opens and alphabetically sorts a CSV file, that will get flagged as a virus (or malware/spyware/any threat really) when run.

You will be assessed by the following criteria:

Does the cross-platform anti-virus package ClamAV detect it as a threat?
Your code is not actually a virus (if the code looks fishy it will be deducted points)
Conciseness of code

The specific target for this challenge is the following version of ClamAV with the following virus definitions (current as of the posting of this challenge). Your program must trigger this set of software/definitions to be eligible.

You may wish to use a virtual machine for testing your code.

Latest ClamAV® stable release is: 0.98.1
ClamAV Virus Databases:
main.cvd ver. 55 released on 17 Sep 2013 10:57 :0400 (sig count: 2424225)
daily.cvd ver. 18639 released on 19 Mar 2014 06:45 :0400 (sig count: 839186)
bytecode.cvd ver. 236 released on 05 Feb 2014 12:36 :0500 (sig count: 43)
safebrowsing.cvd ver. 41695 released on 19 Mar 2014 03:00 :0400 (sig count: 1147457)

bash (113)

sort -t, "$1"
#PK^C^D^@^@^@^@^@^@^@^@^@^@^@^@^@^@D^@^@^@D^@^@^@^@^@^@^@X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

The above uses caret notation. Notably, ^@ indicates a null byte.

How it works

sort -t, "$1" sorts the file specified as the first command-line argument ($1), using the comma character as field delimiter (-t,).
# at the beginning of the second line comments it out; it will get ignored by bash.
PK^C^D^@^@^@^@^@^@^@^@^@^@^@^@^@^@D^@^@^@D^@^@^@^@^@^@^@ is the shortest possible ZIP file local file header:

PK^C^D (0x04034B50) is the local file header signature.
^@^@^@^@^@^@^@^@^@^@^@^@^@^@ specifies the ZIP version, a bit flag, the compression method and the compressed file's mtime and checksum. All are set to zero.
The twice occurring D^@^@^@ (0x00000044 or 68) specifies the file's compressed and uncompressed length (68 bytes).
^@^@^@^@ specifies the filename and extra header length. Both are set to zero.

X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H* is the 68 byte long  EICAR test string, which serves as the data associated to the above header.

This takes advantage of the fact that ClamAV will act on all ZIP file local file headers, even if they're encountered outside of actual ZIP files.

Malware scan

VirusTotal gives 15 false positives out of its current 51 scanners. This includes ClamAV.


Approximate floating point number with n-digit precision We have a floating point number r between 0 and 1, and an integer p.

Find the fraction of integers with the smallest denominator, which approximates r with at least p-digit precision.

Inputs: r (a floating point number) and p (integer).
Outputs: a and b integers, where

a/b (as float) approximates r until p digits.
b is the possible smallest such positive integer.

For example:

if r=0.14159265358979 and p=9,
then the result is a=4687 and b=33102,
because 4687/33102=0.1415926530119026.

Any solution has to work in theory with arbitrary-precision types, but limitations caused by implementations' fixed-precision types do not matter.

Precision means the number of digits after "0." in r. Thus, if r=0.0123 and p=3, then a/b should start with 0.012. If the first p digits of the fractional part of r are 0, undefined behavior is acceptable.

Win criteria:

The algorithmically fastest algorithm wins. Speed is measured in O(p).
If there are multiple fastest algorithms, then the shortest wins.
My own answer is excluded from the set of the possible winners.

P.s. the math part is actually much easier as it seems, I suggest to read this post.

JavaScript, O(10p) & 72 bytes

r=>p=>{for(a=0,b=1,t=10**p;(a/b*t|0)-(r*t|0);a/b<r?a++:b++);return[a,b]}

It is trivial to prove that the loop will be done after at most O(10p) iterations.

f=
r=>p=>{for(a=0,b=1,t=10**p;(a/b*t|0)-(r*t|0);a/b<r?a++:b++);return[a,b]}
<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mrow>
    <mn>0.<input type="text" id="n" value="" oninput="[p,q]=f(+('0.'+n.value))(n.value.length);v1.value=p;v2.value=q;d.value=p/q" /></mn>
    <mo>=</mo>
    <mfrac>
      <mrow><mn><output id="v1">0</output></mn></mrow>
      <mrow><mn><output id="v2">1</output></mn></mrow>
    </mfrac>
    <mo>=</mo>
    <mn><output id="d">0</output></mn>
  </mrow>
</math>

Many thanks to Neil's idea, save 50 bytes.


Definite integral of polynomial functions You will need to evaluate the definite integral (bounded by \$a\$ and \$b\$) of a certain polynomial function that takes the form of:
$$\int_a^b \left( k_n x^n + k_{n-1} x^{n-1} + \cdots + k_2x^2 + k_1x + k_0 \: \right) dx$$
Normally, this can be done using the fundamental theorem of calculus and power rules. For example:
$$\int_b^c ax^n dx = a \frac{x^{n+1}} {n+1} \Big|^c_b = a\left[ \frac{c^{n+1}} {n+1} - \frac{b^{n+1}} {n+1} \right]$$
The challenge here is to replicate that process using the shortest amount of code as possible. You will decide the degree your program can solve. Somewhere in your answer, specify how many degrees your program can solve up to. For example:

My program can solve all polynomials up to the 5th degree. (quintic polynomial)

Input
Input will be two arrays consisting of bounds and coefficients. For example:
bounds = [2, 3]
coefficients = [4, 5, 2, 7]

The above input will yield this expression:
$$
\int_2^3 (4x^3 + 5x^2 + 2x + 7) \mathop{dx}
$$
Output
The output will be a single decimal number rounded to at least 3 decimal places. So the above expression will yield:
108.666666666667 // correct
108.6667 // correct
109 // wrong

 Constraints
$$
-10^9 < k_n, ..., k_1, k_0 < 10^9
$$
$$
0 < N < 30
$$
Integral bounds \$a, b\$ satisfy no additional constraints.
Rules & Scoring

Standard loopholes apply here as it does anywhere else.

You may not write a program that only solves a specific integral. Once you pick your degree, that program must work under all constraints up to that degree.

Your score will be calculated by this equation: degree of polynomial / num of bytes, and the highest score wins.

If your program works for all degrees above 30, set your numerator to be 30, otherwise 29 is the maximum possible numerator.

Please post a working version of your code on any website so that it can be tested.

Jelly, \$\frac {30} 7 = 4.29\$
÷J$ŻUḅI

Try it online!
Takes the polynomial as a list of coefficients in little-endian format (i.e. the example is 7,2,5,4). This can handle any (positive) degree you want, but I've limited it at 30 as the question states \$0 < N < 30\$
+2 bytes and a score of \$3.33\$ if the polynomial must be taken in big-endian format
How it works
÷J$ŻUḅI - Main link. Takes coeffs on the left and [a, b] on the right
  $     - To the coeffs:
 J      -   Yield [1, 2, 3, ..., N]
÷       -   Divide each coeff by the orders
   Ż    - Prepend 0
    U   - Reverse
     ḅ  - Calculate as polynomials, with x = a and x = b
      I - Reduce by subtraction


Letter Boxed, part 2: this time, solve it This challenge is a sequel to Letter Boxed Validator.
The New York Times has a daily online game called Letter Boxed (the link is behind a paywall; the game is also described here), presented on a square as follows:

You are given 4 groups of 3 letters (each group corresponds to one side on the picture); no letter appears twice. The aim of the game is to find words made of those 12 letters (and those letters only) such that:

Each word is at least 3 letters long;
Consecutive letters cannot be from the same side;
The last letter of a word becomes the first letter of the next word;
All letters are used at least once (letters can be reused).

In this challenge, you are given the letters, and a dictionary. The goal is to output a valid solution, which minimizes the number of words used. If there is no solution, any consistent output is acceptable.
For the input {{I,C,O}, {M,R,E}, {G,N,S}, {A,P,L}}, a valid solution is PILGRIMAGE, ENCLOSE. Another valid solution is SOMNOLENCE, EPIGRAM. The following are not valid:

PILGRIMAGE, ECONOMIES (can't have CO since they are on the same side)
GRIMACES, SOPRANO (L has not been used)
PILGRIMAGE, ENCLOSURE (U is not one of the 12 letters)
ENCLOSE, PILGRIMAGE (last letter of 1st word is not first letter of 2nd word)
CROPS, SAIL, LEAN, NOPE, ENIGMA (number of words is not minimal)

Input
Input consists of a dictionary, and of 4 groups of 3 letters. It can be in any suitable format.
Output
A list of words giving a solution to the challenge. There may be several acceptable solutions: you should output at least one, but may output several if you want.
Test cases
The test cases use this dictionary. If using a large dictionary is too difficult on TIO, you may use instead the dictionary {PILGRIMAGE, ENCLOSE, SOMNOLENCE, EPIGRAM, ECONOMIES, GRIMACES, SOPRANO, ENCLOSURE, CROPS, SAIL, LEAN, NOPE, ENIGMA, OVERFLOWS, STACK, QUESTIONABLY, QUARTZ, ZIGZAG, GHERKIN, CODE, GOLF, NO, I, DO, NOT, IN}, but your code should in principle work on a larger dictionary.
Note that the solution is not necessarily unique; these are possible solutions.
Input={{I,C,O}, {M,R,E}, {G,N,S}, {A,P,L}}.
Solution: PILGRIMAGE, ENCLOSE
Input:{{OSA}, {FVK}, {WEL}, {CTR}}.
Solution: OVERFLOWS, STACK.
Input: {{BCD}, {FGH}, {JKL}, {MNP}}.
No solution.
Input: {{AQT}, {LUI}, {BOE}, {NSY}}.
Solution: QUESTIONABLY
Input: {{QGN}, {ZUR}, {AHK}, {ITE}}.
Solution: QUARTZ, ZIGZAG, GHERKIN.
Scoring:
This code-golf, lowest score in bytes wins!

Jelly, 38 bytes

iⱮⱮL>2ƊƇẠƇ’:3IẠƲƇŒPU=ḢɗƝẠ$ƇFQL=ʋƇ12ịḷḢ

Try it online!

A dyadic link taking the flattened letters as left argument and the dictionary as right. Returns a list of strings of one of the shortest solutions, or a zero if there is no solution.

Full explanation to follow once it’s a bit better golfed.


The Saltine Challenge Here is an ASCII saltine cracker:
 _________________
|  .     .     .  |
|     .     .     |
|  .     .     .  |
|     .     .     |
|  .     .     .  |
|_________________|

Here are two crackers stacked:
 _________________
|  .     .     .  |
|     . __________|______
|  .   |  .     .     .  |
|     .|     .     .     |
|  .   |  .     .     .  |
|______|     .     .     |
       |  .     .     .  |
       |_________________|

Write the shortest program possible that takes a positive integer and draws a stack of that many ASCII saltine crackers.
Input may come from stdin, command line, or you may simply write a function. The input will always be valid. Output must go to stdout or closest alternative.
Each stacked cracker is always shifted 2 characters down and 7 characters right of the cracker below it. There should be no trailing spaces or extraneous newlines.
The shortest program in bytes wins.
Examples
If the input is 1 the output is
 _________________
|  .     .     .  |
|     .     .     |
|  .     .     .  |
|     .     .     |
|  .     .     .  |
|_________________|

If the input is 2 the output is
 _________________
|  .     .     .  |
|     . __________|______
|  .   |  .     .     .  |
|     .|     .     .     |
|  .   |  .     .     .  |
|______|     .     .     |
       |  .     .     .  |
       |_________________|

If the input is 3 the output is
 _________________
|  .     .     .  |
|     . __________|______
|  .   |  .     .     .  |
|     .|     . __________|______
|  .   |  .   |  .     .     .  |
|______|     .|     .     .     |
       |  .   |  .     .     .  |
       |______|     .     .     |
              |  .     .     .  |
              |_________________|

And so on.
the real saltine challenge


Better late than never! Your program / function, etc. will take 2 inputs. The first will be a list of who came to my party and when. Example:

Kevin 13:02
Ruby 5
Sam 3
Lisa 6
Bob 12

What does that mean? It means that Kevin got to my party first (at 13:02, 24-hour time), then Ruby 5 minutes later, then Sam 3 minutes later, then Lisa 6 minutes later, and last Bob 12 minutes later.

The second input will be when my party started. Example:

13:15

(24-hour time). Your output must be the list of people who were late. (Anyone exactly on time is fine.) Example calculations (just for example, don't output these)

Kevin 13:02
Ruby 13:07
Sam 13:10
Lisa 13:16
Bob 13:28

Lisa and Bob arrived after 13:15, therefore this program should print "Lisa,Bob".

Input assumptions

Input 1 will always be a name (regex [A-Z][a-z]*), then a space, then a 24-hour time in the form hours:minutes on the first line, then a name, a space, and a positive integer (number of minutes later) on the next lines. There will always be at least 1 line.
If you would like, you may take input 1 with any other character instead of a line break.
Input 2 will be in the format hours:minutes.
You may take your inputs as one string separated by any character if you want. This is optional.
Don't worry about day crossover. My parties never to after 23:59.

Output rules

Output can be a function return value or a string echoed to STDIN, a file, etc. You must return a string or an array / list.

If you return a string, it must be each person who was late (order does not matter), separated by any non-alphanumeric delimiter.
If you return an array / list, it must be a list of everyone who was late.

JavaScript (ES6), 98 97 bytes

Saved 1 byte thanks to Neil

Takes the list of guests l and the party time h in currying syntax (l)(h). Expects a trailing linebreak on the list. Returns a space-separated list of names such as Lisa Bob.

l=>h=>l.replace(/(.* )(.*)\n/g,(_,a,b)=>(t-=T(b))<0?a:'',t=(T=h=>eval(h.replace(/:/,'*60+')))(h))

Formatted and commented

l => h =>                         // given a list of guests l and a party time h
  l.replace(                      // for each guest in l:
    /(.* )(.*)\n/g,               //   extract the name a and arrival time b
    (_, a, b) =>                  //   subtract the arrival time from the time counter
      (t -= T(b)) < 0 ?           //   if the result is negative:
        a                         //     the guest is late: keep the name
      :                           //   else:
        '',                       //     the guest is on time: remove this entry
    t = (                         //   initialize the time counter t
      T = h =>                    //   define T():
        eval(                     //     a function that takes either a time
          h.replace(/:/, '*60+')  //     in hh:mm format or an amount of minutes
        )                         //     and returns an amount of minutes
    )(h)                          //   call it with the party time
  )                               // end of replace()

Demo

let f =

l=>h=>l.replace(/(.* )(.*)\n/g,(_,a,b)=>(t-=T(b))<0?a:'',t=(T=h=>eval(h.replace(/:/,'*60+')))(h))

console.log(f(`Kevin 13:02
Ruby 5
Sam 3
Lisa 6
Bob 12
`)('13:15'))


Is it a Cyclic number? A cyclic number is a number of "n" digits that when multiplied by 1, 2, 3,...n, results in the same digits but in a different order.

For example, the number 142,857 is a cyclic number since 142,857 x 2 = 285,714, 142,857 x 3 = 428,571, 142,857 x 4 = 571,428, and so on. Given an integer input, determine if it is a cyclic number by outputting a truthy value if it is, and a falsy value if not.

Also, to be clear, the input can contain leading 0's: e.g. 0344827586206896551724137931

This is because, if leading zeros are not permitted on numerals, then 142857 is the only cyclic number in decimal.

Since it is code-golf, shortest answer in bytes wins!

Actually, 18 bytes

;;ru@≈*♂$♂S♂≈╔@S≈=

Try it online! (expects quoted input)

Explanation:

;;ru@≈*♂$♂S♂≈╔@S≈=
;;                  duplicate input twice
  ru                range(1, len(input)+1)
    @≈              convert input to an integer
      *             multiply input by each element in range
       ♂$♂S♂≈       convert each product to a string, sort the digits, and convert back to int
             ╔      uniquify: remove duplicate elements
              @S≈   sort input and convert to int
                 =  compare equality


Square a Number my Way People keep telling me that the square of a number is the number multiplied by itself.  This is obviously false.  The correct way to square a number is to make it into a square, by stacking it on top of itself a number of times equal to the number of digits it has, and then reading all the numbers from the resultant square, both horizontally (from left to right only) and vertically (from up to down only), and then adding them together.  So, for the number 123, you first create the square:

123
123
123

Then you take all of the rows and columns from the square, and add them together:

123+123+123+111+222+333

Which gives us a result of 1035.

For negative numbers, you stack normally (remember that you only count the number of digits, so the negative sign is not included in the length), and then read the horizontal numbers normally (with negative signs), and then ignore the negative signs for the vertical numbers.  So, for the number -144 we get the square:

-144
-144
-144

Which gives us -144-144-144+111+444+444, which equals 567

For numbers with only one digit, the square is always equal to the number doubled (read once horizontally and once vertically).  So 4 gives us

4

Which gives us 4+4, which equals 8.

For numbers with decimal parts, stack normally (remember that only digits are counted in the number of times you stack the number, and therefore the decimal point is not counted), and ignore the decimal symbols when reading the vertical numbers.  For example, the number 244.2 gives us

244.2
244.2
244.2
244.2

Which gives us 244.2+244.2+244.2+244.2+2222+4444+4444+2222, which equals 14308.8.

Fractional or complex numbers cannot be squared.

Your Task:

I'm tired of squaring numbers my way by hand, so I've decided to automate the process.  Write me a program or function that takes a float or string, whichever you prefer, as input and returns the result of squaring it my way.

Examples:

123    -> 1035
388    -> 3273
9999   -> 79992
0      -> 0
8      -> 16
-6     -> 0
-25    -> 27
-144   -> 567
123.45 -> 167282.25
244.2  -> 14308.8
2      -> 4
-0.45  -> 997.65
0.45   -> 1000.35

Scoring:

My hands are getting cramped from writing out all those squares, and my computer doesn't support copy/paste, so the entry with the least amount of code for me to type (measured in bytes for some reason?) wins!

05AB1E, 7 bytes

þSDg×+O

Try it online!

Explanation

þSDg×+O Implicit input
þ       Keep digits
 S      Get chars
  D     Duplicate
   g    Length
    ×   Repeat string(s)
     +  Add (implicit input added to all elements)
      O Sum


Tips for golfing in > (Fish) Since I've been seeing more ><> submissions floating around lately, I thought it might be a good idea to have a tips page.

Please stick to one tip per post, unless they are closely related.

Official Python interpreter

Online interpreter (some bugs present, but good for most cases)

Checking against 0

Using ?! instead of 0=? typically saves a byte.

However, just a standard ? may sometimes be better if you can afford a bit of restructuring

?!vA
  B

versus

?vB
 A


An executable script file that runs on POSIX and Windows Challenge:  write a single script file foo.cmd which can be invoked from the vanilla Windows cmd.exe prompt (not PowerShell, not in administrator mode), to execute arbitrary Windows-specific code...

> .\foo.cmd
Hello Windows!

...but also be invoked unaltered from a typical POSIX-compliant (Linux/OSX) shell prompt (bash, tcsh, or zsh), to execute arbitrary POSIX-specific code:

$ chmod a+x foo.cmd
$ ./foo.cmd
Hello POSIX!

...without requiring installation or creation of third-party interpreters/tools.

I know this is possible, but with cruft (i.e. on Windows, one or two lines of garbage/error-message are printed to stderr or stdout before "Hello Windows!").

The winning criterion is minimization of (first) the number of cruft lines, and (second) the number of cruft characters.

Cruft can be defined as any console output (stdout or stderr) that is not produced by the (arbitrary) payload code. Blank lines are counted in the line count. Newlines are not counted in the character count.  Cruft scores should be summed across both platforms. Let's disregard mechanisms like cls that sweep away the cruft but at the cost of also blanking out previous terminal output. If Windows echos your commands because you haven't turned @echo off yet, let's exclude the characters it spends in printing the current directory and prompt.

A secondary criterion is the simplicity/elegance of the solution inside foo.cmd: if "infrastructure" is defined as any character not directly involved in the arbitrary payload code, then minimize first the number of lines that contain infrastructure characters, and second the total number of infrastructure characters.

Extra kudos if the POSIX part will work despite the file having CRLF line-endings! (Am not sure that last part is even possible.)

My existing solution, which I will post here once others have had a chance, uses 6 lines of infrastructure code (52 chars excluding newlines). It produces 5 lines of cruft, two of which are blank, all of which occur on Windows (30 chars excluding newlines and excluding the current directory/prompt string that appears on two of those lines).

0 cruft lines, 0 cruft chars, 2 infra. lines, 21 infra. chars, CRLF ok
:<<@goto:eof
@echo Hello Windows!
@goto:eof
echo "Hello POSIX!" #

Removed the other solution.
17 characters using exit /b from Digital Trauma's answer:
:<<@exit/b
@echo Hello Windows!
@exit/b
echo "Hello POSIX!" #


Twice as long, half the price Related: I double the source, you double the output!

When Steve Jobs launched the iPhone 3G, the slogan said

  Twice as fast, half the price

I changed the word fast to long to better represent this challenge.

Objective

Write a program that outputs a non-zero, even integer. If the source code is doubled, the value of the output must be cut off by half.

To double the source in a Unix shell (with Core Utilites):

cat source.txt source.txt > doubled-source.txt

Rules & Requirements

Now the requirement has changed and the task has been even more challenging!

You must build a full program.
The initial source is no longer required to be at least 1 byte long. An empty program qualifies as long as the output is correct.
Both the integers must be in base 10 (outputting them in any other base or with scientific notation is forbidden), and must not be zero. The integer is no longer required to be positive, so if you like a negative number, it's OK.
Your program must not take input (or have an unused, empty input) and must not throw any error (compiler warnings are not considered errors). Exit code must be zero.
Outputting the integers with trailing / leading spaces / newlines is allowed, as long as only one integer is output.
You can't assume a newline between copies of your source. If you need one, clarify it. See the Unix shell command above.
Standard loopholes are forbidden.

Because this is a code-golf, the shortest (original, undoubled) code in each language wins!

Extras

Please give description / explanation to your code if possible.

Brain-Flak, 12 bytes

(()()[][{}])

Outputs 2. Try it online!

The doubled program outputs 1. Try it online!

Explanation

This code pushes 2 + stack height - top of stack.  Initially, this is 2 + 0 - (implicit) 0 = 2.  When this code is run again, it pops the existing 2 and pushes 2 + 1 - 2 = 1.


Decode a UTF-8 string to character byte counts Given a UTF-8 string, give a string that represents byte counts of each characters.

Rules:

As long as the input string is encoded in UTF-8 (without BOM), its type doesn't matter. In C++, it can be char[] or std::string. In Haskell, it can be [Int8] or [CChar].
The output must be (in usual case) a string of ASCII digit characters. Its encoding doesn't matter.
When given an invalid UTF-8 sequence (including representation of surrogates), every bytes of the sequence are to be represented as the replacement character �.
Reserved characters and noncharacters are still considered as valid UTF-8 sequences, and thus must have corresponding output digit.
As this is a code-golf, the shortest code in bytes wins.

Example:

When given the following byte sequence:

00 80 C0 80 EB 80 80

The output must be:

1���3

Python 3, 135 bytes

def f(b):
	B=b.decode(errors="ignore")[:1].encode();l=len(B)
	if B and b[:l]!=B:return"�"+f(b[1:])
	return str(l)+f(b[l:])if b else''

Try it online!

Explanation:

def f(b):
	B=b.decode(errors="ignore")[:1].encode();l=len(B)
	 # B is the UTF-8-encoded version of the first Unicode character in the given bytes
	 # (Or the Nth, if the first N-1 bytes were invalid Unicode bytes)
	if B and b[:l]!=B:return"�"+f(b[1:])
	 # If the two encoded byte-strings don't match,
	 # then the first byte in b is invalid,
	 # so append "�" to the returned string, and recurse
	return str(l)+f(b[l:])if b else''
	 # If the byte-string is not empty,
	 #  append the length of the first character and recurse.
	 # Else (the input is empty) return the empty string (recursion base case)


Display a chain of little mountains with an odd number on the top of it! First line is made with ceil(n/2) elements where each element is: <space><odd-number><space>
Second line is made with ceil(n/2) elements, but each element is / \ only.
You may assume n >= 0 and n <= 10.
Examples
Input: 3
 1  3
/ \/ \

Input: 10
 1  3  5  7  9
/ \/ \/ \/ \/ \

Example in Python 3, 103 bytes:
lambda a:print("".join([" "+str(i)+" "for i in range(1,a+1,2)]+["\n"]+["/ \\"for i in range(1,a+1,2)]))

Shortest code in bytes wins :)

05AB1E, 19 15 14 12 bytes

05AB1E uses CP-1252 encoding.
Saved 4 bytes thanks to Adnan.
Saved 2 bytes thanks to carusocomputing

ÅÉðìDg…/ \×»

Try it online!

Explanation

ÅÉ               # list of uneven number up to input
  ðì             # prepend a space to each
    Dg           # get length of list
      …/ \       # push the string "/ \"
          ×      # repeat the string length-list times
           »     # join rows by spaces and columns by newlines


Tallest tower from a set of digits Edit: Bounty puzzle at the end of the question.

Given a set of 1-digit numbers, you should determine how tall a tower they can construct.

The digits live on a horizontal plane with a ground level where they can stand. No digit wants to be confused with a multi-digit number, so they always have an empty space on both of their sides.

4 2  1 9  6  8

A digit can be on top of another one:

2
6

or can be supported by two other diagonally below it:

 9
5 8

The bottom one(s) have to support the weight the upper one supports (if there is any), plus the upper one's weight which is always 1. If there are two supporters, they split the upper one's total weight evenly (50%-50%).

The weight of every digit is 1 independent of it's value.

If one digit supports two others it has to be able to support the sum of their corresponding weight. A digit can support at most its numerical value.

Some valid towers (with heights 4, 3 and 5):

            0
7           1
5    1     1 1         9 supports a total weight of 1.5 = (1+1/2)/2 + (1+1/2)/2
2   5 4    5 5
3  5 9 5  5 6 3        6 supports a total weight of 3 =  1.5 + 1.5 = (2*1+(2*1/2))/2 + (2*1+(2*1/2))/2

Some invalid towers:

1         5           The problems with the towers are (from left to right):
1  12    2 3     8      1 can't support 1+1; no space between 1 and 2;
1  5 6  1 1 1   9       1 can't support 1.5 = (1+1/2)/2 + (1+1/2)/2; 8 isn't properly supported (digits at both bottom diagonals or exactly below the 8)

You should write a program or function which given a list of digits as input outputs or returns the height of the highest tower constructable by using some (maybe all) of those digit.

Input

A list of non-negative single-digit numbers with at least one element.

Output

A single positive integer, the height of the highest constructable tower.
Your solution has to solve any example test case under a minute on my computer (I will only test close cases. I have a below-average PC.).

Examples

Format is Input list => Output number with a possible tower on the next lines which is not part of the output.

[0]  =>  1

0

[0, 1, 1, 1, 1, 1]  =>  3

  0
  1
 1 1

[1, 1, 1, 1, 1, 2, 2]  =>  4

   1
   1
  1 1
 1 2 2

[0, 0, 2, 2, 2, 2, 2, 5, 5, 5, 7, 7, 9]  =>  9

0
2
2
5
5
5
7
7
9

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

   1
   2
   2
   3
   4
   5
  3 3
 4 4 4
5 5 5 5

[0, 0, 0, 0, 0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 7, 7, 9]  =>  11

   0
   1
   2
   3
   4
   5
  3 3
  4 5
  5 5
 3 7 3
2 7 9 2

[0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]  =>  12

 0
 1
 2
 3
 4
 5
 6
 7
4 5
6 7
8 8
9 9

[0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9]  =>  18

      0
      1
      2
      3
      4
      5
      6
      7
      8
      9
     5 5
     6 6
     7 7
    4 8 4
   3 7 7 3
  2 6 8 6 2
 2 5 8 8 5 2
 3 9 9 9 9 3

This is code-golf, so the shortest entry wins.

Bounty

I will award 100 reputation bounty (unrelated to the already awarded one) for solving the extended problem below in polynomial time (in regard to the length of the input list) or proving that it isn't possible (assuming P!=NP). Details of the extended problem:

input numbers can be any non-negative integers not just digits
multi-digit numbers take up take same place as single-digit numbers
multi-digit numbers can support they numerical value e.g. 24 can support 24

The bounty offer has no expiry date. I will add and reward the bounty if a proof appears.

Python 2 - 326

Runs easily under the time limit for all the examples given, though I did sacrifice some efficiency for size, which would probably be noticeable given much larger inputs. Now that I think about it though, since only single digits numbers are allowed the largest possible tower may not be very big, and I wonder what the maximum is.

def S(u,c=0,w=[]):
 for(s,e)in[(len(w),lambda w,i:w[i]),(len(w)+1,lambda w,i:.5*sum(([0]+w+[0])[i:i+2]))]:
    m=u[:];l=[-1]*s
    for n in u:
     for i in range(s):
        if 0>l[i]and n>=e(w,i):m.remove(n);l[i]=n;break
    if([]==l or-1in l)==0:
     for r in S(m,c+1,[1+e(w,i)for i in range(s)]):yield r
 yield c
print max(S(sorted(input())))


When Bullets Collide This challenge is based off a riddle I read in some book a while ago, which I found again here. It is about bullets fired from a gun once per second at varying speeds that travel in a straight line forever. When one bullet hits another, both are destroyed completely. (Feel free to replace all instances of "bullet" with "missile".)
The Task
Given a list of bullet speeds in the order they're fired in, determine whether all bullets are destroyed.
The Rules

Input is a list of non-negative integers, separated by any delimiter and with one optional character before and after. These are valid inputs: 1 2 3 4 5 6 and [1,2,3,4,5,6]. The programmer makes the choice.
Output a truthy value if at least one bullet survives forever and a falsy value otherwise.
Bullet speeds are given in units per second.
Bullets move simultaneously and continuously.
Bullets may collide at fractional offsets.
Multiple bullets which simultaneously reach the exact same position, whether at an integral or fractional offset from the origin, all collide with each other.

Examples
In these diagrams, G represents the gun, > the bullets, and * are times when bullets collide and explode.
Truthy
Input: 0
        0123456789
Time 0 G>
     1 G>
     2 G>
   ...

Output: 1

Input: 0 0 0
        0123456789
Time 0 G>
     1 G*
     2 G>
     3 G>
     4 G>
   ...

Output: 1

Input: 1
        0123456789
Time 0 G>
     1 G >
     2 G  >
     3 G   >
   ...

Output: 1

Input: 2 1
        0123456789
Time 0 G>
     1 G> >
     2 G >  >
     3 G  >   >
     4 G   >    >
   ...

Output: 1

Input: 2 3 1
        0123456789
Time 0 G>
     1 G> >
     2 G>  >>
     3 G >    *
     4 G  >
     5 G   >
   ...

Output: 1

Falsy
Input: 1 2 3 4 5 6
        Unit      1111111111
        01234567890123456789
Time 0 G>
     1 G>>
     2 G> *
     3 G>  >
     4 G>   > >
     5 G>    >  >>
     6 G      >   > *
     7 G            >  >
     8 G                  > >
     9 G                        >>
    10 G                              *
                  111111111122222222223
        0123456789012345678901234567890

Output: 0

Input: 1 0 0 3
        Unit
        0123456789
Time 0 G>
     1 G>>
     2 G* >
     3 G>  >
     4 G   >>
     5 G     *

(The second collision is at time 4.5)
Output: 0

Input: 2 1 2 3 6 5
        Unit      1111111111
        01234567890123456789
Time 0 G>
     1 G> >
     2 G>>  >
     3 G> *   >
     4 G>  >    >
     5 G>     *   >
     6 G     >      >
     7 G          >   >
     8 G               >>
     9 G                *
                  1111111111
        01234567890123456789

Output: 0

Input: 2 3 6
        Unit
        0123456789
Time 0 G>
     1 G> >
     2 G>  >>
     3 G      *

Output: 0

Python 2, 388 392 388 346 342 336 331 bytes

z=k=input();l=len(k);v=range;u=v(l)
while l<z:
 r="";o=[r]*l;z=l
 for h in v(l):
    if r:o[h-1]=o[m]=r;m=h;r=""
    for j in v(h+1,l):
     p=k[h];q=k[j];t=u[j];n=(1.0*q*t-p*u[h])/(q-p)if q-p else""if p>0 else t
     if t<=n<r<()>o[j]>=n<=o[h]:r=n;m=j
 i=0;s=o and min(o)
 while i<l:
    if o[i]==s!="":del k[i],o[i],u[i];l-=1
    else:i+=1
print l

My god this thing is huge, but I believe it actually does work. Once you see all the intricacies of it, this challenge is ridiculously hard.

I'm not sure if I can explain how it works in detail without typing for hours, so I'll just give an executive summary.

The big main while loop is looping until the input list does not shrink.

The nested for loop (can you believe a nested for loop is actually the shortest here?) loops over each bullet speed and uses numpy.roots to calculate calculates at which time that bullet will collide with each bullet that comes after. Here, "" is being used to mean infinity (no intersection). An extra conditional has to be included to ensure that stopped bullets are marked as colliding the moment they appear rather than at time zero.

For each number we keep track of which bullet it will hit soonest, if any, and then o is updated with the minimum collision times for the involved bullets.

After this double loop terminates, we iterate over the input list and delete any bullet that will collide at the minimum of all collision times, if any. This allows us to simultaneously delete large numbers of bullets if they all happen to collide at the same moment.

Then we repeat the entire process on the remaining bullets, since they may be able to get by now that the bullets that they would have collided with have been destroyed.

As soon as no bullets are deleted (indicated by the list not shrinking), we escape the while loop and print the length of the remaining list. Thus, this program not only prints truthy if bullets survive, it actually prints exactly the number of bullets that survive.

EDIT: Special thanks to feersum for generating test cases to help me find bugs.

EDIT 2: Saved 42 bytes by solving the linear equation by hand instead of using numpy, and splitting out the starting times into a separate list and restructuring a conditional.

EDIT 3: Saved 4 bytes by renaming range

EDIT 4: Saved 6 more bytes by replacing double spaces with tabs.
Also, feersum was kind enough to provide his implementation using fractions and sets for comparison. I've golfed it a bit and it comes out to 331 bytes, tying my solution.

EDIT 5: saved 5 bytes by removing an unnecessary initialization and rewriting a conditional


Gödel numbering of a string Background
Gödel numbers are a way of encoding any string with a unique positive integer, using prime factorisations:
First, each symbol in the alphabet is assigned a predetermined integer code.
Then, to encode a string \$ x_1 x_2 x_3 \ldots x_n \$, where each \$ x_i \$ represents an symbol's integer code, the resultant number is
$$ \prod_{i=1}^n p_i^{x_i} = 2^{x_1} \cdot 3^{x_2} \cdot 5^{x_3} \cdot \ldots \cdot p_n^{x_n} $$
where \$ p_i \$ represents the \$ i \$th prime number. By the fundamental theorem of arithmetic, this is guaranteed to produce a unique representation.
For this challenge, we will only consider strings made of the symbols Gödel originally used for his formulae and use their values, which are:

0: 1
s: 3
¬: 5
∨: 7
∀: 9
(: 11
): 13

...although for simplicity the symbols ¬, ∨, and ∀ can be replaced by the ASCII symbols ~, |, and A respectively.
(I don't know why Gödel used only odd numbers for these, but they're what he assigned so we're sticking with it)
Challenge
Given a string consisting only of the symbols above, output its Gödel encoding as an integer.
You may assume the input will consist only of character in the set 0s~|A().
Example
For the string ~s0:

start with \$ 1 \$, the multiplicative identity
the first character ~ has code \$ 5 \$; the 1st prime is \$ 2 \$, so multiply by \$ 2 ^ 5 \$; the running product is \$ 32 \$
the 2nd character s has code \$ 3 \$; the 2nd prime is \$ 3 \$, so multiply by \$ 3 ^ 3 \$; the running product is \$ 864 \$
the 3rd character 0 has code \$ 1 \$; the 3rd prime is \$ 5 \$, so multiply by \$ 5 ^ 1 \$; the running product is \$ 4320 \$
so the final answer is \$ 4320 \$

Test-cases
Input        Output
""           1
"A"          512
"~s0"        4320
"0A0"        196830
")("         1451188224
"sssss0"     160243083000
"~(~0|~s0)"  42214303957706770300186902604046689348928700000
"0s~|A()"    5816705571109335207673649552794052292778133868750

Rules

Your program does not have to work for strings that would produce larger integers than your programming language can handle, but it must work in theory
You can accept input as a string, list of characters, or list of code-points
You may use any reasonable I/O method
Standard loopholes are forbidden
This is code-golf, so the shortest code in bytes wins

JavaScript (ES7),  75  72 bytes
Expects an array of ASCII codes.
a=>a.map(g=k=>--d-1?g(k,d=n%d?d:++n):p*=n**(17088/k%75%14|1),d=p=n=1)&&p

Try it online!
Magic formula
The formula 17088/k%75%14|1 was found by injecting random values into several handcrafted templates.
More specifically, the template for this one was `${p}/k%${m0}%${m1}|1` with \$0<p<10^5\$, \$0<m_0<10^3\$ and \$12\le m_1 \le 15\$.
 char. |  k  | floor(17088 / k) | mod 75 | mod 14 | OR 1
-------+-----+------------------+--------+--------+------
  '('  |  40 |        427       |   52   |   10   |  11
  ')'  |  41 |        416       |   41   |   13   |  13
  '0'  |  48 |        356       |   56   |    0   |   1
  'A'  |  65 |        262       |   37   |    9   |   9
  's'  | 115 |        148       |   73   |    3   |   3
  '|'  | 124 |        137       |   62   |    6   |   7
  '~'  | 126 |        135       |   60   |    4   |   5

Commented
a =>                // a[] = input
a.map(g = k =>      // for each ASCII code k in a[]:
  --d - 1 ?         //   decrement d; if d is not equal to 1:
    g(              //     do a recursive call to the callback function:
      k,            //       pass k unchanged
      d =           //       update d:
        n % d ? d   //         if d is not a divisor of n, leave d unchanged
              : ++n //         otherwise, increment n and set d = n
    )               //     end of recursive call
  :                 //   else (n is now the next prime):
    p *=            //     multiply p by
      n ** (        //     n raised to the power of
        17088 / k   //     the odd positive integer <= 13 which is obtained
        % 75 % 14   //     by applying our magic formula to k
        | 1         //
      ),            //
  d = p = n = 1     //   start with d = p = n = 1
) && p              // end of map(); return p