Can you outgolf me? (Cops section)

84

13

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.

Adnan

Posted 2016-08-06T10:27:50.090

Reputation: 41 965

Do I understand the rules right that if I come up with a 30-byte program and post a 40-byte program, someone who writes a 39-byte program couns as cracking it? – xnor – 2016-08-06T11:01:24.603

@xnor Yes, that is correct – Adnan – 2016-08-06T11:02:01.513

2@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. – xnor – 2016-08-06T11:07:38.293

4@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. – Adnan – 2016-08-06T11:12:58.757

3@Adnan You could solve that by defining score = len(secret code)/min {len(public code), len(shortest code posted by robbers)}. – Anders Kaseorg – 2016-08-06T12:22:09.823

1@AndersKaseorg The score doesn't count if a robber has cracked your submission. – Adnan – 2016-08-06T12:25:38.987

3@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. – Anders Kaseorg – 2016-08-06T12:43:59.170

If someone cracks my submission, but hasn't found the shortest possible program (the intended solution), can I update the post with a shorter version? – xsot – 2016-08-06T14:12:49.477

@xsot I'm going to say no, because that would fall under the last rule of the challenge. – Adnan – 2016-08-06T14:28:44.317

@AndersKaseorg I'm pretty sure that goes against the rules of a [tag:cops-and-robbers] challenge. That means that you can easily win the challenge by simply submitting a lot of entries. – Adnan – 2016-08-06T14:32:27.913

3Yeah, finally another Cooooops and Rooooobbbbbers challenge. – insertusernamehere – 2016-08-06T20:41:59.860

If you can golf it any further (public or a secret) could you change the answer? – Blue – 2016-08-07T08:34:01.800

@muddyfish In chat, we have decided that you can golf your private answer before you reveal it. Your public answer must remain the same. – Adnan – 2016-08-07T09:23:12.867

@DerpfacePython For all terms given at OEIS when you press on list after the sequence. (Like this)

– Adnan – 2016-08-08T11:46:38.617

Would it be acceptable to use my new language, Woefully?

– Destructible Lemon – 2016-09-07T06:18:25.857

@DestructibleWatermelon You can use it, however it won't be competing since the language postdates the challenge. – Adnan – 2016-09-07T07:29:54.070

._. well, does the person who cracks it get points? – Destructible Lemon – 2016-09-07T07:30:45.460

@DestructibleWatermelon Yes, the cracker does receive the points. – Adnan – 2016-09-07T07:31:28.057

Answers

36

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

feersum

Posted 2016-08-06T10:27:50.090

Reputation: 29 566

8This would take centuries to crack o_____O – TuxCrafting – 2016-11-04T20:55:34.890

4The Right Language for the Challenge – DLosc – 2016-11-11T23:02:00.827

26

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!

George V. Williams

Posted 2016-08-06T10:27:50.090

Reputation: 477

4Welcome to Programming Puzzles and Code Golf! – Adnan – 2016-08-07T15:41:46.907

2Just out of curiosity, is this actually possible in 4 bytes? I've been stuck on this for hours :p. – Adnan – 2016-08-07T21:59:42.073

1@Adnan, yes it's possible. Glad to hear you're finding it challenging! – George V. Williams – 2016-08-07T22:16:16.753

Cracked. – jimmy23013 – 2016-08-08T01:10:23.567

@jimmy23013, yup, nicely done! – George V. Williams – 2016-08-08T01:14:39.730

12

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

Martin Ender

Posted 2016-08-06T10:27:50.090

Reputation: 184 808

Cracked – feersum – 2016-08-07T15:24:30.090

11

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.

Blue

Posted 2016-08-06T10:27:50.090

Reputation: 1 986

1Cracked. Thanks for getting me to write a Fibonacci program. Not sure why I haven't done that before. :) – Martin Ender – 2016-08-07T19:38:10.043

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. – Martin Ender – 2016-08-07T21:47:56.713

@MartinEnder Sorry, I wrote that part before looking at what your program actually did. Your solution is much more clever – Blue – 2016-08-07T21:50:16.387

