[Question]
  [
*This is a [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge. For the robbers thread, go [here](https://codegolf.stackexchange.com/q/109951/42963).*
This challenge involves two [OEIS](https://oeis.org/) sequences chosen by the cops -- **S1**, **S2** -- and how well those sequences can be golfed and obfuscated.
### The Cops' Challenge
Your challenge as a cop is to pick a [freely available language](http://meta.codegolf.stackexchange.com/a/7212/42963), and two OEIS sequences. Then, write code **A** in that language that takes input *n* and produces S1(n). When that code is modified by a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) of **X** characters (with X no more than `0.5 * (length A)`), and turned into code **B** in the same language, it must then produce S2(n). You must actually write this code **B**, but don't reveal it until your challenge is safe (see below).
The cops' submissions must include the language name, the full code **A**, the byte-count of **A**, the **X** value of how many changes to get to their secret **B** code, and the chosen **S1** and **S2** sequence numbers. You can choose whether each sequence is 0-indexed or 1-indexed, but please specify that in your submission.
To crack a particular submission, robbers must come up with a program **C** in the same language (and version) that produces S2(n) and is **Y** character changes away from **A** (with `Y <= X`). Robbers do not necessarily need to find the exact same **B** code that the cop (secretly) produced.
### Winning and Scoring
If your cop answer has not been cracked within 7 days (168 hours), you may reveal your own **B** solution, at which point your answer is considered safe. As long as you don't reveal your solution, it may still be cracked by robbers, even if the 7 days have already passed. If your answer does get cracked, please indicate this in the header of your answer, along with a link to the corresponding robber's answer.
Cops win by having the uncracked submission with the shortest **A**. If tied, then the smallest **X** will be used as tie-breaker. If still tied, the earlier submission will win.
### Further Rules
* You must not use any built-ins for hashing, encryption, or random number generation (even if you seed the random number generator to a fixed value).
* Either programs or functions are allowed, but the code must not be a snippet and you must not assume a REPL environment.
* You may take input and give output [in any convenient format](http://meta.codegolf.stackexchange.com/q/2447/42963). The input/output methods must be the same for both sequences.
* The definitive calculator for the Levenshtein distance for this challenge is [this one](http://planetcalc.com/1720/?license=1) on Planet Calc.
* In addition to being a CnR challenge, this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so all usual golfing rules apply.
  
[Answer]
# ~~[Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 28 bytes, Distance of 4, [A002817](http://oeis.org/A002817), [A090809](http://oeis.org/A090809)~~ [Cracked](https://codegolf.stackexchange.com/a/110547/56656)
This answer uses 1-indexing
```
(({({}[()])}{}){({}[()])}{})
```
[Try it online](https://tio.run/nexus/brain-flak#@6@hUa1RXRutoRmrWVtdq4nC@f/fDAA)
For anyone interested there are 27475 valid Brain-Flak programs with Levenshtein distance 4 from this program and 27707 with distance 4 or less. So a brute force solution would be feasible on a consumer grade computer.
[Answer]
# [7](https://esolangs.org/wiki/7), 33 characters, 13 bytes, X = 10, [A000124](http://oeis.org/A000124) → [A000142](http://oeis.org/A000142), Safe
```
171720514057071616777023671335133
```
[Try it online!](https://tio.run/nexus/7#DcOBDQAwCMOwl1oY5P/Lyiw5xpTGT4PwegFVL@6ePykd)
The Levenshtein distance is measured in terms of characters, so I've written the program in terms of the characters it contains above (and Try it online!, including the language itself, is happy to run programs encoded in ASCII). However, the program is stored in disk using 7's sub-byte encoding, meaning that the program itself is actually the following hexdump (thus 13 bytes long):
```
00000000: 3cf4 2982 f1ce 3bfe 13dc b74b 7f         <.)...;....K.
```
(Because the Levenshtein distance is measured in terms of characters, you aren't necessarily adding/deleting/changing 10 *bytes* here, so it's probably best to work with the original ASCII.)
The program as written implements A000124 (triangular numbers + 1); any crack must implement A000142 (factorials). Both programs take input from stdin (as decimal integers), write their output to stdout, and treat an input of 1 as meaning the first element of the sequence (and an input of 2 as the second element, etc.).
Hopefully the very high X value will stop people brute-forcing the program, this time (which is always a risk with cops-and-robbers entries in 7).
## The solution
```
177172051772664057074056167770236713351353
```
[Try it online!](https://tio.run/nexus/7#DcXBAcAwDAKxlYwp3P6TuflIJxA7eW/7TRieVYFZF9mR47v8 "7 – TIO Nexus")
Differences from the original:
```
17 172051     405707 **1** 61677702367133513 3
17**7**172051**77266**405707**405**61677702367133513**5**3
```
I don't have explanations prepared for how these work, so it's going to take me a while to get an explanation up, as I'm going to have to figure it out from almost-scratch. Hopefully there will be an explanation eventually.
[Answer]
## Pyke, Levenshtein distance of 1, [A036487](https://oeis.org/A036487), [A135628](https://oeis.org/A135628).
### [Cracked!](https://codegolf.stackexchange.com/a/109957/32686)
```
X*e
```
[Try it here!](http://pyke.catbus.co.uk/?code=X%2ae&input=10)
[Answer]
# [Perl 6](http://perl6.org/), 10 bytes, X = 1, [A000012](http://oeis.org/A000012) → [A001477](http://oeis.org/A001477)
### [Cracked!](https://codegolf.stackexchange.com/a/109963/14880)
```
*[0]o 1***
```
* **S1** = A000012 = `1,1,1,1,1,...` = The all 1's sequence. *(0-indexed)*
* **S2** = A001477 = `0,1,2,3,4,...` = The nonnegative integers. *(0-indexed)*
[Try it online!](https://tio.run/nexus/perl6#y61UUEtTsP2vFW0Qm69gqKWl9d@aqzixUiE3sQAoo6NgqKdnZGD9HwA "Perl 6 – TIO Nexus")
Confirmed to work with [Perl 6 release 2017.01](http://rakudo.org/downloads/star/), and with the Perl6 version running on TIO.
(**A** could be further golfed to `1***` – I hope it it's also allowed as it is.)
[Answer]
# [Perl 6](https://perl6.org), 13 bytes, X = 1, [A161680](http://oeis.org/A161680) → [A000217](http://oeis.org/A000217)
### Safe!
```
{[+] [,] ^$_}
```
* **S1** = A161680 = `0 0 1 3 6 10 15 21...` = Zero followed by the triangular numbers.
* **S2** = A000217 = `0 1 3 6 10 15 21 28 ...` = The triangular numbers.
* Zero-indexed.
[Try it online!](https://tio.run/nexus/perl6#y61UUEtTsP1fHa0dqxCtE6sQpxJf@784sVJBKfhRU6MCCNgqKOko2BgoGCgYKhgrmCkYAhmmCkaGCkYWCsZmCiamCqamCmZmCuYWCpaGQFlTBUMjoBKglKGpsYKhOVDM0sDOmgtmahOKqRSYCVQPN1cJShelFpfmlEBMz00sAPpOR8FAT8/IwPo/AA "Perl 6 – TIO Nexus")
(Confirmed to work with the Perl 6 version running on TIO.)
### Solution
```
{[+] [\,] ^$_}
```
How the original works:
```
{           }  # A lambda.
          $_   # Lambda argument.                     e.g. 4
         ^     # Range from 0 to n-1.                 e.g. 0, 1, 2, 3
     [,]       # Reduce with comma operator.          e.g. 0, 1, 2, 3
 [+]           # Reduce with addition operator.       e.g. 6
```
How the solution works:
```
{            } # A lambda.
           $_  # Lambda argument.                     e.g. 4
          ^    # Range from 0 to n-1.                 e.g. 0, 1, 2, 3
     [\,]      # Triangle reduce with comma operator. e.g. (0), (0,1), (0,1,2), (0,1,2,3)
 [+]           # Reduce with addition operator.       e.g. 10
```
Exploits the fact that numeric operators like addition treat a list as its number of elements, so in the example the sum is `1 + 2 + 3 + 4 = 10`.
And yeah, the "Reduce with comma operator" no-op in the original is kinda skirting the code-golf rules, but I prefer to look at it as a silly algorithm which has been golfed as much as possible (whitespace etc.) for what it is... :)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 11 bytes, X = 5, [A005185](https://oeis.org/A005185) → [A116881](https://oeis.org/A116881)
```
ịḣ2S;
1Ç¡ḊḢ
```
This is a full program that takes an integer as command-line argument and prints an integer.
Both sequences are indexed as on OEIS, i.e, [A005185](https://oeis.org/A005185) is 1-indexed and [A116881](https://oeis.org/A116881) is 0-indexed.
[Try it online!](https://tio.run/nexus/jelly#ARsA5P//4buL4bijMlM7CjHDh8Kh4biK4bii////MjA "Jelly – TIO Nexus")
[Answer]
## Javascript, 41 bytes, Distance of 3, [A061313](https://oeis.org/A061313), [A004526](https://oeis.org/A004526), [Cracked](https://codegolf.stackexchange.com/a/109981/12012)
```
f=x=>{return x>1?x%2?f(x+1)+1:f(x/2)+1:0}
```
[Try it Online](https://tio.run/nexus/javascript-node#@59mW2FrV12UWlJalKdQYWdoX6FqZJ@mUaFtqKltaAVk6BuBGAa1/0tso2O50vKLNKxL9HJS89JLMmwMDQyAnILS4gwNmBhQn6Y1V3J@XnF@TqpeTn46UCY3sUAjTVPzPwA)
Uses 1 based indexing, solution uses 0 based indexing.
Once again, a different solution...
```
f=x=>{return x>1?x<2?f(x-1)+1:f(x-2)+1:0}
```
[Answer]
# [Perl 6](https://perl6.org), 19 bytes, X = 1, [A000045](http://oeis.org/A000045) → [A000035](http://oeis.org/A000035)
### [Cracked!](https://codegolf.stackexchange.com/a/110006/14880)
```
{(0,1,*+*...*)[$_]}
```
* **S1** = A000045 = `0 1 1 2 3 5 8 13 21 34...` = "Fibonacci numbers". (*0-indexed*)
* **S2** = A000035 = `0 1 0 1 0 1 0 1 0 1...` = "Period 2". (*0-indexed*)
[Try it online!](https://tio.run/nexus/perl6#jY@9CsIwHMT3PsVRRDSGkH8@TEKtL@EoIsUqOhSFuhRxsI/qi8SA7eTiHcdxyw@u6TA9oYyPmeTE2YIJIdh8O9nvnrGtOuSbd//CoBI5x0qCkhU0LDxIQxG0gU0rgIyB0hraOSxJIngHssFBWW9gyNO6yEZw/wv@IyMgH/p@vrQ4XOvjF9NUt3SJQwpBocjiBw "Perl 6 – TIO Nexus")
(Confirmed to work with the Perl 6 version running on TIO.)
[Answer]
# ~~WolframAlpha, 18 bytes, X = 1~~
**[Cracked by math\_junkie!](https://codegolf.stackexchange.com/a/110059/56178)**
```
(sum1to#of n^1)*2&
```
Sometimes WolframAlpha will actually be able to display a pure function like this in functional form (other times it gets confused); but it can be cheerfully invoked with a given input—for example, `(sum1to#of n^1)*2&@5` yields `30`.
**S1** = [A002378](https://oeis.org/A002378) (pronic numbers)
**S2** = [A000537](https://oeis.org/A000537) (sum of the first `n` cubes)
Both sequences are 0-indexed.
[Answer]
## Pyke, Levenshtein distance of 2, [A008788](https://oeis.org/A008788), [A007526](https://oeis.org/A007526)
### [Cracked!](https://codegolf.stackexchange.com/a/110071/32686)
```
'th^
```
[Try it here!](http://pyke.catbus.co.uk/?code=%27th%5E&input=5)
Let's get slightly harder shall we?
The first answer is 1 based and the crack is 0 based.
[Answer]
# Javascript, 15704 bytes, distance of 2, [A059841](http://oeis.org/A059841) and [A000004](https://oeis.org/A000004) - [cracked](https://codegolf.stackexchange.com/a/110069/54187)
This solution is extremely long, so you can find the full code [at this github gist.](https://gist.github.com/DJMcMayhem/103703e44534336bae7ccb39dd287f28)
The original answer (this one) is 1 indexed.
(I know this is way too long, it is just for fun.)
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 16 bytes, Levenshtein distance of 4, [A000217](https://oeis.org/A000217) and [A002378](https://oeis.org/A002378) -- [Cracked by Martin Ender!](https://codegolf.stackexchange.com/a/110078/31716)
```
({({}[()])()}{})
```
[Try it online!](https://tio.run/nexus/brain-flak#@69RrVFdG62hGaupoVlbXav5/785AA "Brain-Flak – TIO Nexus")
This should be fairly easy to crack.
[Answer]
## Javascript, 30 bytes, Distance of 4, [A000290](https://oeis.org/A000290), [A000079](https://oeis.org/A000079), **-**[Cracked!](https://codegolf.stackexchange.com/a/109964/64505)
```
f=x=>{return x?2*x-1+f(x-1):0}
```
0-based indexing
@Kritixi Lithos's solution was actually different from mine
```
f=x=>{return x?f(x-1)+f(x-1):1}
```
[Try it online](https://tio.run/#Mjo5U)
[Answer]
# Javascript (ES6), distance is 1, [A000079](https://oeis.org/A000079 "A000079") and [A000004](https://oeis.org/A000004 "A000004") - [cracked](https://codegolf.stackexchange.com/a/109976/54187)
```
as=function(){ return 2*2**((11)*-1*~arguments[0]/11-(4-(as+[]).length%89))-(as+[]).length%7}
```
The original answer (this one) is 0 based.
Now that it has been cracked, here is the original B function:
```
as=function(){ return 2*2**((1^1)*-1*~arguments[0]/11-(4-(as+[]).length%89))-(as+[]).length%7}
```
[Answer]
# [Perl 6](https://perl6.org), 7 bytes, X = 2, [A059841](http://oeis.org/A059841) → [A001477](http://oeis.org/A001477)
### [Cracked!](https://codegolf.stackexchange.com/a/110001/14880)
```
+(*%%2)
```
* **S1** = A059841 = `1 0 1 0 1 0 1 0...` = "\*Period 2: Repeat (1,0)". *(0-indexed)*
* **S2** = A001477 = `0 1 2 3 4 5 6 7...` = "The nonnegative integers". *(0-indexed)*
[Try it online!](https://tio.run/nexus/perl6#jY7LCoJQAET3fsXhgtFDxLk@L2Y/0RdID2ohBbZxmZ/aj5iREe0aGAZm4DBNx@xINazmS9@3i6H02rrDbB/9nUkVJmAtIv7w5gvofwGv2RKTkJKRU@DQWApZFKMEpShDOSqQ@6DMlLfTuWV32R/ewKa@jtcDojCUK73hCQ "Perl 6 – TIO Nexus")
(Confirmed to work with the Perl 6 version running on TIO.)
[Answer]
# Java 7, Levenshtein distance of 4, [A094683](https://oeis.org/A094683), [A000290](https://oeis.org/A000290), [Cracked](https://codegolf.stackexchange.com/questions/109951/change-the-code-change-the-sequence-robbers/110043#110043)
```
int x{double r=1;for(int i=0;i<42;i++)r=r/2+n/r/2;int k=(int)((int)n*(float)n/Math.pow(n,(Math.sin(n)*Math.sin(n)+Math.cos(n)*Math.cos(n))/2));return n%4%2==(int)Math.log10(Math.E)/Math.log((double)'H'-'@')?(int)r:k;}
```
0-indexed.  
[Try it here!](http://ideone.com/xx2BLx)
]