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
print(2*input())
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
print(2*input())
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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><style>table th,table td{padding: 5px;}th{text-align: left;}.score{text-align: right;}table a{display: block;}.main{float: left;margin-right: 30px;}.main h3,.main div{margin: 5px;}.message{font-style: italic;}#api_error{color: red;font-weight: bold;margin: 5px;}</style> <script>QUESTION_ID=88979;var safe_list=[];var uncracked_list=[];var n=0;var bycreation=function(x,y){return (x[0][0]<y[0][0])-(x[0][0]>y[0][0]);};var byscore=function(x,y){return (x[0][1]>y[0][1])-(x[0][1]<y[0][1]);};function u(l,o){jQuery(l[1]).empty();l[0].sort(o);for(var i=0;i<l[0].length;i++) l[0][i][1].appendTo(l[1]);if(l[0].length==0) jQuery('<tr><td colspan="3" class="message">none yet.</td></tr>').appendTo(l[1]);}function m(s){if('error_message' in s) jQuery('#api_error').text('API Error: '+s.error_message);}function g(p){jQuery.getJSON('//api.stackexchange.com/2.2/questions/' + QUESTION_ID + '/answers?page=' + p + '&pagesize=100&order=desc&sort=creation&site=codegolf&filter=!.Fjs-H6J36w0DtV5A_ZMzR7bRqt1e', function(s){m(s);s.items.map(function(a){var he = jQuery('<div/>').html(a.body).children().first();he.find('strike').text('');var h = he.text();if (!/cracked/i.test(h) && (typeof a.comments == 'undefined' || a.comments.filter(function(b){var c = jQuery('<div/>').html(b.body);return /^cracked/i.test(c.text()) || c.find('a').filter(function(){return /cracked/i.test(jQuery(this).text())}).length > 0}).length == 0)){var m = /^\s*((?:[^,;(\s]|\s+[^-,;(\s])+).*(0.\d+)/.exec(h);var e = [[n++, m ? m[2]-0 : null], jQuery('<tr/>').append( jQuery('<td/>').append( jQuery('<a/>').text(m ? m[1] : h).attr('href', a.link)), jQuery('<td class="score"/>').text(m ? m[2] : '?'), jQuery('<td/>').append( jQuery('<a/>').text(a.owner.display_name).attr('href', a.owner.link)) )];if(/safe/i.test(h)) safe_list.push(e);else uncracked_list.push(e);}});if (s.items.length == 100) g(p + 1);else{var s=[[uncracked_list, '#uncracked'], [safe_list, '#safe']];for(var i=0;i<2;i++) u(s[i],byscore);jQuery('#uncracked_by_score').bind('click',function(){u(s[0],byscore);return false});jQuery('#uncracked_by_creation').bind('click',function(){u(s[0],bycreation);return false});}}).error(function(e){m(e.responseJSON);});}g(1);</script><link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/Sites/codegolf/all.css?v=7509797c03ea"><div id="api_error"></div><div class="main"><h3>Uncracked submissions</h3><table> <tr> <th>Language</th> <th class="score">Score</th> <th>User</th> </tr> <tbody id="uncracked"></tbody></table><div>Sort by: <a href="#" id="uncracked_by_score">score</a> <a href="#" id="uncracked_by_creation">creation</a></div></div><div class="main"><h3>Safe submissions</h3><table> <tr> <th>Language</th> <th class="score">Score</th> <th>User</th> </tr> <tbody id="safe"></tbody></table></div>
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.