答:
Jellyfish, 15 bytes

```<code>P"Hello, World!
</code>```

Try it online!

Not terribly interesting, but for completeness' sake...

Title: "Hello, World!"

Body:
So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of <s>Wikipedia</s> (the Wikipedia entry has been deleted but there is a copy at archive.org
), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

The Rules

Each submission must be a full program.

The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.

The program must not write anything to STDERR.

If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.

This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf - these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](https://esolangs.org/wiki/Fish), 121 bytes
</code>```

/* Configuration */

var QUESTION_ID = 55422; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery(''+lang+'').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
  text-align: left !important;
  display: block !important;
}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 500px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

Body:
Jellyfish, 15 bytes

P"Hello, World!

Try it online!

Not terribly interesting, but for completeness' sake...


问:
Find the Factorial!
Create the shortest program or function that finds the factorial of a non-negative integer.

The factorial, represented with ! is defined as such

$$n!:=\begin{cases}1 & n=0\\n\cdot(n-1)!&n>0\end{cases}$$

In plain English the factorial of 0 is 1 and the factorial of n, where n is larger than 0 is n times the factorial of one less than n.

Your code should perform input and output using a standard methods.

Requirements:

Does not use any built-in libraries that can calculate the factorial (this includes any form of eval)

Can calculate factorials for numbers up to 125

Can calculate the factorial for the number 0 (equal to 1)

Completes in under a minute for numbers up to 125

The shortest submission wins, in the case of a tie the answer with the most votes at the time wins.

答:
Neoscript, 31 bytes

```<code>{n|(0:(]:n):reduce({x y|x*y}1)}
</code>```

ContentLicense: CC BY-SA 4.0

Title: Find the Factorial!

Body:
Neoscript, 31 bytes

{n|(0:(]:n):reduce({x y|x*y}1)}

ContentLicense: CC BY-SA 3.0


问:
Permute a string using Bit-Reversal
Previously, we computed the Bit-Reversal Permutation where we found how the order of indices would be permuted. In that case, we received an input n which was the order of the permutation of the indices where the length was 2n. However, this time, we are given a string of length m = 2k for some k. Now we want to apply the permutation indices of order k to a string.

Task

Your goal is to create a function or program that given a string where the length is a power of 2, output the permutation of it using bit-reversal.

As an example, the string 'codegolf' has length 8 which is a power of 2, that is 8 = 23. We learned in the previous challenge that the bit-reversal permutation of order 3 is [0, 4, 2, 6, 1, 5, 3, 7] which means that we select the characters from the input string using that order of indices.

```<code>Input                  Output
0 1 2 3 4 5 6 7        0 4 2 6 1 5 3 7
c o d e g o l f        c g d l o o e f
</code>```

This is one possible method of solving this task. Since we do not require the order of indices as output, there may be shorter algorithms which avoid generating the indices and rely on permuting characters only.

Test Cases

```<code>Input = Output
"z" = "z"
"cg" = "cg"
"code" = "cdoe"
"golf" = "glof"
"codegolf" = "cgdlooef"
"aaaazzzz" = "azazazaz"
"LynngDaie dneers" = "Legendary Dennis"
"hieroglyphically" = "hpoaeillihglrcyy"
"Programming Puzzles N' Code-Golf" = "PliorNPGosgem zlrenda'uog  -mCzf"
"super spectacular dazzling dream" = "srenrzcrpdt sllau cg zueeaadpiam"
</code>```

Rules

This is code-golf so the shortest code wins.

Builtins are allowed.

The input string will only be in ASCII. The length of the input string will always be a power of 2.

答:
Pyth, 9 bytes

```<code>hu+M.Tc2G
</code>```

Try it online

How it works

```<code> u       Q   fixed point: let G = input, and repeatedly replace G with
      c2G      chop G into two equal pieces
    .T         justified transpose
  +M           map concatenate
             until a duplicate is found
h            take the first (only) element of the resulting list
</code>```

Title: Permute a string using Bit-Reversal

Body:
Pyth, 9 bytes

hu+M.Tc2G

Try it online

How it works

 u       Q   fixed point: let G = input, and repeatedly replace G with
      c2G      chop G into two equal pieces
    .T         justified transpose
  +M           map concatenate
             until a duplicate is found
h            take the first (only) element of the resulting list


问:
Print a 10 by 10 grid of asterisks

Background

This is a standard textbook example to demonstrate for loops.

This is one of the first programs I learnt when I started learning programming ~10 years ago.

Task

You are to print this exact text:

```<code>**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
</code>```

Specs

You may have extra trailing newlines.

You may have extra trailing spaces (U+0020) at the end of each line, including the extra trailing newlines.

Scoring

This is code-golf. Shortest answer in bytes wins.

Title: Print a 10 by 10 grid of asterisks

Body:
Neoscript, 39 bytes

each _=0:[]:9console:log("**********");


问:
Ode-cay Olf-gay
Write a program which accepts a sentence into stdin, and writes that sentence to stdout in pig latin.

Here are some test cases which your program should handle:

```<code>Input:
    Read your script
Output:
    ead-Ray our-yay ipt-scray
</code>```

Hyphenation is mandatory. Note that multiple consonants at the start of the word must all be moved to the end. Capitalization of the output does not matter; Ead-ray or ead-ray are also valid translations of Read

```<code>Input:
    An utterance is allowed an opening vowel
Output:
    An-way utterance-way is-way allowed-way an-way opening-way owel-vay
</code>```

Words starting with vowels have -way appended in their pig latin form (don't forget to handle capital opening vowels)

```<code>Input:
    sky
    -skyay
</code>```

Words consisting entirely of consonants should have a hyphen prepended, and ay appended

Punctuation is undefined; I don't care if leading or trailing punctuation ends up inside the pig latin word.

This is code golf; the shortest program by character count wins. I've written a solution myself which handles all these cases which I shall post as a response.

Title: Ode-cay Olf-gay

Body:
Perl (53)

s/(.*?)([aeiou].*)/$1||=w;print"$2-$1ay "/iefor split


问:
Can you outgolf me? (Cops section)

Cops section

The robbers section can be found here.

Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions.

Challenge

Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (e.g. Python 3.5 ≠ Python 3.4, so that is not allowed), and when given n (using STDIN/function arguments/etc.), compute a(n) where a is an OEIS sequence of your choice. One of those programs is shorter than the other. You only need to submit the longer program of the two. The other one needs to be saved in case of not being cracked after 7 days. Your submission is cracked when your program has been outgolfed (whether it is by 1 byte or more).

For example, if the task you chose was to perform 2 × n, this could be a valid submission (in Python 2):

Python 2, 16 bytes, score = 15 / 16 = 0.9375

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

If your submission has been cracked, then you need to state that in your header like so:

Python 2, 16 bytes, score = 15 / 16 = 0.9375, [cracked] + link

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

Offset

This can be found on every OEIS page. For example, for A005843, the offset is 0,2. We only need to use the first one, which is 0. This means that the function is defined for all numbers ≥ 0.

In other words, the function OEIS(n) starts with n = 0. Your program needs to work for all cases given by OEIS.

More information can be found here.

Scoring

The score you get for your submission is equal to the following formula:

Score = Length (in bytes) of secret code ÷ Length (in bytes) of public code

The example above has the score 15 ÷ 16 = 0.9375.

The submission with the lowest score wins. Only submissions that have posted their solution will be eligible for winning.

Rules

The task you need to do is an OEIS sequence of your choice.

Given n, output OEIS(n). Deviation is not allowed, so you need to produce the exact same sequence (when given n, you need to output OEIS(n)).

Submissions that are not cracked within a period of 7 days are considered safe after the solution has been posted (submissions older than 7 days that do not have their solution posted are still vulnerable in being cracked).

In your submission, you need to post the following things: language name, byte count, full code, so no pastebin links etc. (to prevent answers like Unary), OEIS sequence, score with lengths of both programs and additionally, the encoding that is used.

Note: the same sequence cannot be posted twice in the same language. (For example, if the sequence A005843 has been done in Pyth, you cannot use Pyth again for that same sequence.)

Input and output are both in decimal (base 10)

Leaderboard

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/Sites/codegolf/all.css?v=7509797c03ea">

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Note

This challenge is finished. The final winner is feersum with his Seed answer. Congratulations! :).

You can still submit new cops, but be aware that they are no longer competing.

答:
Java 7, 53 bytes, score = 0.9623 (51/53) Cracked

```<code>int f(int n){return n<1?3:n<2?0:n<3?2:f(n-2)+f(n-3);}
</code>```

Computes the Perrin sequence, A001608

```<code>f(0)=3
f(1)=0
f(2)=2
f(n)=f(n-2)+f(n-3)
</code>```

First code golf attempt, feel free to point out any mistakes.

Explanation after cracking:

miles shortened the first three values (0,1,2) -> (3,0,2) to

```<code>n<2?3-3*n:n<3?2
</code>```

while my own solution was a slightly over-engineered

```<code>n<3?(n+4)%5*2%5
</code>```

Combining the two tricks, you get

```<code>n<3?3-3*n%5
</code>```

for a 47-byte

```<code>int k(int n){return n<3?3-3*n%5:f(n-2)+f(n-3);}
</code>```

which looks pretty compact for Java :)

Title: Can you outgolf me? (Cops section)

Body:
Java 7, 53 bytes, score = 0.9623 (51/53) Cracked

int f(int n){return n<1?3:n<2?0:n<3?2:f(n-2)+f(n-3);}

Computes the Perrin sequence, A001608

f(0)=3
f(1)=0
f(2)=2
f(n)=f(n-2)+f(n-3)

First code golf attempt, feel free to point out any mistakes.

Explanation after cracking:

miles shortened the first three values (0,1,2) -> (3,0,2) to

n<2?3-3*n:n<3?2

while my own solution was a slightly over-engineered

n<3?(n+4)%5*2%5

Combining the two tricks, you get

n<3?3-3*n%5

for a 47-byte

int k(int n){return n<3?3-3*n%5:f(n-2)+f(n-3);}

which looks pretty compact for Java :)


问:
A square of text

The Challenge

Given a string, output the text in the shape of a square.

You can assume that the text will always fit in a square, and that it will never be an empty string.

You can also assume it will never have newlines.

Example

```<code>Input:
Hi, world

Output:
Hi,
 wo
rld
</code>```

Test Cases

```<code>Input:
Hi, world! Hello

Output:
Hi,
worl
d! H
ello

Input:
Lorem ipsum dolor sit amt

Output:
Lorem
 ipsu
m dol
or si
t amt

Input:
H

Output:
H
</code>```

Rules

This is code-golf, so shortest answer in bytes wins! Tiebreaker is most upvoted answer.

Standard loopholes are forbidden.

答:
C, 64 bytes

```<code>f(s,m,k){for(m=k=sqrt(strlen(s));k--;s+=m)printf("%.*s\n",m,s);}
</code>```

Inspired by the other C answer.
Only works on platforms where int has the same size as char* (e.g. 32-bit Windows).

Title: A square of text

Body:
C, 64 bytes

f(s,m,k){for(m=k=sqrt(strlen(s));k--;s+=m)printf("%.*s\n",m,s);}

Inspired by the other C answer.
Only works on platforms where int has the same size as char* (e.g. 32-bit Windows).


答:
Scheme, 51 Bytes

```<code>(map (lambda (n)(display "**********\n"))(iota 10))
</code>```

Title: Print a 10 by 10 grid of asterisks

Body:
Background

This is a standard textbook example to demonstrate for loops.

This is one of the first programs I learnt when I started learning programming ~10 years ago.

Task

You are to print this exact text:

```<code>**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
</code>```

Specs

You may have extra trailing newlines.

You may have extra trailing spaces (U+0020) at the end of each line, including the extra trailing newlines.

Scoring

This is code-golf. Shortest answer in bytes wins.

Body:
Scheme, 51 Bytes

(map (lambda (n)(display "**********\n"))(iota 10))


问:
Can you outgolf me? (Robbers section)

Robbers section

The cops section can be found here.

Challenge

Your task is to outgolf the submissions of the cops in the same language and the same version (for example, Python 3.5 ≠ Python 3.4, so that is not allowed). A submission is outgolfed when the length in bytes is shorter than the original submission. You only need to golf off at least 1 byte in order to crack a submission. E.g. if the task was to perform 2 × n, and the submission was the following:

```<code>print(2*input())
</code>```

You could outgolf the cop by doing the following:

```<code>print 2*input()
</code>```

Or even this (since lambda's are allowed):

```<code>lambda x:2*x
</code>```

Post this with the following header:

```<code>##{language name}, <s>{prev byte count}</s> {byte count}, {cop's submission + link}
</code>```

For example:

Python 2, <s>16</s> 12 bytes, Adnan (+ link to submission)

```<code>lambda x:2*x
</code>```

Computes A005843, (offset = 0).

In that case, you have cracked the submission.

Scoring

The person with who cracked the most submissions is the winner.

Rules

The crack submission must be in the same language as the cop submission.

The same input should result into the same output (so a(2) = 4 should remain 4).

For languages such as Python, you can import libraries that are standard included within the language. (So, no numpy/sympy etc.)

Input and output are both in decimal (base 10).

Note

This challenge is finished. The winner of the Robbers section is feersum. The final scores for the CnR are shown below:

feersum: 16 cracks

Dennis: 12 cracks

Leaky Nun: 6 cracks

Lynn: 4 cracks

miles: 3 cracks

Martin Ender: 2 cracks

Emigna: 2 cracks

jimmy23013: 1 crack

Sp3000: 1 crack

randomra: 1 crack

alephalpha: 1 crack

nimi: 1 crack

Destructible Watermelon: 1 crack

Dom Hastings: 1 crack

答:
Java, <s>53</s> 51 bytes, JollyJoker

```<code>int f(int n){return n<2?3-3*n:n<3?2:f(n-2)+f(n-3);}
</code>```

Combines the first two if statements into 3-3*n for n less than 2.

Title: Can you outgolf me? (Robbers section)

Body:
Java, <s>53</s> 51 bytes, JollyJoker

int f(int n){return n<2?3-3*n:n<3?2:f(n-2)+f(n-3);}

Combines the first two if statements into 3-3*n for n less than 2.


问:
A Formula for Congruences
The Chinese Remainder Theorem can be quite useful in modular arithmetic.

For example, consider the following set of congruence relations:

For sets of congruence relations like this, where all the bases (3, 5, 7 in this example) are co-prime with each other, there will be one and only one integer n between 1 and the product of the bases (3*5*7 = 105 in this example) inclusive that satisfies the relations.

In this example, the number would be 14, generated by this formula:

where 2, 4, and 0 are given from the above example.

70, 21, 15 are the coefficients of the formula and they are dependent on the bases, 3, 5, 7.

To calculate the coefficients of the formula (70, 21, 15 in our example) for a set of bases, we use the following procedure.

For each number a in a set of bases:

Find the product of all of the other bases, denoted as P.

Find the first multiple of P that leaves a remainder of 1 when divided by a. This is the coefficient of a.

For example, to calculate the coefficient that corresponds to the base 3, we find the product of all the other bases (i.e. 5*7 = 35) and then find the first multiple of that product that leaves a remainder of 1 when divided by the base.

In this case, 35 leaves a remainder of 2 when divided by 3, but 35*2 = 70 leaves a remainder of 1 when divided by 3, so 70 is the corresponding coefficient for 3. Similarly, 3*7 = 21 leaves a remainder of 1 when divided by 5 and 3*5 = 15 leaves a remainder of 1 when divided by 7.

In a nutshell

For each number a in a set of numbers:

Find the product of all of the other numbers, denoted as P.

Find the first multiple of P that leaves a remainder of 1 when divided by a. This is the coefficient of a.

The challenge

The challenge is, for a set of two or more bases, to find the set of corresponding coefficients.

The set of bases are guaranteed to be pairwise co-prime and each base is guaranteed to be larger than 1.

Your input is a list of integers as input [3,4,5] or space-separated string "3 4 5" or however your inputs work.

Your output should either be a list of integers or space-separated string that denotes the set of coefficients.

Test cases

```<code>input             output
[3,5,7]           [70,21,15]
[2,3,5]           [15,10,6]
[3,4,5]           [40,45,36]
[3,4]             [4,9]
[2,3,5,7]         [105,70,126,120]
[40,27,11]        [9801,7480,6480]
[100,27,31]       [61101,49600,56700]
[16,27,25,49,11]  [363825,2371600,2794176,5583600,529200]
</code>```

Many thanks to Leaky Nun for his help in writing this challenge. As always, if the problem is unclear, please let me know. Good luck and good golfing!

Title: A Formula for Congruences

Body:
Cheddar, 64 bytes

n->n.map(i->(|>i).map(j->(k->k%i>1?0:k)(n.reduce((*))/i*j)).sum)


答:
Retina, <s>28</s> 27 bytes, Martin Ender

```<code>.+
$*
((^.?|\3)(^|\1)){99}$
</code>```

Where it says {99} I wanted to use +, but that mysteriously causes the match to fail.

The regex matches strings which have a length that is a sum of a prefix of the Fibonacci numbers. The main group matches lengths starting with 1, 2, 3, ..., which skips one of the initial 1s, so I tried to improve it by getting it to match length 1 twice at the beginning, so that it was not necessary to have a special case.

Title: Can you outgolf me? (Robbers section)

Body:
Robbers section

The cops section can be found here.

Challenge

Your task is to outgolf the submissions of the cops in the same language and the same version (for example, Python 3.5 ≠ Python 3.4, so that is not allowed). A submission is outgolfed when the length in bytes is shorter than the original submission. You only need to golf off at least 1 byte in order to crack a submission. E.g. if the task was to perform 2 × n, and the submission was the following:

```<code>print(2*input())
</code>```

You could outgolf the cop by doing the following:

```<code>print 2*input()
</code>```

Or even this (since lambda's are allowed):

```<code>lambda x:2*x
</code>```

Post this with the following header:

```<code>##{language name}, <s>{prev byte count}</s> {byte count}, {cop's submission + link}
</code>```

For example:

Python 2, <s>16</s> 12 bytes, Adnan (+ link to submission)

```<code>lambda x:2*x
</code>```

Computes A005843, (offset = 0).

In that case, you have cracked the submission.

Scoring

The person with who cracked the most submissions is the winner.

Rules

The crack submission must be in the same language as the cop submission.

The same input should result into the same output (so a(2) = 4 should remain 4).

For languages such as Python, you can import libraries that are standard included within the language. (So, no numpy/sympy etc.)

Input and output are both in decimal (base 10).

Note

This challenge is finished. The winner of the Robbers section is feersum. The final scores for the CnR are shown below:

feersum: 16 cracks

Dennis: 12 cracks

Leaky Nun: 6 cracks

Lynn: 4 cracks

miles: 3 cracks

Martin Ender: 2 cracks

Emigna: 2 cracks

jimmy23013: 1 crack

Sp3000: 1 crack

randomra: 1 crack

alephalpha: 1 crack

nimi: 1 crack

Destructible Watermelon: 1 crack

Dom Hastings: 1 crack

Body:
Retina, <s>28</s> 27 bytes, Martin Ender

.+
$*
((^.?|\3)(^|\1)){99}$

Where it says {99} I wanted to use +, but that mysteriously causes the match to fail.

The regex matches strings which have a length that is a sum of a prefix of the Fibonacci numbers. The main group matches lengths starting with 1, 2, 3, ..., which skips one of the initial 1s, so I tried to improve it by getting it to match length 1 twice at the beginning, so that it was not necessary to have a special case.


问:
Print the Capitals without the Capitals
Whoa, whoa, whoa ... stop typing your program. No, I don't mean "print ABC...." I'm talking the capitals of the United States.

Specifically, print all the city/state combinations given in the following list

in any order

with your choice of delimiters (e.g., Baton Rouge`LA_Indianapolis`IN_... is acceptable), so long as it's unambiguous which words are cities, which are states, and which are different entries

without using any of ABCDEFGHIJKLMNOPQRSTUVWXYZ in your source code

Output should be to STDOUT or equivalent.

EDIT - Whoops!

<edit>

While typing up the list from memory (thanks to the Animaniacs, as described below), I apparently neglected Washington, DC, which isn't a state capital, but is in the song, and is sometimes included in "lists of capitals" (like the Mathematica answer below). I had intended to include that city in this list, but missed it, somehow. As a result, answers that don't have that city won't be penalized, and answers that do have that city won't be penalized, either. Essentially, it's up to you whether Washington, DC is included in your ouput or not. Sorry about that, folks!

</edit>

```<code>Baton Rouge, LA
Indianapolis, IN
Columbus, OH
Montgomery, AL
Helena, MT
Denver, CO
Boise, ID
Austin, TX
Boston, MA
Albany, NY
Tallahassee, FL
Santa Fe, NM
Nashville, TN
Trenton, NJ
Jefferson, MO
Richmond, VA
Pierre, SD
Harrisburg, PA
Augusta, ME
Providence, RI
Dover, DE
Concord, NH
Montpelier, VT
Hartford, CT
Topeka, KS
Saint Paul, MN
Juneau, AK
Lincoln, NE
Raleigh, NC
Madison, WI
Olympia, WA
Phoenix, AZ
Lansing, MI
Honolulu, HI
Jackson, MS
Springfield, IL
Columbia, SC
Annapolis, MD
Cheyenne, WY
Salt Lake City, UT
Atlanta, GA
Bismarck, ND
Frankfort, KY
Salem, OR
Little Rock, AR
Des Moines, IA
Sacramento, CA
Oklahoma City, OK
Charleston, WV
Carson City, NV
</code>```

(h/t to Animaniacs for the list of capitals)

Take a bonus of -20% if your submission doesn't explicitly have the numbers 65 through 90 or the number 1 in the code. Generating these numbers (e.g., a=5*13 or a="123"[0] or a=64;a++ or the like) is allowed under this bonus, explicitly having them (e.g., a=65 or a="1 23 456"[0]) is not.

Leaderboard

var QUESTION_ID=60650,OVERRIDE_USER=42963;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"http://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+(?:[.]\d+)?)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
PowerShell, <s>1038</s> <s>976</s> <s>925</s> <s>904</s> <s>813</s> <s>768</s> <s>758</s> <s>749</s> 745 -20% = 596

```<code>"labaton rouge;inindianapolis;ohcolumbus;almontgomery;mthelena;codenver;idboise;txaustin;maboston;nyalbany;fltallahassee;nmsanta fe;tnnashville;njtrenton;mojefferson;varichmond;sdpierre;paharrisburg;meaugusta;riprovidence;dedover;nhconcord;vtmontpelier;cthartford;kstopeka;mnsaint paul;akjuneau;nelincoln;ncraleigh;wimadison;waolympia;azphoenix;milansing;hihonolulu;msjackson;ilspringfield;sccolumbia;mdannapolis;wycheyenne;utsalt lake city;gaatlanta;ndbismarck;kyfrankfort;orsalem;arlittle rock;iades moines;casacramento;okoklahoma city;wvcharleston;nvcarson city"-split";"|%{$a=-split$_;$b={$n,$i=$args;if($a[$n]){" "+(""+$a[$n][$i++]).toupper()+$a[$n].substring($i)}};$(&$b(0)2).trim()+$(&$b(3-2)0)+$(&$b(2)0)+","+$_.substring(0,2).toupper()}
</code>```

Ungolfed:

```<code>"labaton rouge;inindianapolis;ohcolumbus;almontgomery;mthelena;codenver;idboise;txaustin;maboston;nyalbany;fltallahassee;nmsanta fe;tnnashville;njtrenton;mojefferson;varichmond;sdpierre;paharrisburg;meaugusta;riprovidence;dedover;nhconcord;vtmontpelier;cthartford;kstopeka;mnsaint paul;akjuneau;nelincoln;ncraleigh;wimadison;waolympia;azphoenix;milansing;hihonolulu;msjackson;ilspringfield;sccolumbia;mdannapolis;wycheyenne;utsalt lake city;gaatlanta;ndbismarck;kyfrankfort;orsalem;arlittle rock;iades moines;casacramento;okoklahoma city;wvcharleston;nvcarson city"-split";"|%{
   $a=-split$_;
   $b={
        $n,$i=$args;
        if($a[$n]){
          " "+
          (""+$a[$n][$i++]).toupper()+
          $a[$n].substring($i)
         }
      };
   $(&$b(0)2).trim()+
   $(&$b(3-2)0)+
   $(&$b(2)0)+
   ","+
   $_.substring(0,2).toupper()
 }
</code>```

Title: Print the Capitals without the Capitals

Body:
PowerShell, <s>1038</s> <s>976</s> <s>925</s> <s>904</s> <s>813</s> <s>768</s> <s>758</s> <s>749</s> 745 -20% = 596

"labaton rouge;inindianapolis;ohcolumbus;almontgomery;mthelena;codenver;idboise;txaustin;maboston;nyalbany;fltallahassee;nmsanta fe;tnnashville;njtrenton;mojefferson;varichmond;sdpierre;paharrisburg;meaugusta;riprovidence;dedover;nhconcord;vtmontpelier;cthartford;kstopeka;mnsaint paul;akjuneau;nelincoln;ncraleigh;wimadison;waolympia;azphoenix;milansing;hihonolulu;msjackson;ilspringfield;sccolumbia;mdannapolis;wycheyenne;utsalt lake city;gaatlanta;ndbismarck;kyfrankfort;orsalem;arlittle rock;iades moines;casacramento;okoklahoma city;wvcharleston;nvcarson city"-split";"|%{$a=-split$_;$b={$n,$i=$args;if($a[$n]){" "+(""+$a[$n][$i++]).toupper()+$a[$n].substring($i)}};$(&$b(0)2).trim()+$(&$b(3-2)0)+$(&$b(2)0)+","+$_.substring(0,2).toupper()}

Ungolfed:

"labaton rouge;inindianapolis;ohcolumbus;almontgomery;mthelena;codenver;idboise;txaustin;maboston;nyalbany;fltallahassee;nmsanta fe;tnnashville;njtrenton;mojefferson;varichmond;sdpierre;paharrisburg;meaugusta;riprovidence;dedover;nhconcord;vtmontpelier;cthartford;kstopeka;mnsaint paul;akjuneau;nelincoln;ncraleigh;wimadison;waolympia;azphoenix;milansing;hihonolulu;msjackson;ilspringfield;sccolumbia;mdannapolis;wycheyenne;utsalt lake city;gaatlanta;ndbismarck;kyfrankfort;orsalem;arlittle rock;iades moines;casacramento;okoklahoma city;wvcharleston;nvcarson city"-split";"|%{
   $a=-split$_;
   $b={
        $n,$i=$args;
        if($a[$n]){
          " "+
          (""+$a[$n][$i++]).toupper()+
          $a[$n].substring($i)
         }
      };
   $(&$b(0)2).trim()+
   $(&$b(3-2)0)+
   $(&$b(2)0)+
   ","+
   $_.substring(0,2).toupper()
 }


答:
Jelly, 5 bytes, score 0.8 (4 / 5) [cracked!]

```<code>R²SÆ½
</code>```

Computes A127721.

Try it online!

Here's the solution:

```<code>RÆḊḞ
</code>```

implicitly take input n

R: list from [1, 2, ..., n]

ÆḊ: In our case, this will actually return the square root of the sum of squares (which may be useful in future golfing)!

Ḟ: floor the result.

The documentation for ÆḊ reads:

ÆḊ: Determinant, extended to non-square matrices.

The key is extended to non-square matrices. The "determinant" of a non-square matrix is usually undefined, but one reasonable definition is sqrt(det(A A^T)) (which for a square matrix reduces to |det(A)|). In our case, A A^T is a 1 x 1 matrix containing the sum of squares. The square root of the determinant of that gives us exactly what we need to shave off the last byte!

Title: Can you outgolf me? (Cops section)

Body:
Cops section

The robbers section can be found here.

Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions.

Challenge

Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (e.g. Python 3.5 ≠ Python 3.4, so that is not allowed), and when given n (using STDIN/function arguments/etc.), compute a(n) where a is an OEIS sequence of your choice. One of those programs is shorter than the other. You only need to submit the longer program of the two. The other one needs to be saved in case of not being cracked after 7 days. Your submission is cracked when your program has been outgolfed (whether it is by 1 byte or more).

For example, if the task you chose was to perform 2 × n, this could be a valid submission (in Python 2):

Python 2, 16 bytes, score = 15 / 16 = 0.9375

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

If your submission has been cracked, then you need to state that in your header like so:

Python 2, 16 bytes, score = 15 / 16 = 0.9375, [cracked] + link

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

Offset

This can be found on every OEIS page. For example, for A005843, the offset is 0,2. We only need to use the first one, which is 0. This means that the function is defined for all numbers ≥ 0.

In other words, the function OEIS(n) starts with n = 0. Your program needs to work for all cases given by OEIS.

More information can be found here.

Scoring

The score you get for your submission is equal to the following formula:

Score = Length (in bytes) of secret code ÷ Length (in bytes) of public code

The example above has the score 15 ÷ 16 = 0.9375.

The submission with the lowest score wins. Only submissions that have posted their solution will be eligible for winning.

Rules

The task you need to do is an OEIS sequence of your choice.

Given n, output OEIS(n). Deviation is not allowed, so you need to produce the exact same sequence (when given n, you need to output OEIS(n)).

Submissions that are not cracked within a period of 7 days are considered safe after the solution has been posted (submissions older than 7 days that do not have their solution posted are still vulnerable in being cracked).

In your submission, you need to post the following things: language name, byte count, full code, so no pastebin links etc. (to prevent answers like Unary), OEIS sequence, score with lengths of both programs and additionally, the encoding that is used.

Note: the same sequence cannot be posted twice in the same language. (For example, if the sequence A005843 has been done in Pyth, you cannot use Pyth again for that same sequence.)

Input and output are both in decimal (base 10)

Leaderboard

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/Sites/codegolf/all.css?v=7509797c03ea">

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Note

This challenge is finished. The final winner is feersum with his Seed answer. Congratulations! :).

You can still submit new cops, but be aware that they are no longer competing.

Body:
Jelly, 5 bytes, score 0.8 (4 / 5) [cracked!]

R²SÆ½

Computes A127721.

Try it online!

Here's the solution:

RÆḊḞ

implicitly take input n

R: list from [1, 2, ..., n]

ÆḊ: In our case, this will actually return the square root of the sum of squares (which may be useful in future golfing)!

Ḟ: floor the result.

The documentation for ÆḊ reads:

ÆḊ: Determinant, extended to non-square matrices.

The key is extended to non-square matrices. The "determinant" of a non-square matrix is usually undefined, but one reasonable definition is sqrt(det(A A^T)) (which for a square matrix reduces to |det(A)|). In our case, A A^T is a 1 x 1 matrix containing the sum of squares. The square root of the determinant of that gives us exactly what we need to shave off the last byte!


问:
Write a VIC cipher encoder
The VIC cipher is one of the most complicated pencil and paper ciphers ever devised. Used in the 1950s by Soviet spy Reino Häyhänen, codenamed "VICTOR", its main principle is security through obfuscation; a lot of obfuscation.

Your task is to write a program or function that will take a message and encode it using the VIC cipher. I have also posted a VIC cipher decoder challenge here. If any of the following instructions are unclear, don't hesitate to ask about them in the comments. The instructions are adapted from this site.

Encoding the VIC cipher

Preparation

You will need five inputs:

the plaintext message

a short keyword or phrase containing the most common letters in your language

a key phrase, such as a quote or a line from a song (at least 20 characters)

a date (or another number that is six digits or more)

a personal agent number

In practice, these last four should be agreed upon beforehand by the sender and the recipient, including whether the agent number of the sender or the recipient is used in encoding.

My example message will be: We are discovered. Take what you can. Burn everything else. Move to Safehouse Foxtrot 3.

We'll be encoding in English (though you may use whatever language and alphabet you prefer) and the most common letters in the English alphabet are A, E, I, N, O, R, S, T. I'll use the keyword SENATORI.

My key phrase is a quote by Richard Feynman: "The first principle is that you must not fool yourself — and you are the easiest person to fool."

As a date, I'll use July 31, 2016 (in the format 3172016), which is the day it was when I wrote this description.

The personal number I have chosen for myself is 9.

Summary of steps

Derive the intermediate keys for use in the following steps.

Construct and apply the straddling checkerboard.

Construct and apply the first transposition table.

Construct and apply the second (disrupted) transposition table.

Finalize the message by inserting the message indicator group.

Submechanisms

Two more things to explain before we get into the meat of the matter: the processes of chain addition and sequentializing.

Chain addition, also known as a lagged Fibonacci generator, works by taking a starting digit sequence, adding the first two digits without carrying (add them together then mod 10) and appending the result to the end. For example:

```<code>79081
7 + 9 = 6

790816
9 + 0 = 9

7908169
0 + 8 = 8

79081698
8 + 1 = 9

790816989
1 + 6 = 7

7908169897
... and so on
</code>```

Sequentializing is essentially taking a sequence of letters or digits and labeling them by their alphabetical/numerical order. Duplicates are labelled left to right. For example:

```<code>E X A M P L E
    0           # A
1   0       2   # Es
1   0     3 2   # L
1   0 4   3 2   # M
1   0 4 5 3 2   # P
1 6 0 4 5 3 2   # X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      0              1                     # 0s
      0              1                 2   # 1
      0           3  1                 2   # 2
4  5  0           3  1                 2   # 3s
4  5  0        6  3  1  7        8     2   # 4s
4  5  0  9     6  3  1  7    10  8     2   # 5s
4  5  0  9     6  3  1  7 11 10  8     2   # 7
4  5  0  9 12  6  3  1  7 11 10  8 13  2   # 8s
</code>```

I use zero-indexing here, but index however you like.

1. Intermediate Keys

Split the first 20 letters of the key phrase into two groups of 10 and sequentialize each individually, which we will call S1 and S2.

```<code>    THEFIRSTPR
S1: 8201357946

    INCIPLEIST
S2: 2603751489
</code>```

Choose a random 5-digit message identifier, M (this can be one of the inputs if you prefer):

```<code>M = 47921
</code>```

Subtract, without borrowing (subtract mod 10), the first five digits of the key date 3172016 from M:

```<code>M      47921
date - 31720
     = 16201
</code>```

Chain add the result until you have ten digits:

```<code>1620178218
</code>```

Add these digits to S1, without carrying or mod 10, to obtain G:

```<code>     1620178218
S1 + 8201357946
G  = 9821425154
</code>```

Above S2, write the sequence 0123456789. Locate each digit of G in the sequence 0123456789 and replace it with the digit directly below it in S2. The result is T.

```<code>   0123456789
S2 2603751489

G  9821425154
T  9806705657
</code>```

Use chain addition to expand T to 60 digits.

```<code>9806705657

becomes

980670565778637511245490262369939288595822106344304316978734
</code>```

These last 50 digits, in five rows of ten digits each, form the U block.

```<code>T  9806705657
U  7863751124
   5490262369
   9392885958
   2210634430
   4316978734
</code>```

The last two non-equal digits of the U block are individually added to the agent's personal number to give the widths of the two transpositions, p and q.

9 + 3 = 12  (p, first transposition width)
9 + 4 = 13  (q, second transposition width)

Sequentialize T and use this sequence to copy off the columns of the U block, from top to bottom, into a new row of digits, V.

```<code>E X A M P L E
    0           # A
1   0       2   # Es
1   0     3 2   # L
1   0 4   3 2   # M
1   0 4 5 3 2   # P
1 6 0 4 5 3 2   # X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      0              1                     # 0s
      0              1                 2   # 1
      0           3  1                 2   # 2
4  5  0           3  1                 2   # 3s
4  5  0        6  3  1  7        8     2   # 4s
4  5  0  9     6  3  1  7    10  8     2   # 5s
4  5  0  9     6  3  1  7 11 10  8     2   # 7
4  5  0  9 12  6  3  1  7 11 10  8 13  2   # 8s
</code>```0

Sequentialize the first p digits to get the key for the first transposition K1, and the following q digits for the key for the second K2.

```<code>E X A M P L E
    0           # A
1   0       2   # Es
1   0     3 2   # L
1   0 4   3 2   # M
1   0 4 5 3 2   # P
1 6 0 4 5 3 2   # X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      0              1                     # 0s
      0              1                 2   # 1
      0           3  1                 2   # 2
4  5  0           3  1                 2   # 3s
4  5  0        6  3  1  7        8     2   # 4s
4  5  0  9     6  3  1  7    10  8     2   # 5s
4  5  0  9     6  3  1  7 11 10  8     2   # 7
4  5  0  9 12  6  3  1  7 11 10  8 13  2   # 8s
</code>```1

Finally, sequentialize the final row of the U block to get C, the column headers for the straddling checkerboard:

```<code>E X A M P L E
    0           # A
1   0       2   # Es
1   0     3 2   # L
1   0 4   3 2   # M
1   0 4 5 3 2   # P
1 6 0 4 5 3 2   # X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      0              1                     # 0s
      0              1                 2   # 1
      0           3  1                 2   # 2
4  5  0           3  1                 2   # 3s
4  5  0        6  3  1  7        8     2   # 4s
4  5  0  9     6  3  1  7    10  8     2   # 5s
4  5  0  9     6  3  1  7 11 10  8     2   # 7
4  5  0  9 12  6  3  1  7 11 10  8 13  2   # 8s
</code>```2

2. Straddling Checkerboard

First, I will give my example checkerboard then explain the principles in creating it in that way:

```<code>E X A M P L E
    0           # A
1   0       2   # Es
1   0     3 2   # L
1   0 4   3 2   # M
1   0 4 5 3 2   # P
1 6 0 4 5 3 2   # X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      0              1                     # 0s
      0              1                 2   # 1
      0           3  1                 2   # 2
4  5  0           3  1                 2   # 3s
4  5  0        6  3  1  7        8     2   # 4s
4  5  0  9     6  3  1  7    10  8     2   # 5s
4  5  0  9     6  3  1  7 11 10  8     2   # 7
4  5  0  9 12  6  3  1  7 11 10  8 13  2   # 8s
</code>```3

The first line of letters is our short keyword SENATORI. Your keyword can be any string without duplicates, but since it defines the top row of your checkerboard, choose wisely. Above the keyword is C, and the other rows are the rest of your alphabet in whatever order you choose. In my case, I filled the checkerboard with the rest of the Latin alphabet, a punctuation mark . and a mark for demarcating numbers #. Essentially, the checkerboard is a fancy substitution cipher. For example, "E" will be substituted with 1, and "W" will be substituted with 27.

Once we have encoded our plaintext message with this checkerboard, but first, we need to make the beginning of our message less obvious by splitting it at a random position, and making it all uppercase. To denote the other original beginning, we use two full stops ..

```<code>E X A M P L E
    0           # A
1   0       2   # Es
1   0     3 2   # L
1   0 4   3 2   # M
1   0 4 5 3 2   # P
1 6 0 4 5 3 2   # X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      0              1                     # 0s
      0              1                 2   # 1
      0           3  1                 2   # 2
4  5  0           3  1                 2   # 3s
4  5  0        6  3  1  7        8     2   # 4s
4  5  0  9     6  3  1  7    10  8     2   # 5s
4  5  0  9     6  3  1  7 11 10  8     2   # 7
4  5  0  9 12  6  3  1  7 11 10  8 13  2   # 8s
</code>```4

becomes

```<code>E X A M P L E
    0           # A
1   0       2   # Es
1   0     3 2   # L
1   0 4   3 2   # M
1   0 4 5 3 2   # P
1 6 0 4 5 3 2   # X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      0              1                     # 0s
      0              1                 2   # 1
      0           3  1                 2   # 2
4  5  0           3  1                 2   # 3s
4  5  0        6  3  1  7        8     2   # 4s
4  5  0  9     6  3  1  7    10  8     2   # 5s
4  5  0  9     6  3  1  7 11 10  8     2   # 7
4  5  0  9 12  6  3  1  7 11 10  8 13  2   # 8s
</code>```5

We encode with the checkerboard, giving us:

```<code>E X A M P L E
    0           # A
1   0       2   # Es
1   0     3 2   # L
1   0 4   3 2   # M
1   0 4 5 3 2   # P
1 6 0 4 5 3 2   # X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      0              1                     # 0s
      0              1                 2   # 1
      0           3  1                 2   # 2
4  5  0           3  1                 2   # 3s
4  5  0        6  3  1  7        8     2   # 4s
4  5  0  9     6  3  1  7    10  8     2   # 5s
4  5  0  9     6  3  1  7 11 10  8     2   # 7
4  5  0  9 12  6  3  1  7 11 10  8 13  2   # 8s
</code>```6

If the length of the message isn't divisible by 5, we add some null characters to pad out the message. Our message is 109 digits long, so I will add one null: "4".

```<code>E X A M P L E
    0           # A
1   0       2   # Es
1   0     3 2   # L
1   0 4   3 2   # M
1   0 4 5 3 2   # P
1 6 0 4 5 3 2   # X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      0              1                     # 0s
      0              1                 2   # 1
      0           3  1                 2   # 2
4  5  0           3  1                 2   # 3s
4  5  0        6  3  1  7        8     2   # 4s
4  5  0  9     6  3  1  7    10  8     2   # 5s
4  5  0  9     6  3  1  7 11 10  8     2   # 7
4  5  0  9 12  6  3  1  7 11 10  8 13  2   # 8s
</code>```7

Note: Since my example message does not contain numbers, I'll say here that you might designate, say, as #3#, which is encoded as 44344 here.

3. First Transposition

Create the transposition table by writing K1 (from the Intermediate Keys section) followed by the encoded message from the previous step, in rows of the same length, below the key:

```<code>E X A M P L E
    0           # A
1   0       2   # Es
1   0     3 2   # L
1   0 4   3 2   # M
1   0 4 5 3 2   # P
1 6 0 4 5 3 2   # X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      0              1                     # 0s
      0              1                 2   # 1
      0           3  1                 2   # 2
4  5  0           3  1                 2   # 3s
4  5  0        6  3  1  7        8     2   # 4s
4  5  0  9     6  3  1  7    10  8     2   # 5s
4  5  0  9     6  3  1  7 11 10  8     2   # 7
4  5  0  9 12  6  3  1  7 11 10  8 13  2   # 8s
</code>```8

Taking the numbered columns in order of their numbers we get:

```<code>E X A M P L E
    0           # A
1   0       2   # Es
1   0     3 2   # L
1   0 4   3 2   # M
1   0 4 5 3 2   # P
1 6 0 4 5 3 2   # X

3  3  0  5  8  4  2  0  4  7  5  4  8  1
      0              1                     # 0s
      0              1                 2   # 1
      0           3  1                 2   # 2
4  5  0           3  1                 2   # 3s
4  5  0        6  3  1  7        8     2   # 4s
4  5  0  9     6  3  1  7    10  8     2   # 5s
4  5  0  9     6  3  1  7 11 10  8     2   # 7
4  5  0  9 12  6  3  1  7 11 10  8 13  2   # 8s
</code>```9

4. Second Transposition

The first transposition was relatively simple. This one, however, is a disrupted transposition. The disruption pattern is determined by the width of the table and the key. In our example, we have 110 digits and 13 columns, meaning we'll have 8 full rows and 6 leftovers. We start filling in the first row, but stop at column 0, and continue as follows:

```<code>    THEFIRSTPR
S1: 8201357946

    INCIPLEIST
S2: 2603751489
</code>```0

Then we fill the last few spaces with the remaining digits.

```<code>    THEFIRSTPR
S1: 8201357946

    INCIPLEIST
S2: 2603751489
</code>```1

Now, we read off the columns in the exactly the same way we did for in the first transposition.

```<code>    THEFIRSTPR
S1: 8201357946

    INCIPLEIST
S2: 2603751489
</code>```2

And split everything up into 5-digit groups:

```<code>71431 14842 71192 58619 04185 22614 14745 49924 32826 13348 02189
38641 70140 40252 44820 64522 43982 71283 22694 94443 80642 14521
</code>```

5. Finalize the Message

The final step is to insert our random message identifier, 47921, into the message itself. The final digit of the key date 6 indicates the distance the group should be from the end.

```<code>71431 14842 71192 58619 04185 22614 14745 49924 32826 13348 02189 38641
70140 40252 44820 64522 43982 47921 71283 22694 94443 80642 14521
</code>```

Notes for this challenge

You are given a minimum of five inputs: the message, the letter keyword, the key phrase, the date, and a personal number. You may include two additional inputs: the random message identifier and the nulls needed to pad out the message, or your function may generate some random numbers on its own.

You may assume all inputs are valid, with the correct number of digits and letters (5-digit message identifier, at least 20 digits for the key phrase, and so on). You may assume that your strings (the message and keywords) have already had all punctuation and spaces removed except for those that you allow in your version, and that numbers are already demarcated with number signs.

The first keyword should not have duplicate letters in it, and in your code, you may assume that it never has duplicate letters.

The language you use to encode in does not matter, as long as the language is preexisting, the alphabet is preexisting, and you specify which language you use in your answer.

Whichever alphabet you employ for your straddling checkerboard, you may add or remove symbols to pad the checkerboard out. Specify what you use those symbols for (for example, punctuation, a separate "message begin" symbol, symbols for common words). You may forego the number sign entirely and spell out the numbers or include each digit in the checkerboard, using the slot where the number sign was for something else. Please specify which checkerboard you used in your answer.

The output should be either a string of space-separated five-digit groups, a list of five-digit integers, or something similar.

I used zero-indexing and 0123456789 in my example. You may use 1-indexing and 1234567890, or some other system in your answer, as long as you specify what you used.

Here is an example implementation on Ideone.

This is a long post and I wrote most of it by hand, so if there are any confusing parts in this post or errors in my counting and transposing, please let me know. Good luck and good golfing!

答:
Python 3, <s>1423</s> <s>1348</s> <s>1324</s> <s>1316</s> <s>1300</s> <s>1286</s> <s>1250</s> <s>1249</s> <s>1209</s> <s>1206</s> 1204 bytes

This is definitely the longest golf I've ever done, and the only golf where I was seriously worried about running out of one-character variable names. Golfing suggestions welcome. Try it online!

I'm encoding with the uppercase Latin alphabet with additional characters . and #, using 0-indexing and 0123456789 when converting g to t. My checkerboard is in a format similar to the following example:

  2 9 7 4 5 8 3 1 0 6    # C
  S E N A T O R I        # keyword
0 B D G J L P U W Y .    # remaining alphabet arranged in columns
6 C F H K M Q V X Z #    # . and # at the end
```

<p><strong>Edit:</strong> -63 bytes thanks to TuukkaX's suggestion to shorten some of the frequently used functions with one-letter variables. -12 bytes from making <code>a, g, t</code> more compact.</p>

<p><strong>Edit:</strong> -24 bytes from making by removing variable names for intermediate keys that are only used once, namely <code>a, g, s, S, k, K</code>.</p>

<p><strong>Edit:</strong> -74 bytes from consolidating <code>H(), T() and C()</code>.</p>

<p><strong>Edit:</strong> -1 byte thanks to Nick A for their suggestion of changing <code>ord(s[i])+ord(s[i+1])</code> to <code>sum(map(ord,s[i:i+2]))</code>. -2 bytes from changing 2 <code>+=[a]</code> calls to <code>+=a,</code>. -13 bytes from changing how <code>G()</code> found the index of the minimum of <code>s</code>. -2 bytes from changing <code>y=(y+1)%v</code> to <code>y=-~y%v</code>. -15 bytes from assigning <code>k.index()</code> to <code>K</code>. -4 bytes from assigning <code>10</code> to <code>W</code>. -5 bytes from assigning <code>1-I(d[-1])</code> to <code>X</code> inside <code>V</code>. -3 bytes from rewriting <code>C()</code>'s main loop. -2 bytes from reorganizing <code>T()</code>.</p>

<pre class="lang-python prettyprint-override"><code>I=int;L=list;E=len;R=range;B=str;J=''.join;W=10
def H(s,e):
 for i in R(e-E(s)):s+=chr(48+sum(map(ord,s[i:i+2]))%32%W)
 return s
def Q(s):
 r=[0]*E(s);s=L(s)
 for z in R(E(s)):b=s.index(min(s));r[b]=z;s[b]="~"
 return r
def T(x,k,d=0):
 u=E(x);v=E(k);g=R(v);K=k.index;n=u//v+1;w=[];e=r=y=0;i=K(y);c=[]
 if d:
  while r<n:
   if r>n-1:i=min(i,(u%v or v))
   w+=L(x[e:e+i]),;e+=i;i+=1;r+=1
   if i>v:y=-~y%v;i=K(y)
  r=y=0;i=v-K(y)
  while r<n:
   w[r]+=L(x[e:e+i]);e+=i;i-=1;r+=1
   if i<1:y+=1;i+=v-K(y);r+=1
  w[-1]+=['']*(v-E(w[-1]))
  for j in g:c+=J(z[j]for z in w),
 else:c=[x[i::v]for i in g]
 s=[0]*v
 for f in g:s[k[f]]=c[f]
 return J(s)
def C(m,s,w,n):
 t={".":s[-2:],"#":s[-1]*2};j=z=0
 for x in R(26):
  v=chr(x+65)
  if v in w:t[v]=s[w.index(v)]
  else:t[v]=s[z-2]+s[j];j+=z;z=-~z%2
 r=J(i.isdigit()and i or t[i]for i in m)
 return r+n[:-E(r)%5]
def V(m,w,P,d,A,M,n):X=1-I(d[-1]);t=J(B(Q(P[W:20])[I(J(B((I(H(J(B((I(M[i])-I(d[i]))%W)for i in R(5)),W)[i])+I(Q(P[:W])[i]))%W)for i in R(W))[i])])for i in R(W));u=H(t,60)[W:];p=A+I(u[-2]);v=T(u,Q(t));z=T(T(C(m,J(B(i)for i in Q(u[40:])),w,n),Q(v[:p])),Q(v[p:p+A+I(u[-1])]),1);e=[z[5*i:5*-~i]for i in R(-(-E(z)//5))];return' '.join(e[:X]+[M]+e[X:])
</code>```

Ungolfing:

def chain_add(seq, end):
    for i in range(end - len(seq)):
        seq += chr(48+sum(map(ord,seq[i:i+2]))%32%10)
    return seq

def sequent(seq):
    res = [0]*len(seq)
    seq = list(seq)
    for z in range(len(seq)):
        b = seq.index(min(seq))
        res[b] = z
        seq[b] = "~"
    return res

def transpose(text, keys, disrupt=False):
    if disrupt:
        num_rows = len(text) // len(keys) + 1
        len_last = len(text) % len(keys)
        if len_last == 0:
            len_last = len(keys)
        d_rows = []
        text_index = 0
        current_row = 0
        stop_key = 0
        stop_index = keys.index(stop_key)
        while current_row < num_rows:
            if current_row > num_rows-1:
                stop_index = min(stop_index, len_last)
            d_rows += [list(text[text_index:text_index+stop_index])]
            text_index += stop_index
            stop_index += 1
            if stop_index>len(keys):
                stop_key = (stop_key+1) % len(keys)
                stop_index = keys.index(stop_key)
            current_row += 1
        current_row = 0
        stop_key = 0
        stop_len = len(keys) - keys.index(stop_key)
        while current_row < num_rows:
            d_rows[current_row] += list(text[text_index:text_index+stop_len])
            text_index += stop_len
            stop_len -= 1
            if stop_len < 1:
                stop_key += 1
                stop_len = len(keys) - keys.index(stop_key)
                current_row += 1
            current_row += 1
        d_rows[-1] += ['']*(len(keys)-len(d_rows[-1]))
        columns = []
        for j in range(len(keys)):
            columns += [''.join(i[j]for i in d_rows)]
    else:
        columns = ['']*len(keys)
        for t in range(len(text)):
            columns[t%len(keys)] += text[t]
    res = [0]*len(keys)
    for index in range(len(keys)):
        res[keys[index]] = columns[index]
    return''.join(res)

def checkerboard(message, seq, word, null):
    trans = {".":seq[-2:], "#":seq[-1]*2};res='';j=z=0
    for x in range(26):
        v = chr(x + 65)
        if v in word:
            trans[v] = seq[word.index(v)]
        else:
            trans[v] = seq[z-2] + seq[j]
            j += z
            z = (z+1) % 2
    for i in message:
        if i.isdigit():
            res += i
        else:
            res += trans[i]
    return res + null[:-len(res)%5]

def vic_cipher(message, keyword, phrase, date, agent, m_id, null):
    s1 = sequent(phrase[:10])
    s2 = sequent(phrase[10:20])
    a = ''.join(str((int(m_id[i])-int(date[i]))%10) for i in range(5))
    g = ''.join(str((int(a[i])+int(s1[i]))%10) for i in range(10))
    t = ''.join(str(s2[int(g[i])]) for i in range(10))
    u = chain_add(t,60)[10:]
    p = agent+int(u[-2])
    q = agent+int(u[-1])
    seqT = sequent(t)
    v = transpose(u,seqT)
    k1 = sequent(v[:p])
    k2 = sequent(v[p:p+q])
    c = ''.join(str(i)for i in sequent(u[40:]))
    x = checkerboard(message,c,keyword,null)
    y = transpose(x,k1)
    z = transpose(y,k2,1)
    e = [z[5*i:5*(i+1)] for i in range(-(-len(z)//5))]
    X = 1-int(date[-1])
    return ' '.join(e[:X] + [m_id] + e[X:])
```

Title: Write a VIC cipher encoder

Body:
Python 3, <s>1423</s> <s>1348</s> <s>1324</s> <s>1316</s> <s>1300</s> <s>1286</s> <s>1250</s> <s>1249</s> <s>1209</s> <s>1206</s> 1204 bytes

This is definitely the longest golf I've ever done, and the only golf where I was seriously worried about running out of one-character variable names. Golfing suggestions welcome. <a href="https://tio.run/nexus/python3#bVRtU@I6FP7Or@jgMCS0RVrFvZtsdqa65VIFqm0VdzL54Epxg1KZthTonetf9560qLs790tzcl6e57ylrx6TSU5H7ElmOXXZU5zQgKV3yUNMT1mWp/SctdvdxbNM6JRZvcYsnmtDlBkxJg1t/pxqUpOJFqDYdFGGMcl0dv8zRcd/6dl6iZZ3K/SczoyMSyJ1W2DcOrJbU9zQ0jhfp4mWVYBXEApwKeM90VE4NGMjOGqGsmao8X@wrCuTWbxFS5koDU35D8FKmqmj@dJ8h04r6AhtjUdjxnqKYM1ctMW0gOMR0wcWoALTC/ZYI9KErQ8PC92iG8YFjVnKdqxHJbtAO0zvQdfQ5FybAZC2@SmfYi39kqiL0qZfE9MikqmspIHWrUKD1AuMlX2jQzlbHpNYlwIbNNaZpFJnFk3hs0eQXwuyY@bLrlXsOcHwlkJh7hW/E294Kn7D3kObf0B/schO0QFnjfRm3XDTAgTebosOKmCGlaLKWrV@oVr/QO51do5KvhDv49hgo6HFT1lMoC9bmC4pxPs2PECjsmqWRT3BeQ2T8Uc@F4Ldw/d9TOdqzmpSZ2hpZMbGSNSkcvZPs9uECNMmwmgeVKIlOva/dMFK1qtxt/Vm2CcqRCuqzdvqJ32VPpRdVJmSnBeCZXyz35sCA3md@95SmrbQMyiPLnTYpBKGULZstY/nSHZlNpMPMkf4LplBfUCbc/lR7PJjmVM94QR6mOJWX1Q13UBNG@PSmBmOMVaV3TLL9NCsajLNAf8UXaFLPiV2T2DuIaVAHhq@CWOgwlWEVI9nin95cn2MjSlWBt2rUMhU4P/xm@JKK/7Q0TUbotw46WGgF3TFHIBZQ8OFeiERWhtXKAe3EuQIqemonOQHyhV4H/cI8FVTA/eCk5W6KmlFVvoe0VLkhgXLyXjJ@x1J@h3z5ZceBshE0LcSHx5CUYLW/Wxr9Y8HxZzcCp2PhR7zW@B7XaXw00I3qDn0Jn@7o9Dtjv0bN/JDZ@AO/evQHfi3UeBHB0cH3e7UdQL3mxeegQsI3ci5cKdDJ/ruX585k@7pdTBxwfI9ahqNZuhOnMgPPCVHQ3fgBWF0GXiTM@9y5HphVMeNr8No4kcD3x/BLQjd0cCZfAMRmCDKdULPhTg3CP1J5Cs3hXdkfbJ71gmIn@F2/OmzbSn1cRPj1/8A" rel="nofollow noreferrer">Try it online!

I'm encoding with the uppercase Latin alphabet with additional characters . and #, using 0-indexing and 0123456789 when converting g to t. My checkerboard is in a format similar to the following example:

  2 9 7 4 5 8 3 1 0 6    # C
  S E N A T O R I        # keyword
0 B D G J L P U W Y .    # remaining alphabet arranged in columns
6 C F H K M Q V X Z #    # . and # at the end

Edit: -63 bytes thanks to TuukkaX's suggestion to shorten some of the frequently used functions with one-letter variables. -12 bytes from making a, g, t more compact.

Edit: -24 bytes from making by removing variable names for intermediate keys that are only used once, namely a, g, s, S, k, K.

Edit: -74 bytes from consolidating H(), T() and C().

Edit: -1 byte thanks to Nick A for their suggestion of changing ord(s[i])+ord(s[i+1]) to sum(map(ord,s[i:i+2])). -2 bytes from changing 2 +=[a] calls to +=a,. -13 bytes from changing how G() found the index of the minimum of s. -2 bytes from changing y=(y+1)%v to y=-~y%v. -15 bytes from assigning k.index() to K. -4 bytes from assigning 10 to W. -5 bytes from assigning 1-I(d[-1]) to X inside V. -3 bytes from rewriting C()'s main loop. -2 bytes from reorganizing T().

I=int;L=list;E=len;R=range;B=str;J=''.join;W=10
def H(s,e):
 for i in R(e-E(s)):s+=chr(48+sum(map(ord,s[i:i+2]))%32%W)
 return s
def Q(s):
 r=[0]*E(s);s=L(s)
 for z in R(E(s)):b=s.index(min(s));r[b]=z;s[b]="~"
 return r
def T(x,k,d=0):
 u=E(x);v=E(k);g=R(v);K=k.index;n=u//v+1;w=[];e=r=y=0;i=K(y);c=[]
 if d:
  while r<n:
   if r>n-1:i=min(i,(u%v or v))
   w+=L(x[e:e+i]),;e+=i;i+=1;r+=1
   if i>v:y=-~y%v;i=K(y)
  r=y=0;i=v-K(y)
  while r<n:
   w[r]+=L(x[e:e+i]);e+=i;i-=1;r+=1
   if i<1:y+=1;i+=v-K(y);r+=1
  w[-1]+=['']*(v-E(w[-1]))
  for j in g:c+=J(z[j]for z in w),
 else:c=[x[i::v]for i in g]
 s=[0]*v
 for f in g:s[k[f]]=c[f]
 return J(s)
def C(m,s,w,n):
 t={".":s[-2:],"#":s[-1]*2};j=z=0
 for x in R(26):
  v=chr(x+65)
  if v in w:t[v]=s[w.index(v)]
  else:t[v]=s[z-2]+s[j];j+=z;z=-~z%2
 r=J(i.isdigit()and i or t[i]for i in m)
 return r+n[:-E(r)%5]
def V(m,w,P,d,A,M,n):X=1-I(d[-1]);t=J(B(Q(P[W:20])[I(J(B((I(H(J(B((I(M[i])-I(d[i]))%W)for i in R(5)),W)[i])+I(Q(P[:W])[i]))%W)for i in R(W))[i])])for i in R(W));u=H(t,60)[W:];p=A+I(u[-2]);v=T(u,Q(t));z=T(T(C(m,J(B(i)for i in Q(u[40:])),w,n),Q(v[:p])),Q(v[p:p+A+I(u[-1])]),1);e=[z[5*i:5*-~i]for i in R(-(-E(z)//5))];return' '.join(e[:X]+[M]+e[X:])

Ungolfing:

def chain_add(seq, end):
    for i in range(end - len(seq)):
        seq += chr(48+sum(map(ord,seq[i:i+2]))%32%10)
    return seq

def sequent(seq):
    res = [0]*len(seq)
    seq = list(seq)
    for z in range(len(seq)):
        b = seq.index(min(seq))
        res[b] = z
        seq[b] = "~"
    return res

def transpose(text, keys, disrupt=False):
    if disrupt:
        num_rows = len(text) // len(keys) + 1
        len_last = len(text) % len(keys)
        if len_last == 0:
            len_last = len(keys)
        d_rows = []
        text_index = 0
        current_row = 0
        stop_key = 0
        stop_index = keys.index(stop_key)
        while current_row < num_rows:
            if current_row > num_rows-1:
                stop_index = min(stop_index, len_last)
            d_rows += [list(text[text_index:text_index+stop_index])]
            text_index += stop_index
            stop_index += 1
            if stop_index>len(keys):
                stop_key = (stop_key+1) % len(keys)
                stop_index = keys.index(stop_key)
            current_row += 1
        current_row = 0
        stop_key = 0
        stop_len = len(keys) - keys.index(stop_key)
        while current_row < num_rows:
            d_rows[current_row] += list(text[text_index:text_index+stop_len])
            text_index += stop_len
            stop_len -= 1
            if stop_len < 1:
                stop_key += 1
                stop_len = len(keys) - keys.index(stop_key)
                current_row += 1
            current_row += 1
        d_rows[-1] += ['']*(len(keys)-len(d_rows[-1]))
        columns = []
        for j in range(len(keys)):
            columns += [''.join(i[j]for i in d_rows)]
    else:
        columns = ['']*len(keys)
        for t in range(len(text)):
            columns[t%len(keys)] += text[t]
    res = [0]*len(keys)
    for index in range(len(keys)):
        res[keys[index]] = columns[index]
    return''.join(res)

def checkerboard(message, seq, word, null):
    trans = {".":seq[-2:], "#":seq[-1]*2};res='';j=z=0
    for x in range(26):
        v = chr(x + 65)
        if v in word:
            trans[v] = seq[word.index(v)]
        else:
            trans[v] = seq[z-2] + seq[j]
            j += z
            z = (z+1) % 2
    for i in message:
        if i.isdigit():
            res += i
        else:
            res += trans[i]
    return res + null[:-len(res)%5]

def vic_cipher(message, keyword, phrase, date, agent, m_id, null):
    s1 = sequent(phrase[:10])
    s2 = sequent(phrase[10:20])
    a = ''.join(str((int(m_id[i])-int(date[i]))%10) for i in range(5))
    g = ''.join(str((int(a[i])+int(s1[i]))%10) for i in range(10))
    t = ''.join(str(s2[int(g[i])]) for i in range(10))
    u = chain_add(t,60)[10:]
    p = agent+int(u[-2])
    q = agent+int(u[-1])
    seqT = sequent(t)
    v = transpose(u,seqT)
    k1 = sequent(v[:p])
    k2 = sequent(v[p:p+q])
    c = ''.join(str(i)for i in sequent(u[40:]))
    x = checkerboard(message,c,keyword,null)
    y = transpose(x,k1)
    z = transpose(y,k2,1)
    e = [z[5*i:5*(i+1)] for i in range(-(-len(z)//5))]
    X = 1-int(date[-1])
    return ' '.join(e[:X] + [m_id] + e[X:])