84
\$\begingroup\$

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.

\$\endgroup\$
18
  • 2
    \$\begingroup\$ @Andan That seems unfortunate. Say I write a golf with multiple clever tricks that improve on the obvious formula. If I post the obvious formula, anyone can find one improvement and win. Or, I have to tip my hand and give away all the improvements but one. Would you consider changing this, if it's not too late? Sorry for not thinking of this in this sandbox, I only noticed when trying the challenge in earnest. \$\endgroup\$
    – xnor
    Commented Aug 6, 2016 at 11:07
  • 4
    \$\begingroup\$ @xnor Hmm, that would cause a big problem with the scoring mechanism. You can then make an arbitirarily large submission and an almost impossible short one, and win the challenge. \$\endgroup\$
    – Adnan
    Commented Aug 6, 2016 at 11:12
  • 3
    \$\begingroup\$ @Adnan You could solve that by defining score = len(secret code)/min {len(public code), len(shortest code posted by robbers)}. \$\endgroup\$ Commented Aug 6, 2016 at 12:22
  • 3
    \$\begingroup\$ @Adnan The context is xnor’s suggestion to make the score count if the robbers beat your public score but do not match your secret score. I’m proposing a way to make that work while avoiding the problem you’re concerned about. \$\endgroup\$ Commented Aug 6, 2016 at 12:43
  • 3
    \$\begingroup\$ Yeah, finally another Cooooops and Rooooobbbbbers challenge. \$\endgroup\$ Commented Aug 6, 2016 at 20:41

55 Answers 55

37
\$\begingroup\$

Seed, 5861 bytes, score = 5012 / 5861 = 0.85

The sequence is primes (A000040) with offset 1. a(1) = 2, a(2) = 3, a(3) = 5 etc.