10

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.

Dennis

Posted 2016-08-06T10:27:50.090

Reputation: 196 637

Cracked! It was fun! – miles – 2016-08-07T10:00:11.407

10

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

!]|{_+:}_

feersum

Posted 2016-08-06T10:27:50.090

Reputation: 29 566

Cracked – Sp3000 – 2016-08-15T22:03:59.793

7

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!

Doorknob

Posted 2016-08-06T10:27:50.090

Reputation: 68 138

What is the calling convention for so-called "subroutines"? – feersum – 2016-08-10T14:19:48.567

Cracked! – Lynn – 2016-08-10T14:37:22.417

7

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, ...

xnor

Posted 2016-08-06T10:27:50.090

Reputation: 115 687

Cracked – feersum – 2016-09-07T23:29:52.857

6

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

Fatalize

Posted 2016-08-06T10:27:50.090

Reputation: 32 976

Cracked! – Leaky Nun – 2016-08-06T18:30:42.977

6

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

xnor

Posted 2016-08-06T10:27:50.090

Reputation: 115 687

Cracked! – Leaky Nun – 2016-08-07T02:18:32.520

6

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

JollyJoker

Posted 2016-08-06T10:27:50.090

Reputation: 381

Cracked! – miles – 2016-08-07T14:25:15.367

5

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

n->2**n

Pretty simple, just the powers of two. OEIS A000079

Try it online!

Downgoat

Posted 2016-08-06T10:27:50.090

Reputation: 27 116

2Uh, language creators are at an advantage here... – Dennis – 2016-08-07T04:05:47.450

10Especially language creators whose languages are sorely lacking in documentation. – Mego – 2016-08-07T04:07:52.900

Cracked (?) – feersum – 2016-08-07T04:11:21.563

2@Mego is self documenting code not considered docs? The code reviewers lied to me! D:< – Downgoat – 2016-08-07T05:08:45.593

1@Downgoat When you have a link on your website called "Documentation" and it's woefully incomplete... Yeah. – Mego – 2016-08-07T05:09:25.940

@feersum yup, nice! – Downgoat – 2016-08-07T05:13:16.537

4

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.

miles

Posted 2016-08-06T10:27:50.090

Reputation: 15 654

1Cracked! – randomra – 2016-08-06T20:36:22.647

4

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

hZRVoeX*oe+

Calculates OEIS A180255

Try it here!

Blue

Posted 2016-08-06T10:27:50.090

Reputation: 26 661

1I 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) – Score_Under – 2016-08-06T16:46:25.060

1@Score_Under what could I do to improve it? - Perfectly happy to discuss in a chat room about what's unclear – Blue – 2016-08-06T16:47:30.217

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 ;) – Score_Under – 2016-08-06T16:50:54.847

1

@Score_Under http://chat.stackexchange.com/rooms/43566/pyke-language

– Blue – 2016-08-06T16:52:33.323

To anyone else reading, I'll be happy to respond to queries about the language in that chat room (but only when I'm awake) – Blue – 2016-08-06T18:13:33.073

2Cracked. – Dennis – 2016-08-08T04:30:45.403

4

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.

xsot

Posted 2016-08-06T10:27:50.090

Reputation: 5 069

Wait, is it really okay if True is used to represent 1? – R. Kap – 2016-08-06T18:37:49.793

Cracked – feersum – 2016-08-06T18:39:37.653

s=1;exec"a=-(-s/3);s+=a;"*input();print a for 41. – orlp – 2016-08-06T18:47:41.757

@R.Kap yes, it is. Any value that is truthy (if x is true) is a valid return. – Rɪᴋᴇʀ – 2016-08-06T21:40:10.480

4

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

r©0+’Ac®Ḅ

This calculates sequence A119259. Try it online!

Dennis

Posted 2016-08-06T10:27:50.090

Reputation: 196 637

Cracked, but barely. – miles – 2016-08-09T08:40:12.043

4

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

Fatalize

Posted 2016-08-06T10:27:50.090