106 4339425277766562922902283581834741289660008085947971671079664775075736459902652798498038280771739790213868067702391567527146683746696872737118568202495046682058807677834082334206717794057290386357040004038910321326390033894692316122893125849512049817771469697446796247656883761642659391998672259889315862253584980121050081936190889196979721443972131545258528161479083569474217100401074866410321578452749003295370495810488337344650619973376676577461877392643228932028285261311284691649403036725905675576380944186859525020321196255472295415627414823269713084816196540461818684672201926996228242729726187404845487167114556965625764494860789841409004737497250600337038738035289643512265772877903971230007222865264200102217827010958702813633039465646713707971175729900391272165457566364779628858903697222589748797809421482136725017988969980267265196209027326008642464190920825439635011414535065156799655809935871795742526416544853103823906918352472744460644939241345215614650110978624804796257165525598653433482592675123776747497586586903140407616610040250976121531777891358439091358523224019193934111409521776865798864774150127996987606796522094617839125169013781373842026970010007574244564780540958252950607459585834584855526028427463655493110963000525209314274839412714497954647707284352161251044088451086878301225167181712809612927720502228546704347274977503482518386819117870800284276687560241308964641752876311905619184965236937789822712948719170589044519552259399272657757694404103028213338440810122219269214268424256451648966039627998513353115348057963135398345514276156595104642595820063441019481255889600472121104059631555738973905087895006671206400595057069658845297458058584470727379036742268107372233190371861824194831387484478317333784774872796689435056263039565495723444232483369405079512770383639748492508848098080619713255928884946598796741958520788406091704951276729428229224292748702301286318784744573918534142896761450194446126776354892827260482520089107240497527796383449573487121759294618654056309957794765646022274249211113876873102681817500947681708211056388348991201016699342850495527766741633390367735662514559206616070479934780700857859919517187362382258597709910134111383911258731633002354208155277838257255571878219168563173495861133946240923601273185050088148273459064040178741322137494758164795598458780786653602794809987537740537018415433767449108362051063814315399931951925462073202072886716208053889630274798247936580024665863765351912184189125660586187615847325588786048095120241198943086897428919324650596915625795076460123743259068671341944912206659194476673792489442514470540309819938731582497982088632076086088279435186513066668502875362808653657423813387124496122632219269226944975782747969308509448942429277233562654639293567532567668357917753810024961683829653277391094269518376510962710057956994339018307344554672056556222387849272880157861877494719706801624724491116189525394408237355854147113614645956561900837121715298276123085019204014577395795131906357190097536924932784935203378709529040555114884933996346694363879974847691625806412083107877442577777402405491226347699452398189866905599648314105255526411599513768016126067224570735746339691839657336828937030584950250402550603260483421505256395736457980708347396132620971927806636308105501893575073944959824958733880580825249931469481777083600987966500968473202481877213198175820182125298036242272662171321630056435823478710070315022531849275633515412140708923196338877549535352180465031450246889723670908173572778497329815806296369714467774385173078365517895215622645081749679859298824530173433952201710212962315524645807786760255396609101229899503687886977229729747349967302227815724222900649259120496955396616388023947812556426182596252076072286860171961582235043470190275528327438941205680729222092142315348205283459886659277456757338926863444370956987436702675569004062857510888080701482282900718067707825890168959050535970636214821273965900140346587802750221148933877600652180282267212515086387728695565345543441575183083490091817551421389124038251086513387106526847199935776240422217886407416027185332010280169564289345500368555274327733580514983967396271907637608170801013991375555069570288329399237332712790289521766624379537848996471168926519414464863388365890585061582441222989105844636887033599262856636618609644981203616618819656730174147506366895579518927217154437260067784133452192099436160162797896733220282837763342940047719962882720310397266700665603774047807673735452896542215047419894928360985667680051383584281780118001522220147385455276205847620842066894760474814386271419398361771509559702341442734727141312211989794380570433135781896005067541537095546614638001539678780066976441749790924521292297473522803115912791790379839635473194794843511234906415092857115568242448079933264380632375450234146479596225552359821776361923588178896354011117990551249184457345201223244319766597339520899930287542362386381372955844126876031262062731835081542890548095759704856479235361996156162229417953890962902505112862674541020677153054937034038823204321411753183982406667628845943390275194956321260584953509501973880059966268311741789559039618821364775407403947492157311255310143283125490988585303127442698159113924719563571459841025286208880511134222538431747221840824203312684036627017414295981003169360893015436564680773233890198618904647085929678054127680367983802905553144716598061593632352021737488422700265144189474970515439967472618438343180405852959047054139020095303915498443045344690691354304662161461750826840689185141612937350984288238847592910919431788170821390987459951181698659544772214696392241600642992000900364649438402093845534643663733216626212187314397293309505677932731383013397665193960914949915855970134736764497124186701371371881061763702617034928084811708964018610410971938419410791443362686750151572343348438861493025667676713

The Befunge-98 programs were tested with this interpreter.

Solution:

62 92671758747582594731336103958852355343308794409787718910287760272065096600068486400261521203099179296478278113800406388237579729434074471528101978922110199511009255327569364221068648720732186414156697930516237153253745234146558781777104311285708042469572129997820696177040412749585193035961972308024909384538547357820271391461203855177879703963391294547499579588457829374981409596253284387318191154655397249791533591896711203680125312645807793061567274893660125978667479654664977040722935418267606762108334976561590548772755653088127344268269983549959628254712562135604114391709222466418283973346968039685907258341712475120187026707300070769277380483828579629391533415119380882514570806683534933872011332303802477012040660361613689139008855327957705058672774790021218679288003003953301651226513713984857174365383390364296326192225244927665294515693697694918935732394438095829822147927645949273829493190176397786165741955566462476231578299385726525505407052332068778469428870102672560545990553686935179657522071350801304923521681690806124866463401094200444841941834667455137491597902735287855498886460945851544063102556545691787612423033525861765804657417395955322217721677429700032333887700477665924915189639029356029794151144702621112140447347270986003871777552705154393697526621456025974679633450745341583481291685834000335168972075093212539251102818038917942913311300883294570091156661153874804268309393591292001433191276766990017144340677002050765359295580546228905861008474333888247511333039470305173620221481374758754343560048199433044290376988914313248904786418615239832295700238599693805552407166251501198275363727855984193340187485162706203747898935844148656997727555488455764358003951396850496841760348138874901474547533715922587211143833052692993182786162665394965914056238514702648647904702501871758140636318131208564891924287008550289224318358936576352473100482724524675417108540029486047223784009872784235439805791496176981701859374772960623187174667015174831665360382067784289660747175586412802848517818731070091826086320292632019033525579172665790335268736167170506003176022610987557889205903933680970434653929602313812168432779881423599218075810156457004870273456214668951969634696002866863369645150677406566613367576078149751561615160777945725724620047443832859087000460506626402089973036918592151204779260519899343451226942874643654023265001514280212345984966126290887141500898797940093805650642580450926977375576911590855135774911449619005627413806680159169643085790457809525639117624947749945044091079624534522626841372604654172723500062361904864176709974716350878399949908529715899937417421315012456868864220900338162700464737416505300734198857624165994112815507157337074226022552948626042899845891195024145834980781844015548398775284084741665926642729256313545870065439195137107807599897817556866239630270351410298105991743248934632486671734759038305157913444368204353943206369388913837519310828223093441519335111533635957953613758894822654736600526811789875376813119426924959017038654104216784121093688306563643326587639486472221258233221666454164763738631579246841130247019172136121041002571694545781948282785399495873501148416357057693713305042834246973535325571882393889489457235864027134943913383832461393499203435931881991959787045205816313165984531168137210464591653390767999403651750434079431253272021002273680565508340556736474927770564408343360602057949991306130979603289667991356237787412616305022971197507815004141825394838946364485315703051195195566893733123391158803413838803831010122718476800229685100410524315094662633390222854924884579083098055980542607258318868514903610787510921796157291630993618714015755412239872758443166948699744841899868754369627081727143351807615097715679652005998467491609044596871312950634152039807480021814406950780706131231897491212637759991818212542181136384052857191779658528790835620632765143337026858373660057972387266312097135260115742458792764792668883627539340807572869610941154184473111399152964165437112713815173281951728792354570851956468302291939952274005357250989986640723863408051924618400882866539701190471828299028566020683682444415198672952980294639217217840535225987439355834087974716313911977302809235338769491339553247328065401203243450045946392960085318343121705830317674151229536850726617093615850507955559652374337057819549481320081981520577039493601331233500403284295119207704095876958023271178964331413629547646937335760969491450824461526563643617594783473684358594189269252499897162333533284912320654686655888508024970105099967896167541978181602786701854274646885561632089896312016789257459673121974866871919820865433343707787147414982407950775979279255414469970743690769124215210050618943726165676550098723299244096267839544684847323547847832349290874282817429866612456451105673214159820212156069771415582214200701894487126822756864305461967035982308878073752362075553218935807632264803200753661147341613284071218919438723527468202903770806766095252957940538229987302177328543423522712562396242285027178395886649344
\$\endgroup\$
2
  • 9
    \$\begingroup\$ This would take centuries to crack o_____O \$\endgroup\$ Commented Nov 4, 2016 at 20:55
  • 6
    \$\begingroup\$ The Right Language for the Challenge \$\endgroup\$
    – DLosc
    Commented Nov 11, 2016 at 23:02
27
\$\begingroup\$

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!

\$\endgroup\$
5
  • 4
    \$\begingroup\$ Welcome to Programming Puzzles and Code Golf! \$\endgroup\$
    – Adnan
    Commented Aug 7, 2016 at 15:41
  • 2
    \$\begingroup\$ Just out of curiosity, is this actually possible in 4 bytes? I've been stuck on this for hours :p. \$\endgroup\$
    – Adnan
    Commented Aug 7, 2016 at 21:59
  • 1
    \$\begingroup\$ @Adnan, yes it's possible. Glad to hear you're finding it challenging! \$\endgroup\$ Commented Aug 7, 2016 at 22:16
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – jimmy23013
    Commented Aug 8, 2016 at 1:10
  • \$\begingroup\$ @jimmy23013, yup, nicely done! \$\endgroup\$ Commented Aug 8, 2016 at 1:14
12
\$\begingroup\$

Retina, 28 bytes, score = 0.9286... (26/28), cracked by feersum

.+
$*
^$|^((^|\3)(^.|\1))*.$

Computes A192687, (offset = 0).

Try it online! (The first line enables a linefeed-separated test suite.)