Reputation: 32 976

Cracked! – Leaky Nun – 2016-08-10T07:51:43.757

4

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

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

Computes A001654.

My solution for 15 bytes was

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

miles

Posted 2016-08-06T10:27:50.090

Reputation: 15 654

cracked – Dennis – 2016-08-20T05:06:43.983

3

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

Leaky Nun

Posted 2016-08-06T10:27:50.090

Reputation: 45 011

Cracked! – Lynn – 2016-08-06T11:30:05.950

3

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.

Luis Mendo

Posted 2016-08-06T10:27:50.090

Reputation: 87 464

1Cracked – feersum – 2016-08-06T21:01:53.363

@feersum Well done! For reference, the 9-byte version was YftdA_wn^

– Luis Mendo – 2016-08-07T02:51:45.380

3

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

Ḷ+’cḶ
r1*ÇP

This calculates sequence A068943. Try it online!

Dennis

Posted 2016-08-06T10:27:50.090

Reputation: 196 637

Cracked – Leaky Nun – 2016-08-07T06:33:09.693

3

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.

Business Cat

Posted 2016-08-06T10:27:50.090

Reputation: 8 927

Does your 87 byte version work in another interpreter? The one on Tio! seems to require a trailing newline... – Dennis – 2016-08-08T20:57:09.697

@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. – Business Cat – 2016-08-09T02:03:21.003

OK, just checking. I've added wrapper for Tio! that appends a newline to the source code. – Dennis – 2016-08-09T02:13:55.690

cracked I think (not sure though) – Destructible Lemon – 2016-08-09T03:30:19.157

3

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!

Dennis

Posted 2016-08-06T10:27:50.090

Reputation: 196 637

Cracked – feersum – 2016-08-21T16:14:05.333

3

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.

xnor

Posted 2016-08-06T10:27:50.090

Reputation: 115 687

my try. – nimi – 2016-10-22T23:12:11.380

@nimi Congrats, you got it. – xnor – 2016-10-22T23:12:54.113

2

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

ÐnŠ·sÉO4/

Computes: A087811

Try it online

Emigna

Posted 2016-08-06T10:27:50.090

Reputation: 50 798

Cracked! – Leaky Nun – 2016-08-06T13:27:39.720

2

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!.

Adnan

Posted 2016-08-06T10:27:50.090

Reputation: 41 965

Cracked, – Martin Ender – 2016-08-06T15:27:11.960

2

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

*2%~3<:@*]

Computes A000326.

This one should be easy.

Online interpreter.

Quickref.

Leaky Nun

Posted 2016-08-06T10:27:50.090

Reputation: 45 011

Cracked. – Dennis – 2016-08-07T04:24:02.967

2

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

9 o.0j1^]

Computes A056594.

Leaky Nun

Posted 2016-08-06T10:27:50.090

Reputation: 45 011

1Cracked. – Dennis – 2016-08-07T04:18:54.387

@Dennis dang, you beat me to it. – Conor O'Brien – 2016-08-07T04:28:35.837

2

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.

Emigna

Posted 2016-08-06T10:27:50.090

Reputation: 50 798

Cracked. – alephalpha – 2016-08-08T12:51:24.993

2

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!

Dennis

Posted 2016-08-06T10:27:50.090

Reputation: 196 637

Cracked – feersum – 2016-08-14T03:00:53.850

I had started to hope this one would survive... Well done. – Dennis – 2016-08-14T03:08:54.580

2

QBasic (QB64), 30 bytes, score = 28 / 30 = 0.9333 (cracked)

INPUT n:p=n MOD 2:?p*n+(n+p)/2

Computes A014682, a version of the Collatz function (offset 0).

This works on the QB64 emulator with autoformatting turned off. It should work on actual QBasic as well, but I don't have a copy to test it.


My 28-byte version used a bitwise operator and integer division:

INPUT n:?(1AND n)*n+(n+.5)\2

DLosc

Posted 2016-08-06T10:27:50.090

Reputation: 21 213