This is the difference between Hofstadter's male and female sequences. (Relevant PPCG challenge.)

This was my original code:

.+
$*
^((^.|\3)(\1)|){2,}$

This answer was a bit of a gamble anyway, because the actual solution is based on a regex I announced to be the shortest known Fibonacci-testing regex in chat a few months ago. Luckily, no one seemed to remember that. :)

\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$
    – feersum
    Commented Aug 7, 2016 at 15:24
12
\$\begingroup\$

Stack Cats, 14 bytes, score = 13 / 14 = 0.929 [cracked]

That's 10 bytes of code, plus 4 for the arguments -nm.

Computes A017053. In case OEIS is down, that's a(n) = 7n + 6, starting at n = 0.

![_-_:-_-_

The full code (usable without -m argument) is ![_-_:-_-_-_-:_-_]!

The hidden solution was

!]|{_+:}_
\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Sp3000
    Commented Aug 15, 2016 at 22:03
11
\$\begingroup\$

Hexagony, 91 bytes, Score = 0.725274725 (66/91) [Cracked]

Computes A000045 (Fibonacci sequence, offset 0).

I won't be too surprised if someone manages to beat this and my more golfed version, although it should be hard.

Edit: Holy cow, @MartinEnder whipped me with a 33 byte solution.

Golfed (91):

?\]~<~.{>'"/(@{\''1<{!1>{{1}/}{'\1</={}/_\'0"/>+(}\/}(+'+'%=<>=%"=+("\/+"(+}+<>{{}=~\.....|

Formatted:

      ? \ ] ~ < ~
     . { > ' " / (
    @ { \ ' ' 1 < {
   ! 1 > { { 1 } / }
  { ' \ 1 < / = { } /
 _ \ ' 0 " / > + ( } \
  / } ( + ' + ' % = <
   > = % " = + ( " \
    / + " ( + } + <
     > { { } = ~ \
      . . . . . |

Try it online!

I'm not going to post an explanation for this, it's too horrible...

Golfed (66):

?{1}]0@._.>\>+{./'++.!.|.*'}..\}{\=++.../'"<_}\"+<./{(/\=*"=/>{=+"

Formatted:

      ? { 1 } ] 0
     @ . _ . > \ >
    + { . / ' + + .
   ! . | . * ' } . .
  \ } { \ = + + . . .
 / ' " < _ } \ " + < .
  / { ( / \ = * " = /
   > { = + " . . . .
    . . . . . . . .
     . . . . . . .
      . . . . . .

Colored:

Fibonacci sequence

Try it online!

Explanation:

The memory layout I used looks a little like this:

   |
   a
   |
  / \
b+a  b
/     \
      |
    input

The initialization (in black) sets a=0 and b=1. Then, the main loop:

  • goes from a to the input cell - '"
  • decrements the input - (
  • adds b and a - {{=+
  • moves it "out of the way" - "+{=*
  • sets a to b - '+
  • moves a "out of the way" - '+}=*
  • moves b+a back to its original position - "=+
  • sets b to b+a - "+
  • moves a back to its original position - }+

Once the input cell reaches 0, the MP moves to a, prints, and exits.

What I could have done to save more bytes is to use &, which just sets the current cell to either its left or right neighbor. I also could have had a bit better flow control, but it's okay as it stands.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Cracked. Thanks for getting me to write a Fibonacci program. Not sure why I haven't done that before. :) \$\endgroup\$ Commented Aug 7, 2016 at 19:38
  • \$\begingroup\$ Actually, what I'm using & for is to move the input around the a/b/a+b edges so that they swap their roles on the next iteration. That I way, I don't need to move a, b and a+b around at all. \$\endgroup\$ Commented Aug 7, 2016 at 21:47
  • \$\begingroup\$ @MartinEnder Sorry, I wrote that part before looking at what your program actually did. Your solution is much more clever \$\endgroup\$
    – Blue
    Commented Aug 7, 2016 at 21:50
10
\$\begingroup\$

M, 10 bytes, score 0.6 (6 / 10) [cracked]

R‘ạḤc’*@RP

A tad cheaty since M and Jelly are quite similar, but allowed by the rules. This version is based on @LeakyNun's crack to my Jelly answer.

This calculates sequence A068943. Try it online!

Intended solution

The following code works in M/Jelly.

R¹¡PÐL

I actually had a 4-byte solution to which I added some fluff to make it seem more difficult to crack by using brute force.

R¡FP

Try it online!

This is the one I'm going to explain.

R¡FP  Main link. Argument: n

 ¡    Execute the left to the left n times, updating the return value.
R       Range; map each integer k to [1, ..., k].
      This does the following for the first values of n.
        1 → [1]
        2 → [1,2]   → [[1],[1,2]]
        3 → [1,2,3] → [[1],[1,2],[1,2,3]] → [[[1]],[[1],[1,2]],[[1],[1,2],[1,2,3]]]
  F   Flatten the resulting, nested array.
   P  Take the product of the reulting array of integers.
\$\endgroup\$
1
  • \$\begingroup\$ Cracked! It was fun! \$\endgroup\$
    – miles
    Commented Aug 7, 2016 at 10:00
7
\$\begingroup\$

Snowman, 50 bytes, score = 0.9 (45 / 50) [cracked by Lynn]

((}#NDe`nOnO|`2nMNdE0nR2aGaZ::nM;aF;aM:nS;aF,nM*))

This is a subroutine that takes a number as its argument and returns another number.

Computes A122649 (offset = 1).

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ What is the calling convention for so-called "subroutines"? \$\endgroup\$
    – feersum
    Commented Aug 10, 2016 at 14:19
  • \$\begingroup\$ Cracked! \$\endgroup\$
    – lynn
    Commented Aug 10, 2016 at 14:37
7
\$\begingroup\$

Haskell, 15 bytes, score = 13/15 (0.866) (cracked)

f x=1+2*div x 2

A109613 with offset 0. Repeats each odd number twice.

1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, ...
\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$
    – feersum
    Commented Sep 7, 2016 at 23:29
6
\$\begingroup\$

Brachylog, 27 bytes, score = 0.666... (18/27), Cracked!

+ybL:L:[1]co~c[A:B]hl-?,A*.

Computes A010551 (offset = 0).

You can try it online here.

Explanation

Since the vast majority of people don't know this language, and since I'm posting this answer mostly to get people looking into it (See: Brachylog's Wiki), I'll provide a short explanation of the code above:

+           Add 1 to the input N
ybL         L = [1, 2, ..., N+1]
:L:[1]c     Construct a list [1, 2, ..., N+1, 1, 2, ..., N+1, 1]
o           Sort the list from smallest to biggest
~c[A:B]     A concatenated to B results in that sorted list
hl-?,       The length of A is N + 1
A*.         The output is the result of the product of all elements of A
\$\endgroup\$
1
  • \$\begingroup\$ Cracked! \$\endgroup\$
    – Leaky Nun
    Commented Aug 6, 2016 at 18:30
6
\$\begingroup\$

Haskell, 4 bytes / 5 bytes (cracked by Leaky Nun)

Let's start simple. A000012, the sequence of all 1's (offset 0). Here's a table:

0 -> 1
1 -> 1
2 -> 1
3 -> 1
4 -> 1
 ...

5 bytes:

f n=1
\$\endgroup\$
1
  • \$\begingroup\$ Cracked! \$\endgroup\$
    – Leaky Nun
    Commented Aug 7, 2016 at 2:18
6
\$\begingroup\$

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 :)

\$\endgroup\$
1
  • \$\begingroup\$ Cracked! \$\endgroup\$
    – miles
    Commented Aug 7, 2016 at 14:25
5
\$\begingroup\$

Cheddar, 7 bytes, score = 0.8571 (6/7), [cracked]

n->2**n

Pretty simple, just the powers of two. OEIS A000079

Try it online!

\$\endgroup\$
6
  • 2
    \$\begingroup\$ Uh, language creators are at an advantage here... \$\endgroup\$
    – Dennis
    Commented Aug 7, 2016 at 4:05
  • 10
    \$\begingroup\$ Especially language creators whose languages are sorely lacking in documentation. \$\endgroup\$
    – user45941
    Commented Aug 7, 2016 at 4:07
  • \$\begingroup\$ Cracked (?) \$\endgroup\$
    – feersum
    Commented Aug 7, 2016 at 4:11
  • 2
    \$\begingroup\$ @Mego is self documenting code not considered docs? The code reviewers lied to me! D:< \$\endgroup\$
    – Downgoat
    Commented Aug 7, 2016 at 5:08
  • 1
    \$\begingroup\$ @Downgoat When you have a link on your website called "Documentation" and it's woefully incomplete... Yeah. \$\endgroup\$
    – user45941
    Commented Aug 7, 2016 at 5:09
4
\$\begingroup\$

J, 17 bytes, score = 0.8235 (14/17) (cracked)

(+/@(!+:)&i.-)@>:

Computes A002478.

The funny thing is that this version was originally the short one to be kept secret.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Cracked! \$\endgroup\$
    – randomra
    Commented Aug 6, 2016 at 20:36
4
\$\begingroup\$

Python 2, 43 bytes, score = 0.9302 (40/43), cracked

f=lambda n:n==1or-(-sum(map(f,range(n)))/3)

Computes A072493

Let's see if anybody can golf off all 3 bytes.

\$\endgroup\$
4
  • \$\begingroup\$ Wait, is it really okay if True is used to represent 1? \$\endgroup\$
    – R. Kap
    Commented Aug 6, 2016 at 18:37
  • \$\begingroup\$ Cracked \$\endgroup\$
    – feersum
    Commented Aug 6, 2016 at 18:39
  • \$\begingroup\$ s=1;exec"a=-(-s/3);s+=a;"*input();print a for 41. \$\endgroup\$
    – orlp
    Commented Aug 6, 2016 at 18:47
  • \$\begingroup\$ @R.Kap yes, it is. Any value that is truthy (if x is true) is a valid return. \$\endgroup\$
    – Riker
    Commented Aug 6, 2016 at 21:40
4
\$\begingroup\$

Pyke, 11 bytes, score = 0.45 (5/11) [cracked]

hZRVoeX*oe+

Calculates OEIS A180255

Try it here!

\$\endgroup\$
6
  • 1
    \$\begingroup\$ I wanted to have a go at this one but the documentation for the language isn't very enlightening. (e.g. Z is undocumented; the language claims to be stack-based but after the * there are only zeros on the stack despite it having an effect on the rest of the code; order of parameters is not clearly specified) \$\endgroup\$ Commented Aug 6, 2016 at 16:46
  • 1
    \$\begingroup\$ @Score_Under what could I do to improve it? - Perfectly happy to discuss in a chat room about what's unclear \$\endgroup\$
    – Blue
    Commented Aug 6, 2016 at 16:47
  • \$\begingroup\$ Sure. I don't know how to start a chat but I've edited my above comment with some examples - I thought I'd be able to get it in before you read it ;) \$\endgroup\$ Commented Aug 6, 2016 at 16:50
  • 1
    \$\begingroup\$ @Score_Under chat.stackexchange.com/rooms/43566/pyke-language \$\endgroup\$
    – Blue
    Commented Aug 6, 2016 at 16:52
  • 2
    \$\begingroup\$ Cracked. \$\endgroup\$
    – Dennis
    Commented Aug 8, 2016 at 4:30
4
\$\begingroup\$

Jelly, 9 bytes, score 0.5556 (5 / 9) [cracked]

r©0+’Ac®Ḅ

This calculates sequence A119259. Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Cracked, but barely. \$\endgroup\$
    – miles
    Commented Aug 9, 2016 at 8:40
4
\$\begingroup\$

Brachylog, 11 bytes, score = 10 / 11 = 0.909, cracked!

ybLrb:Lrcc.

Computes A173426.

Try it online!

Explanation

ybL      L = [1, 2, …, Input]
rb       Get [Input - 1, …, 2, 1]
:Lrc     Concatenate [1, 2, …, Input] and [Input - 1, …, 2, 1]
c.       Concatenate [1, 2, …, Input, Input - 1, …, 2, 1] into a single integer
\$\endgroup\$
1
  • \$\begingroup\$ Cracked! \$\endgroup\$
    – Leaky Nun
    Commented Aug 10, 2016 at 7:51
4
\$\begingroup\$

J, 20 bytes, score = 0.75 (15/20) (cracked)

[:*/0 1(]{:,+/)^:[~]

Computes A001654.

My solution for 15 bytes was

*&(+/@:!&i.-)>:
\$\endgroup\$
1
  • \$\begingroup\$ cracked \$\endgroup\$
    – Dennis
    Commented Aug 20, 2016 at 5:06
3
\$\begingroup\$

Sesos, 14 bytes, score = 0.8571 (12/14) (cracked)

0000000: 16f8be 760e1e 7c5f3b 07ddc7 ce3f                  ...v..|_;....?

Computes A000290.

Try it online!

Hints

This binary file has been generated by the following assembler:

set numin
set numout
get
jmp,sub 1,fwd 1,add 1,fwd 1,add 1,rwd 2,jnz
fwd 1
jmp
  sub 1,fwd 1
  jmp,sub 1,fwd 1,add 1,fwd 1,add 1,rwd 2,jnz
  fwd 1
  jmp,sub 1,rwd 1,add 1,fwd 1,jnz
  rwd 2
jnz
fwd 3
put
\$\endgroup\$
1
  • \$\begingroup\$ Cracked! \$\endgroup\$
    – lynn
    Commented Aug 6, 2016 at 11:30
3
\$\begingroup\$

MATL, 11 bytes, score = 0.8181 (9/11), cracked

YftdA-1bn^*

Computes the Möbius function, or A087811 (offset 1).

Try it online!

Resources for robbers

I think this one should be easy, but anyway here is some help.

Code explanation:

Yf     % Implicit input. Push array of prime factors, with repetitions
t      % Duplicate
d      % Compute consecutive differences
A      % 1 if all those differences are nonzero, 0 otherwise
-1     % Push -1
b      % Bubble up array of prime factors to the top of the stack
n      % Number of elements
^      % -1 raised to that
*      % Multiply. Implicitly display

Language documentation.

MATL chatroom.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$
    – feersum
    Commented Aug 6, 2016 at 21:01
  • \$\begingroup\$ @feersum Well done! For reference, the 9-byte version was YftdA_wn^ \$\endgroup\$
    – Luis Mendo
    Commented Aug 7, 2016 at 2:51
3
\$\begingroup\$

Jelly, 11 bytes, score 0.5455 (6 / 11) [cracked]

Ḷ+’cḶ
r1*ÇP

This calculates sequence A068943. Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Leaky Nun
    Commented Aug 7, 2016 at 6:33
3
\$\begingroup\$

MarioLANG, 87 bytes, score = 0.839 (73/87), cracked

;
)-)+(< >>
-)===" ""====
>>+([!)( >-(+(
"====#[(("== [
!-) - <!!![)<<)
#======###====:

Computes A000217, the triangular numbers. Offset 0.

Try it online!

Short Solution:

Since the crack took only 1 byte off, I'll share my solution in 73 bytes, which uses a different algorithm altogether:

;   +)-<
-   (=="
+)-<(
(=="+
> [!>)[!(
"==#===#[
!    -  <))
#=========:

Try it online!

The first program lays out all the numbers from n to 1 along the tape, then adds up all numbers until it comes across a 0-value cell. It does this by copying each cell into the two adjacent cells, decrementing the right copy, and repeating the process on it until it reaches 0. During this process, the tape looks like this (for n=5):

0 0 5 0 0 0 0
0 5 0 5 0 0 0
0 5 0 4 0 0 0
0 5 4 0 4 0 0
0 5 4 0 3 0 0
0 5 4 3 0 3 0
0 5 4 3 0 2 0
0 5 4 3 2 0 2

... and so on. Then it moves left, summing the cells until it reaches a cell with 0.

The second program only works with three cells of the tape. Until the first cell reaches 0, it does the following:

  • Move the value of the first cell to the second cell.
  • Decrement the second cell to 0, adding its own value to the first and third cells.
  • Decrement the first cell.

After the first cell reaches 0, the third cell will contain n + (n-1) + (n-2) + ... + 2 + 1.

\$\endgroup\$
4
  • \$\begingroup\$ Does your 87 byte version work in another interpreter? The one on Tio! seems to require a trailing newline... \$\endgroup\$
    – Dennis
    Commented Aug 8, 2016 at 20:57
  • \$\begingroup\$ @Dennis: It does work on the Ruby interpreter without the newline. For whatever reason, the interpreter on TIO won't output from a : if it's on the bottom line, which is why I included the trailing newline in the link. Martin and I discussed this in another one of my MarioLANG answers. \$\endgroup\$ Commented Aug 9, 2016 at 2:03
  • \$\begingroup\$ OK, just checking. I've added wrapper for Tio! that appends a newline to the source code. \$\endgroup\$
    – Dennis
    Commented Aug 9, 2016 at 2:13
  • \$\begingroup\$ cracked I think (not sure though) \$\endgroup\$ Commented Aug 9, 2016 at 3:30
3
\$\begingroup\$

M, 18 bytes, score 0.3889 (7 / 18) [cracked]

r0+c
‘Ḥc0r$×Ç:‘+\S

This approach is based on @Sp3000's golf of my Jelly answer.

The code calculates sequence A116881 (row sums of CM(1,2)). Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$
    – feersum
    Commented Aug 21, 2016 at 16:14
3
\$\begingroup\$

Haskell, 28 bytes, score = 0.3571 (10/28), cracked

f n|odd n=1|1>0=2*f(div n 2)

A006519, the highest power of 2 dividing n, starting at n=1.

1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 16, 1, ...

While you get cracking credit for any shorter code, I consider the real puzzle to be getting down to 10 bytes.

\$\endgroup\$
2
  • \$\begingroup\$ my try. \$\endgroup\$
    – nimi
    Commented Oct 22, 2016 at 23:12
  • \$\begingroup\$ @nimi Congrats, you got it. \$\endgroup\$
    – xnor
    Commented Oct 22, 2016 at 23:12
2
\$\begingroup\$

05AB1E, 9 bytes, score = 0.6667 (6/9), Cracked

ÐnŠ·sÉO4/

Computes: A087811

Try it online

\$\endgroup\$
1
  • \$\begingroup\$ Cracked! \$\endgroup\$
    – Leaky Nun
    Commented Aug 6, 2016 at 13:27
2
\$\begingroup\$

Hexagony, 7 bytes, score = 0.857 (6/7), cracked

Not designed to be the winning submission, but definitely a brain cracker. It actually isn't that hard if you think about it :p. Code:

\!?__@(

Or a more readable version:

 \ !
? _ _
 @ (

Computes A052246.

Try it online!.

\$\endgroup\$
1
2
\$\begingroup\$

J, 9 bytes, score = 0.6667 (6/9) (cracked by Dennis)

9 o.0j1^]

Computes A056594.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Cracked. \$\endgroup\$
    – Dennis
    Commented Aug 7, 2016 at 4:18
  • \$\begingroup\$ @Dennis dang, you beat me to it. \$\endgroup\$ Commented Aug 7, 2016 at 4:28
2
\$\begingroup\$

J, 10 bytes, score = 0.9 (9/10) (cracked by Dennis)

*2%~3<:@*]

Computes A000326.

This one should be easy.

Online interpreter.

Quickref.

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – Dennis
    Commented Aug 7, 2016 at 4:24
2
\$\begingroup\$

05AB1E, 7 bytes, score = 0.571 (4/7), Cracked

0s·Ì3c;

Computes: A006331

Try it online

After golfing 5 unique versions of this sequence before finding this public version I hope I haven't left any obvious improvement out there so it'll at least be a challenge for the robbers.

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – alephalpha
    Commented Aug 8, 2016 at 12:51
2
\$\begingroup\$

M, 9 bytes, score 0.6667 (6 / 9) [cracked]

r©0+’Ac®Ḅ

A tad cheaty since M and Jelly are quite similar, but allowed by the rules. @miles' crack to my Jelly answer doesn't work in M; it lacks the œċ atom.

This calculates sequence A119259. Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Cracked \$\endgroup\$
    – feersum
    Commented Aug 14, 2016 at 3:00
  • \$\begingroup\$ I had started to hope this one would survive... Well done. \$\endgroup\$
    – Dennis
    Commented Aug 14, 2016 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.