Cracked – feersum – 2016-08-19T20:32:50.297

So "integer division" is floating-point division followed by round to nearest? Funny :) – feersum – 2016-08-19T21:04:17.340

@feersum Even curiouser, actually: it appears to be round to nearest followed by integer division. For example, 1.4\2 gives 0, but 1.6\2 gives 1. I can't confirm whether that's how it works in actual QBasic or if it's a QB64 quirk, but it's weird, in any case. ... Which just made me realize that I could have used 1 instead of .5, for 27 bytes. D'oh! – DLosc – 2016-08-19T21:49:53.890

2

Acc!!, 526 bytes, score = 0.5627 (296/526) (cracked)

N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60
Count i while _/27^i {
_+27^i*(_/27^i*26-18)
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3^(1+i%2)
Count k while _/3^(3*k+1+i%2)%3-1 {
_+3^(3*k+1+i%2)*26
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_+_/100^i*100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Computes A000204, Lucas numbers with offset 1.

A couple of notes. Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:

> python acc.py Program.txt
5.
11

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 14 (takes 60 seconds on my laptop). However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.

Have fun!

DLosc

Posted 2016-08-06T10:27:50.090

Reputation: 21 213

cracked (barely) – Dennis – 2016-08-20T17:59:51.967

2

Python, 46 bytes, score = 0.97826 (45 / 46) [cracked]

f=lambda n,k=1:n and-~f(n-("01"in bin(k)),k+1)

Calculates A101082 (offset = 1), which are:

Numbers n such that binary representation contains bit strings "10" and "01" (possibly overlapping).


@Dennis cracked the submission as intended, which was to replace "01"in bin(k) with some bit twiddling, namely (k&-k)+k&k>0, to check that k's binary representation isn't of the form 111...111000...000.

Sp3000

Posted 2016-08-06T10:27:50.090

Reputation: 58 729

cracked – Dennis – 2016-08-21T07:56:24.430

2

Acc!!, 512 bytes, score = 0.5625 (288 ÷ 512) (cracked)

Fourth try. Let's see how fast Dennis cracks this one. (Edit: 8 minutes, that's a record!)

N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/30
Count i while _/27^i {
_+(_/27^i*26-18)*27^i
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3+i%2*6
Count k while _/3^(3*k+1+i%2)%3-1 {
_+27^k*3^(i%2)*78
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+2-j {
_+(_%10-_/100^j%10)*(100^j-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Computes A002878, Lucas(2*n+1), offset = 0.

Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:

> python acc.py Program.txt
3.
29

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 7. However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.

DLosc

Posted 2016-08-06T10:27:50.090

Reputation: 21 213

cracked – Dennis – 2016-08-26T20:49:14.347

@Dennis Hey, fastest yet! – DLosc – 2016-08-26T20:52:48.877

2

Woefully, (noncompeting, but you still get points for cracking it), 520/776= ~0.67 Cracked by Feersum.

Computes A000042 (would compute repunits, but that one has 0 as first member)

Offset 1, zero indexed (0 outputs 1, 1 outputs 11, 2 outputs 111, etc.)

| |||||||| | |
|| |||||| |
||| |||| |
|||| || |
||||| || |
|||| |||| |
||| |||||| |
|| |||||||| |
| |||||||||| |
|| ||||||||| |
||| |||||||| |
|||||||||||| |
|||||||||||| |
|||||||||||| |
||||||||||| |
|||||||||| |
|||||||||| |
|||||||||| |
|||||||||| |
||||||||||| |
|||||||||||| |
||||||||||||| |
|||||||||||| |
||||||||||| |
|||||||||| |
||||||||| |
|||||||| |
||||||| |
|||||| |
||||| |
|||| |
||| |
|| |
|| |
|| |
| |
| |
| |
| |
| |
|| |
|| |
|| |
||| |
|||| |
||||| |
|||||| |
||||||| |
|||||||| |
||||||| |
|||||||| |
||||||||| |
|||||||||| |
||||||||||| |
|||||||||||| |
||||||||||||| |
|||||||||||| |
||||||||||| |
|||||||||| |
||||||||| |
|||||||| |
||||||| |
|||||| |
||||| |
|||| |
||| |
|| |
|| |
|| |
|| |
||| |
|||| |
||| |
|| |
| |
| |
| |
|| |
|| |
|| |
|| |

Try it online!


I like to think that my shorter solution was a pretty nice one.

| || || |
|| || |
||| || |
|||| || |
||||| || |
|||| |||| |
||| ||||| |
|| |||||| |
| ||||||| |
|| |||||| |
||| ||||| |
||| |||| |
|||| || |
||| ||| |
|| |||| |
| ||||| |
|||||||| |
||||||||| |
|||||||||| |
|||||||||| |
||||||||| |
|||||||| |
||||||| |
|||||| |
||||| |
||||| |
||||| |
|||| |
|||| |
|||| |
|||| |
|||| |
||| |
||| |
||| |
|||| |
|||| |
||||| |
||||| |
|||||| |
||||| |
|||| |
||| |
|| |
| |
| |
| |
| |
|| |
||| |
||| |
|||| |
||| |
|| |
| |
| |
| |
|| |
|| |
|| |
|| |
||| |
||| |
|||| |
||| |
|| |
| |

What I did was remove the push one command from the top, replace it at the bottom and at the end of the first command, which was free because I just had to replace some pipes, which then allowed me to shorten the push nine commands some more, because it didn't need to move that much anymore

Destructible Lemon

Posted 2016-08-06T10:27:50.090

Reputation: 5 908

This TIO link is way too long o_o – TuxCrafting – 2016-09-07T08:17:41.670

Cracked – feersum – 2016-09-08T02:08:25.290

2

J, 12 bytes, score = 0.9167 (11/12) (cracked)

(#++/)@I.@#:

Computes A230877.

miles

Posted 2016-08-06T10:27:50.090

Reputation: 15 654

Cracked – feersum – 2016-09-09T19:38:39.160

2

J, 18 bytes, score = 0.7222 (13/18) (cracked)

0{]1&(}.],+/)2 1"_

Computes the Lucas numbers, A000032.

miles

Posted 2016-08-06T10:27:50.090

Reputation: 15 654

Cracked – feersum – 2016-09-29T00:25:09.810

1

Sesos, 14 bytes, score = 0.6429 (9/14) (cracked)

0000000: aed40b b47bc2 8e01be 8e9ddb b107                  ....{.........

Computes A130909.

Try it online!

Leaky Nun

Posted 2016-08-06T10:27:50.090

Reputation: 45 011

Cracked again :> – Lynn – 2016-08-06T11:57:35.767

You need to include the score in the header of your submission. – R. Kap – 2016-08-06T12:01:46.610

1

Python 3.5, 38 bytes, Score = 0.86842 (33/38) (Cracked):

G=lambda n:n<1and 1or(2*n-1)**2*G(n-1)

Computes A001818.

Try It Online! (Ideone)

R. Kap

Posted 2016-08-06T10:27:50.090

Reputation: 4 730

Cracked – feersum – 2016-08-06T18:44:29.570

1

05AB1E, 10 bytes, score = 5 ÷ 10 = 0.5, cracked

This one isn't too hard actually :p. Code:

[NNÂʽ¾¹Q#

Computes the Nth non-palindromic number, which is A029742.

Try it online!

Adnan

Posted 2016-08-06T10:27:50.090

Reputation: 41 965

Cracked. – Lynn – 2016-08-07T18:58:09.657

1

JavaScript (ES6), 77 bytes, score = 0.9481 (73 / 77) [Cracked]

n=>eval("for(i=0;n;a||n--)[...s=a=++i+''].map(d=>a-=Math.pow(d,s.length));i")

Computes A005188, (offset = 1).


Didn't end up being super interesting but I thought I'd try and submit something.

Note: This is in ES6 so there is no ** operator. I just thought this would make it more cross-browser compatible and easier to test.

user81655

Posted 2016-08-06T10:27:50.090

Reputation: 10 181

Cracked – feersum – 2016-08-08T05:52:32.193

@feersum Lol, I should have spent more time golfing it! Evidently this is possible in 72 bytes... – user81655 – 2016-08-08T06:07:24.130

1

05AB1E, 13 bytes, score = 0.769 (10 ÷ 13), cracked

This one isn't too hard either. Code:

µN•vÉ•vyK}g_½

Calculates A001742 (offset = 1).

Try it online!.

Adnan

Posted 2016-08-06T10:27:50.090

Reputation: 41 965

Cracked. Gonna keep working on that 10 byte solution for a while. – Emigna – 2016-08-08T14:18:38.457

1

Python (3.4.3), 77 bytes, score = 0.7272 (56/77) cracked

import math;lambda x: 1 if x==0 else (0 if ((math.sqrt(1+8*x)-1)/2)%1 else 1)

Computes A010054, offset = 0

Joe

Posted 2016-08-06T10:27:50.090

Reputation: 281

Cracked – feersum – 2016-08-08T18:28:06.973

1

Coffeescript, 83 bytes, score = 79/83 = 0.952 [cracked!]

r=(n)->return if r<0 then 0 else Array(parseInt(n/9)+2).join ((n-1)%9+1).toString()

Computes A010785.

(Not so) Surprisingly, @DomHastings managed to shave 33 bytes off of my solution.

Wow, I suck at , don't I? Well, here's my other code:

r=(n)->return if r<0 then 0 else ((n-1)%9+1).toString().repeat(parseInt(n/9)+2)

Here's a less messy version of the code:

r=(n)->
  if r<0
   return 0 
  else 
   ((n-1)%9+1).toString().repeat(parseInt(n/9)+2)
   # ((n-1)%9+1).toString() is the repeating digit (as a string).
   # parseInt(n/9)+2 is the times the digit is repeated.

clismique

Posted 2016-08-06T10:27:50.090

Reputation: 6 600

Cracked. – Dom Hastings – 2016-08-09T11:42:58.970

1

Pip, 24 bytes, score = 22 / 24 = 0.9166 (cracked)

Y53T++i>ay.:k.A(yi)A(ya)

Computes A109648 (offset = 0). Try it online!


My 22-byte version:

T++v>alPB A(lJk|5v)l@a

DLosc

Posted 2016-08-06T10:27:50.090

Reputation: 21 213

Cracked – feersum – 2016-08-19T22:21:07.143

1

Actually, 28 bytes, Score = 0.39285714 (11/28) (cracked)

2√;;4*;u@D))u(*,;)@ⁿ)1-*ⁿ@-½

Computes A048696 (offset = 0). Actually uses CP437 for its encoding.

Try it online!

Dennis's solution is actually almost identical to mine:

19,`;τ(+`nX (Dennis)
19(`;)τ+`nX (Mine)

A Levenshtein distance of 3 is pretty impressive!

Try it online!

Mego

Posted 2016-08-06T10:27:50.090

Reputation: 32 998

cracked – Dennis – 2016-08-14T22:25:07.560

1

Jelly, 22 bytes, score 0.2727 (6 / 22) [cracked]

‘ðḤ;+;c2\×P:+’×$¥µÐ€‘S

This calculates sequence A116881. Try it online!

Dennis

Posted 2016-08-06T10:27:50.090

Reputation: 196 637

Cracked – feersum – 2016-08-19T18:35:35.037

1

05AB1E, 7 bytes, score = 0.857 (6 / 7) [cracked]

This one shouldn't be too hard if you think about it :p. Code:

L!zO¹!*

Try it online!

Computes A002627.

Adnan

Posted 2016-08-06T10:27:50.090

Reputation: 41 965

Cracked – Emigna – 2016-08-20T20:40:29.177

1

Acc!!, 523 bytes, score = 0.55067 (288/523) (cracked)

Second try, slightly different sequence.

N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60
Count i while _/27^i {
_+27^i*(_/27^i*26-18)
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3^(1+i%2)
Count k while _/3^(3*k+1+i%2)%3-1 {
_+3^(3*k+1+i%2)*26
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Computes A000032, Lucas numbers with offset 0.

Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:

> python acc.py Program.txt
5.
11

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 14 (takes 60 seconds on my laptop). However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.

DLosc

Posted 2016-08-06T10:27:50.090

Reputation: 21 213

cracked – Dennis – 2016-08-21T04:14:18.473

1

Acc!!, 522 bytes, score = 0.5555 (290 ÷ 522) (cracked)

Third try. Thanks to Dennis for the golfing "help" with the first two. ;^)

N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60*2
Count i while _/27^i {
_+(_/27^i*26-18)*27^i
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3+i%2*6
Count k while _/3^(3*k+1+i%2)%3-1 {
_+27^k*3^(i%2)*78
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Computes A005248, Lucas(2*n), offset = 0.

Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:

> python acc.py Program.txt
3.
18

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 7. However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.

DLosc

Posted 2016-08-06T10:27:50.090

Reputation: 21 213

cracked – Dennis – 2016-08-21T05:38:29.030

1

Excel, 16 bytes, score = 0.75, [cracked by Dennis♦]

=FACTDOUBLE(2*n)

Computes A000165: double factorial of even numbers, (offset = 0).

Anastasiya-Romanova 秀

Posted 2016-08-06T10:27:50.090

Reputation: 1 673

Cracked? – Dennis – 2016-08-21T08:09:48.493

This answer doesn't have the correct form -- it is not a program or a function. – feersum – 2016-08-21T14:22:59.353

@feersum By the definition here, it is a program

– Anastasiya-Romanova 秀 – 2016-08-21T14:30:27.187

See here. Input by inserting the number into the source code isn't an accepted input method.

– feersum – 2016-08-21T14:35:18.843

@feersum No need to insert the number into the code, but you can use name of reference cell n as an input – Anastasiya-Romanova 秀 – 2016-08-21T14:55:27.400

What do you mean? How do I specify the input? – feersum – 2016-08-21T14:57:45.927

1

@feersum Name the cell input as n. See this

– Anastasiya-Romanova 秀 – 2016-08-21T15:00:03.433

0

05AB1E - 1 byte - A000027

Code: I

05AB1E - 0 bytes - A000027

Code:

Explanation:

I means that it pushes the input to the stack.

means that nothing is changed to the stack, but the input was already added to the stack by default, so it prints out the input.

MilkyWay90

Posted 2016-08-06T10:27:50.090

Reputation: 2 264

Please note this challenge has been inactive for 2 years. – u_ndefined – 2018-10-14T11:22:52.417

Oh I thought that there was a proposal to revive old challenges – MilkyWay90 – 2018-10-14T13:52:32.303

0

Python, 39 bytes, 26/39=2/3=0.666 cont. points, cracked

s=lambda x:x+s(x-1)if x==1else x+s(x-1)

won't last long, but lets see just how long. Just doing the robbers a favour I guess (also because I don't know eso golf langs ;_;)

umm, I accidentally bad code but someone cracked my lower score so...

computes A000217

Destructible Lemon

Posted 2016-08-06T10:27:50.090

Reputation: 5 908

2How does this terminate if the then clause and the end clause are the same? – Leaky Nun – 2016-08-06T12:02:55.737

Which version of Python is this? – Leaky Nun – 2016-08-06T12:04:04.643

Cracked. – Leaky Nun – 2016-08-06T12:05:32.517

You need to include the score in the header :3. – Adnan – 2016-08-06T12:07:53.710

also o sh*t I did the wrong code :( – Destructible Lemon – 2016-08-06T12:15:50.610

0

Python, 69 bytes, score = 0.97 (67÷69), cracked

f=lambda n:reduce(lambda x,y:x*y,range(1,n+1),1)
lambda n:f(n*2)/f(n)

Computes A001813

TuxCrafting

Posted 2016-08-06T10:27:50.090

Reputation: 4 547

cracked – Dennis – 2016-08-09T19:28:51.080