Halloween Golf: The 2spooky4me Challenge!

42

3

A current internet meme is to type 2spooky4me, with a second person typing 3spooky5me, following the (n)spooky(n+2)me pattern.

Your mission is to implement this pattern in your chosen language. You should write a program or function that takes a value n (from standard input, as a function argument, or closest alternative), and outputs the string (n)spooky(n+2)me (without the parentheses; to standard output, as a return value for a function, or closest alternative).

Your solution should work for all inputs, from 1 up to 2 below your language's maximum representable integer value (2^32-3 for C on a 32-bit machine, for example).

Example implementation in Python:

def spooky(n):
    return "%dspooky%dme"%(n,n+2)

spooky(2) -> "2spooky4me"

This is , so standard loopholes are forbidden, and the shortest answer in bytes wins!

Leaderboard

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

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

## Language Name, N bytes

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

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

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

## Perl, 43 + 2 (-p flag) = 45 bytes

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

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

<style>body { text-align: left !important} #answer-list { padding: 10px; width: 290px; float: left; } #language-list { padding: 10px; width: 290px; float: left; } table thead { font-weight: bold; } table td { padding: 5px; }</style><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="language-list"> <h2>Shortest Solution by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr> </thead> <tbody id="languages"> </tbody> </table> </div> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr> </thead> <tbody id="answers"> </tbody> </table> </div> <table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table><script>var QUESTION_ID = 62350; var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe"; var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk"; var OVERRIDE_USER = 45941; var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page; function answersUrl(index) { return "https://api.stackexchange.com/2.2/questions/" + QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER; } function commentUrl(index, answers) { return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER; } function getAnswers() { jQuery.ajax({ url: answersUrl(answer_page++), method: "get", dataType: "jsonp", crossDomain: true, success: function (data) { answers.push.apply(answers, data.items); answers_hash = []; answer_ids = []; data.items.forEach(function(a) { a.comments = []; var id = +a.share_link.match(/\d+/); answer_ids.push(id); answers_hash[id] = a; }); if (!data.has_more) more_answers = false; comment_page = 1; getComments(); } }); } function getComments() { jQuery.ajax({ url: commentUrl(comment_page++, answer_ids), method: "get", dataType: "jsonp", crossDomain: true, success: function (data) { data.items.forEach(function(c) { if (c.owner.user_id === OVERRIDE_USER) answers_hash[c.post_id].comments.push(c); }); if (data.has_more) getComments(); else if (more_answers) getAnswers(); else process(); } }); } getAnswers(); var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/; var OVERRIDE_REG = /^Override\s*header:\s*/i; function getAuthorName(a) { return a.owner.display_name; } function process() { var valid = []; answers.forEach(function(a) { var body = a.body; a.comments.forEach(function(c) { if(OVERRIDE_REG.test(c.body)) body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>'; }); var match = body.match(SCORE_REG); if (match) valid.push({ user: getAuthorName(a), size: +match[2], language: match[1], link: a.share_link, }); else console.log(body); }); valid.sort(function (a, b) { var aB = a.size, bB = b.size; return aB - bB }); var languages = {}; var place = 1; var lastSize = null; var lastPlace = 1; valid.forEach(function (a) { if (a.size != lastSize) lastPlace = place; lastSize = a.size; ++place; var answer = jQuery("#answer-template").html(); answer = answer.replace("{{PLACE}}", lastPlace + ".") .replace("{{NAME}}", a.user) .replace("{{LANGUAGE}}", a.language) .replace("{{SIZE}}", a.size) .replace("{{LINK}}", a.link); answer = jQuery(answer); jQuery("#answers").append(answer); var lang = a.language; lang = jQuery('<a>'+lang+'</a>').text(); languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang.toLowerCase(), user: a.user, size: a.size, link: a.link}; }); var langs = []; for (var lang in languages) if (languages.hasOwnProperty(lang)) langs.push(languages[lang]); langs.sort(function (a, b) { if (a.lang_raw > b.lang_raw) return 1; if (a.lang_raw < b.lang_raw) return -1; return 0; }); for (var i = 0; i < langs.length; ++i) { var language = jQuery("#language-template").html(); var lang = langs[i]; language = language.replace("{{LANGUAGE}}", lang.lang) .replace("{{NAME}}", lang.user) .replace("{{SIZE}}", lang.size) .replace("{{LINK}}", lang.link); language = jQuery(language); jQuery("#languages").append(language); } }</script>

Mego

Posted 2015-10-31T02:20:27.730

Reputation: 32 998

2For bonus points: Input %dspooky%dme, validate and return next in series. – clap – 2015-10-31T06:13:37.773

25

True, but Dennis would still win

– clap – 2015-10-31T06:19:21.637

Will N always be at least 1? – lirtosiast – 2016-01-29T02:35:42.147

8Who is Dennis? :O – NuWin – 2016-02-15T20:39:00.697

13

@NuWin Dennis is the way. Dennis is the light.

– Alex A. – 2016-02-15T23:02:24.203

1@NuWin Dennis is love, Dennis is life – None – 2017-01-25T19:40:55.640

Answers

47

gs2, 15 bytes

I outgolfed Dennis!

CP437:

spooky•me♣╨V↕0B

Hex dump:

73 70 6f 6f 6b 79 07 6d 65 05 d0 56 12 30 42

At the start of the program, STDIN is pushed (e.g. the string "3") and stored in variable A. The first ten bytes of the program push two strings, "spooky" and "me", to the stack. Then:

  • d0 pushes variable A.
  • 56 parses it as a number.
  • 12 30 increments it by two.
  • 42 swaps the top two elements on the stack, leaving "3" "spooky" 5 "me".

The final stack is printed as 3spooky5me.

Lynn

Posted 2015-10-31T02:20:27.730

Reputation: 55 648

4Holy hell, that's short. +1 – Addison Crump – 2015-10-31T23:47:59.030

11GJ, but Dennis might come over here and outmod you to preserve his reputation. – TheDoctor – 2015-10-31T23:48:37.220

7What no how how did you do that – a spaghetto – 2015-11-01T02:06:49.597

3I just realized... does gs2 stand for "golf script 2"? – mbomb007 – 2015-11-03T14:56:56.183

5

By the way, I've added GS2 to my family of online interpreters, Try it online!

– Dennis – 2015-12-11T22:57:41.717

31

GS2, 17 bytes

56 40 27 27 04 73 70 6F 6F 6B 79 05 42 04 6D 65 05

I CAN'T OUTGOLF DENNIS HELP

a spaghetto

Posted 2015-10-31T02:20:27.730

Reputation: 10 647

31relevant – Downgoat – 2015-10-31T03:24:14.917

3Man, it's so weird that we currently have 4 languages tied for first and 3 languages tied for second :P – ETHproductions – 2015-10-31T20:15:22.230

26

Stuck, 17 bytes

i_2+"spooky";"me"

EDIT: GUESS YOU COULD SAY I'M STUCK AT 17 BYTES

a spaghetto

Posted 2015-10-31T02:20:27.730

Reputation: 10 647

1Hey cool, someone actually using Stuck :D – Kade – 2015-11-01T00:31:22.760

@Shebang I actually really like Stuck. Although it would be nice if it had some better methods for manipulating arrays. – a spaghetto – 2015-11-01T02:07:07.707

22

GolfScript, 17 bytes

~.2+"spooky"\"me"

Try it online on Web GolfScript.

How it works

~        # Evaluate the input.
.2+      # Push a copy and add 2.
"spooky" # Push that string.
\        # Swap it with the computed sum.
"me"     # Push that string.

Dennis

Posted 2015-10-31T02:20:27.730

Reputation: 196 637

12

Chef, 414 bytes

S.

Ingredients.
g i
2 g t
115 l s
112 l p
111 l o
107 l k
121 l y
109 l m
101 l e

Method.
Take i from refrigerator.Put e into mixing bowl.Put m into mixing bowl.Put i into mixing bowl.Add t.Put y into mixing bowl.Put k into mixing bowl.Put o into mixing bowl.Put o into mixing bowl.Put p into mixing bowl.Put s into mixing bowl.Put i into mixing bowl.Pour contents of mixing bowl into the baking dish.

Serves 1.

A recipe for disaster. Do not try this at home.

a spaghetto

Posted 2015-10-31T02:20:27.730

Reputation: 10 647

6Mm. That's some spooky tastes you got there. – Addison Crump – 2015-11-08T15:36:10.583

11

CJam, 18 bytes

ri_2+"spooky"\"me"

Try it online.

a spaghetto

Posted 2015-10-31T02:20:27.730

Reputation: 10 647

11

Pyth - 17 bytes

s[Q"spooky"hhQ"me

Try it online here.

Maltysen

Posted 2015-10-31T02:20:27.730

Reputation: 25 023

9

TeaScript, 18 bytes

x+`spooky${x+2}me`

Unfortunately this string can't be compressed so this is basically as short as it will get

Downgoat

Posted 2015-10-31T02:20:27.730

Reputation: 27 116

12Welcome to the 18th byte! :P – a spaghetto – 2015-10-31T02:36:53.300

9

Pip, 18 bytes

Looks like I'm in the second tier of golfing languages here. :^P

[a"spooky"a+2"me"]

Takes the number as a command-line argument and puts the appropriate elements in an array, which is joined together and autoprinted at the end of the program.

DLosc

Posted 2015-10-31T02:20:27.730

Reputation: 21 213

8

dc, 20 bytes

?dn[spooky]P2+n[me]P

daniero

Posted 2015-10-31T02:20:27.730

Reputation: 17 193

8

Japt, 17 16 bytes

U+"spooky{U+2}me

Japt (Javascript shortened) is a language of my invention. It is newer than this challenge; thus, this answer is non-competing. Unlike my other seven unpublished languages, this one has an actual interpreter that is currently being developed and is already partially working.

I wanted to post this because I like how it's the same length as all the existing first-place second-place answers. Here's how it works:

U+"spooky{U+2}me"    implicit: [U,V,W,X,Y,Z] = eval(input)
U+                   input +
  "spooky     me"     this string
         {U+2}         with input+2 inserted here
                     implicit: output last expression

And there you have it. The spec for all functionality used here was finalized on Oct 29th; nothing was changed to make this answer any shorter. Here's the interpreter, as promised.

ETHproductions

Posted 2015-10-31T02:20:27.730

Reputation: 47 880

I'm sure this was pre-shoco, but I think you could've done {U}2me instead of {U+2}me :P – Oliver – 2018-05-01T18:27:44.107

7

Gol><>, 21 bytes

I:n"emykoops"6Ro{2+nH

I guess I'm... tied with Perl? Try it online.

I:n            Input n, output n
"emykoops"     Push chars
6Ro            Output top 6 chars (spooky)
{2+n           Output n+2
H              Output stack and halt (me)

Sp3000

Posted 2015-10-31T02:20:27.730

Reputation: 58 729

7

Vitsy, 21 Bytes

Note: the Z command was made after this challenge began, but was not made for this challenge.

VVN"ykoops"ZV2+N"em"Z
V                      Grab the top item of the stack (the input) and make it a
                       global variable.
 V                     Call it up - push the global variable to the top of the stack.
  N                    Output it as a number.
   "ykoops"            Push 'spooky' to the stack.
           Z           Output it all.
            V2+N       Call the global variable again, add two, then output as num.
                "em"Z  Push 'me' to the stack and output it all.

More spoopy variation using multiple stacks (27 Bytes):

&"ykoops"&"em"?DN?Z??2+N??Z

&                           Make a new stack and move to it.
 "ykoops"                   Push 'spooky' to the current stack.
         &"em"              Do the last to things with 'me'.
              ?             Move over a stack.
               DN           Output the input.
                 ?Z         Move over a stack (the one with 'spooky') and print it.
                   ??       Move back to the original stack.
                     2+N    Add 2 to the input and output it as a number.
                        ??Z Move to the stack with 'me' in it and print it.

Try it online!

Addison Crump

Posted 2015-10-31T02:20:27.730

Reputation: 10 763

Just wondering, why are strings inverted? – Cyoce – 2016-02-23T02:32:03.517

It's pushing chars to the stack one by one. – Soham Chowdhury – 2016-03-23T08:45:45.600

6

Julia, 23 bytes

n->"$(n)spooky$(n+2)me"

This creates an unnamed lambda function that accepts an integer and returns a string. The output is constructed using Julia's string interpolation.

Alex A.

Posted 2015-10-31T02:20:27.730

Reputation: 23 761

6

05AB1E, 14 10 bytes

DÌs’ÿæªÿme

Try it online.

Non-competing since 05AB1E is newer than this challenge.

Explanation

DÌs’ÿæªÿme

D                get input n and duplicate it
 Ì               increment by 2
  s              Swap. Stack is now [n+2, n].
   ’ÿæªÿme       Compressed string that expands to "ÿspookyÿme". The first ÿ is then replaced by n and the second by n+2.

a spaghetto

Posted 2015-10-31T02:20:27.730

Reputation: 10 647

3This seems to work with D removed for 9 bytes – dzaima – 2017-11-10T20:09:13.987

5

Javascript(ES6) 23 21 Bytes

A simple function that will be crushed by golfing lanqs:

_=>_+`spooky${_+2}me` 

_=>`${_}spooky${_+2}me`

Special thanks to ETHproductions for saving 2 bytes

Generic User

Posted 2015-10-31T02:20:27.730

Reputation: 373

NOICE! You might be able to shorten the template strings, but I can't think of any way to do so – MayorMonty – 2015-10-31T17:21:12.660

Two bytes saved: _=>_+`spooky${_+2}me` – ETHproductions – 2015-10-31T20:18:20.357

Thank you, but now the fix seems so obvious I feel stupid. I think this is the shortest possible way to do this in Javascript, I could be wrong( I hope I'm wrong) – Generic User – 2015-10-31T21:11:39.747

5

Ruby, 25 bytes

->n{"#{n}spooky#{n+2}me"}

This creates an unnamed lambda that accepts an integer and returns a string. The string is constructed using Ruby's string interpolation.

Alex A.

Posted 2015-10-31T02:20:27.730

Reputation: 23 761

5

APL, 25 22 bytes

⍕,'spooky','me',⍨∘⍕2+⊢

This creates an unnamed monadic function train that accepts an integer on the left and returns a string.

Numeric values are converted to strings using . The array of strings is joined into a single string using .

Try it online

Saved 3 bytes thanks to Thomas Kwa!

Alex A.

Posted 2015-10-31T02:20:27.730

Reputation: 23 761

4

PHP, 55 47 46 42 34 bytes

<?=($a=$argv[1]).spooky.($a+2).me;

Accepts the number as command line input.

Credits :)

Thanks to manatwork for saving 4 bytes!

Thanks to insertusernamehere for saving 8 bytes!

user46470

Posted 2015-10-31T02:20:27.730

Reputation:

function a($a){echo$a,"spooky",$a+2,"me";} – manatwork – 2015-10-31T12:25:12.483

You could save 4 bytes by removing the "s. You could even save 4 more bytes by taking a command line argument and discard the function, like this: <?=($a=$argv[1]).spooky.($a+2).me;. – insertusernamehere – 2015-10-31T20:07:40.363

4

Chaîne, 15 bytes

noncompeting, language postdates question

{i~}:-,}:{2+}me
{i~}            | input duplicate write
    :   :       | access dictionary with inner base-93 key
     -,}        | entry for "spooky"
         {2+}   | push 2, add previous two, write
             me | write me

Implicit output.

Conor O'Brien

Posted 2015-10-31T02:20:27.730

Reputation: 36 228

The output is `spookyme 4 2" (newline separated) – Fabian Schmengler – 2015-11-01T10:35:36.397

@fschmengler I must have messed something up whilst updating the interpreter. Please stand by. – Conor O'Brien – 2015-11-01T17:11:21.643

@fschmengler Alright, bugs have been fixed. It should work now. – Conor O'Brien – 2015-11-01T17:17:17.757

3

Python, 31 bytes

lambda n:"%dspooky%dme"%(n,n+2)

Ask and you shall receive.

Dennis

Posted 2015-10-31T02:20:27.730

Reputation: 196 637

Python 3.6+ lambda n:f'{n}spooky{n+2}me' for 28 bytes. – mypetlion – 2017-11-10T23:14:42.387

3

Perl 5, 20 19 bytes

$\=spooky.($_+2).me

The code requires the -p switch. Thanks to @Xcali for golfing off 1 byte!

Try it online!

Dennis

Posted 2015-10-31T02:20:27.730

Reputation: 196 637

3

Lua for windows, 41 bytes

n=io.read()print(n.."spooky"..n+2 .."me")

test with lua for windows

it takes the input through io.read then stored in variable n then on the same line prints the variable n then "spooky" then n+2 finally it prints "me"

Alex Allen

Posted 2015-10-31T02:20:27.730

Reputation: 91

1Remove whitespace and save bytes n=io.read()print(n.."spooky"..n+2.."me") – Digital Veer – 2015-10-31T15:44:27.683

1@DigitalVeer - Without the whitespace 2. will be treated as a number. – Egor Skriptunoff – 2015-11-01T09:30:54.140

p.lua: print(.....'spooky'.. ...+2 ..'me') How to run: lua51.exe p.lua 2 Size = 35 bytes. – Egor Skriptunoff – 2015-11-01T09:37:14.930

3

Mathematica, 45 27 bytes

Print[#,"spooky",#+2,"me"]&

g=ToString[#]<>"spooky"<>ToString[#+2]<>"me"&

Thanks to Martin Büttner for the significant improvement (and the warm welcome).

Ubiquitous

Posted 2015-10-31T02:20:27.730

Reputation: 131

2Welcome to PPCG! Unnamed functions are fine, so you don't need the g= and I think Print[#,"spooky",#+2,"me"]& should work as well. :) – Martin Ender – 2015-10-31T14:19:14.510

What about Row@{#,spooky,#+2,me}&? The output is visually similar if the variables are not defined. – 2012rcampion – 2015-11-01T07:06:36.037

3

Simplex v.0.7, 20 bytes

Simplex simply isn't feeling golfy today. >_<

i@R"spooky"&IIR"me"g
i@                   ~~ take input and copy to register
  R"spooky"          ~~ write that string to the strip (increment byte after every character)
           &II       ~~ write the register (incremented twice) to the strip
              R"me"  ~~ write that string to the strip
                   g ~~ output the strip

Conor O'Brien

Posted 2015-10-31T02:20:27.730

Reputation: 36 228

You still beat Vitsy. o-o – Addison Crump – 2015-10-31T15:53:22.120

@VoteToClose Don't feel too bad. Last Simplex version would've been ~25+ characters. Either way, 20 or 21 bytes doesn't come close to 17 ;-; – Conor O'Brien – 2015-10-31T16:00:52.977

2Dennis wins again. – Addison Crump – 2015-10-31T16:02:16.217

1@VoteToClose What did you expect? He's a mod XD – Conor O'Brien – 2015-10-31T16:02:57.757

3

We need to add this to the meme list.

– Addison Crump – 2015-10-31T16:03:26.190

@VoteToClose You need to do it. For the meme-ness – Conor O'Brien – 2015-10-31T16:03:44.160

3

C, 58 bytes

main(a,b)char**b;{printf("%sspooky%dme",*++b,atoi(*b)+2);}

atoi() may be unnecessary.

Chris Loonam

Posted 2015-10-31T02:20:27.730

Reputation: 585

>

  • Fails on my gcc, because it depends on evaluation order. 2. Save a byte with int**b.
  • < – ugoren – 2015-11-03T15:11:02.393

    3

    Minkolang 0.10, 49 bytes

    I have no way to convert integers to strings (yet!), so this is much longer.

    "me"nd2+(dl%"0"+$rl:d)"spooky"2g(dl%"0"+$rl:d)$O.
    

    Try it here.

    Explanation

    (dl%"0"+$rl:d) does the job of converting an int to a string. If this were replaced by a single character (like Z), then my solution would be just 23 bytes.

    "me"nd2+Z"spooky"2gZ$O.
    

    nd takes an integer from input and duplicates it. 2+ adds 2 and 2g later gets the initial input and puts it on top of stack. $O. outputs the whole stack as integers and stops.

    El'endia Starman

    Posted 2015-10-31T02:20:27.730

    Reputation: 14 504

    Surely it's shorter to just output the numbers as numbers? – Sp3000 – 2015-11-01T07:49:19.767

    Outputting as number automatically adds a space to the output. So it'd be "2 spooky4 me". – El'endia Starman – 2015-11-01T20:50:14.650

    3

    Rotor, 15 bytes

    &"spooky"~2+"me
    

    Language was created after the challenge. Does not work in the online interpreter (uses input eval.)

    a spaghetto

    Posted 2015-10-31T02:20:27.730

    Reputation: 10 647

    Dam son. You outgolfed Dennis. Finally. Hooray! – Addison Crump – 2016-01-10T06:15:00.190

    1Rotor is dead to me don't try to resurrect it please. – a spaghetto – 2016-01-10T15:09:05.113

    1Nice job, even in Rotor!! You should reward it with life. – Rɪᴋᴇʀ – 2016-03-22T21:33:27.747

    3

    Cookie, 16 bytes (non-competing)

    Note that the recent changes to the Github page were not made for this challenge, Cookie is still in development.

    wŕspooky[r+2]me"
    

    Explanation:

    wŕspooky[r+2]me"
    w                 start write command
     ŕ                take input
      spooky          write spooky
            [r+2]     compute input + 2
                 me   write me
                   "  close write command.
    

    user51533

    Posted 2015-10-31T02:20:27.730

    Reputation:

    @Mego Why did you add non-competing? Just asking. – None – 2016-03-23T07:42:39.963

    The language was created 5 months after the challenge was posted. – Mego – 2016-03-23T07:46:34.123

    @Mego Didn't know about that system. Thanks for enlightening me ;) – None – 2016-03-23T07:48:49.573

    Glad to help. If a submission is valid, but the language(s)/feature(s) used didn't exist prior to the posting of the challenge (either on main or in the Sandbox), it must be marked as non-competing, unless the challenge specifically allows newer languages/features to compete. – Mego – 2016-03-23T07:50:02.483

    Right. That makes sense. – None – 2016-03-23T07:50:28.393

    3

    Jelly, non-competing

    13 bytes This answer is non-competing, since the challenge predates the creation of Jelly.

    +0,2ż“×¥X“ŀ`»
    

    I CAN'T OUTGOLF QUARTATA HELP

    Try it online!

    How it works

    +0,2ż“×¥X“ŀ`»  Main link. Input: n
    
    +0,2           Add [0, 2] to n, resulting in [n, n + 2].
         “×¥X“ŀ`»  Yield ['spooky, 'me'] by indexing into a dictionary.
        ż          Zip the results to left and right with each other.
                   This yields [[n, 'spooky'], [n + 2, 'me']], which is flattened
                   before printing.
    

    Dennis

    Posted 2015-10-31T02:20:27.730

    Reputation: 196 637

    7One does not simply outgolf... quartata? – Arcturus – 2016-03-31T02:23:57.913

    I can't seem to outgolf quartata, but, since the answer is non-competing, I can give some help. +2ṭż“×¥X“ŀ\»`

    – Erik the Outgolfer – 2017-02-15T17:45:22.567

    2

    Java 8, 24 bytes

    n->n+"spooky"+(n+2)+"me"

    That moment when Java is actually competitive... (and by competitive I mean top 40 :P)

    Try it online!

    NotBaal

    Posted 2015-10-31T02:20:27.730

    Reputation: 131

    2

    Groovy, 24 22 bytes

    {it+"spooky${it+2}me"}
    

    a spaghetto

    Posted 2015-10-31T02:20:27.730

    Reputation: 10 647

    At string's ends is shorter to concatenate: {it+"spooky${it+2}me"}. – manatwork – 2016-03-23T07:45:39.933

    2

    Java, 39 35 bytes

    n->"".format("%dspooky%dme",n,n+2);
    

    A lambda expression that takes an int and returns a string.

    TNT

    Posted 2015-10-31T02:20:27.730

    Reputation: 2 442

    2

    Mouse, 25 bytes

    ?N:N.!"spooky"2N.+!"me"$
    

    Ungolfed:

    ? N:         ~ Read an integer N from STDIN
    N. !         ~ Write N to STDOUT
    "spooky"     ~ String literals go straight to STDOUT
    2 N. + !     ~ Print N+2
    "me"
    $            ~ End of program
    

    Alex A.

    Posted 2015-10-31T02:20:27.730

    Reputation: 23 761

    2

    Gema, 21 characters

    *=*spooky@add{$0;2}me
    

    Sample run:

    bash-4.3$ echo -n 42 | gema '*=*spooky@add{$0;2}me'
    42spooky44me
    

    manatwork

    Posted 2015-10-31T02:20:27.730

    Reputation: 17 865

    2

    jq, 21 characters

    (20 characters code + 1 character command line option.)

    "\(.)spooky\(.+2)me"
    

    Sample run:

    bash-4.3$ jq -r '"\(.)spooky\(.+2)me"' <<< 42
    42spooky44me
    

    On-line test (Passing -r through URL is not supported – check Raw Output yourself.)

    manatwork

    Posted 2015-10-31T02:20:27.730

    Reputation: 17 865

    2

    PowerShell, 31 30 29 bytes

    param($x)"$x`spooky$($x+2)me"
    

    Try it online!

    Takes input $x, constructs and leaves a string on the pipeline with implicit output. The string is formed from $x spooky $x+2 me, with the trick being the ` that allows the variable name to be escaped to be just $x instead of $xspooky.

    -1 byte thanks to Veskah.

    AdmBorkBork

    Posted 2015-10-31T02:20:27.730

    Reputation: 41 581

    param($x)"$x\spooky$($x+2)me"` is one shorter – Veskah – 2018-07-18T02:44:01.423

    2

    Scala, 30 bytes

    (n:Int)=>s"${n}spooky${n+2}me"
    

    Jacob

    Posted 2015-10-31T02:20:27.730

    Reputation: 1 582

    2

    Jolf, 15 bytes

    Try it here! I forgot about inline string interpolation until after @quartata posted his solution.

    "¦jspooky¦+2jme
    

    Explanation

    "¦jspooky¦+2jme
    "               string containing
     ¦j              the input,
       spooky        "spooky"
             ¦+2j    2 + the input,
                 me  and "me"
                    implicitly printed.
    

    Conor O'Brien

    Posted 2015-10-31T02:20:27.730

    Reputation: 36 228

    2

    R, 38 bytes

    n=scan();sprintf("%dspooky%dme",n,n+2)
    

    or (same length)

    sprintf("%dspooky%dme",n<<-scan(),n+2)
    

    Example:

    n=scan();sprintf("%dspooky%dme",n,n+2)
    1: 999
    999spooky1001me
    

    lambruscoAcido

    Posted 2015-10-31T02:20:27.730

    Reputation: 401

    1paste0(n<-scan(),"spooky",n+2,"me") for 35 :-) – J.Doe – 2018-10-09T11:48:48.223

    1

    LOLCODE, 100 99 bytes

    HAI 1.3
    I HAS A J
    GIMMEH J
    VISIBLE J!
    VISIBLE "spooky"!
    VISIBLE SUM OF J AN 2!
    VISIBLE "me"
    KTHXBYE
    

    Try it online!

    FantaC

    Posted 2015-10-31T02:20:27.730

    Reputation: 1 425

    1

    Stacked, 21 bytes

    [:2+,'spooky'#`'me'+]
    

    Try it online!

    Function returning the string.

    Explanation

    [:2+,'spooky'#`'me'+]
    [                   ]  function                stack: (y)
     :                     duplicate               stack: (y y)
      2+                   add 2                   stack: (y y+2)
        ,                  pair                    stack: ((y y+2))
         'spooky'#`        join by "spooky"        stack: ("{y}spooky{y+2}")
                   'me'+   append the string "me"  stack: ("{y}spooky{y+2}me")
    

    Conor O'Brien

    Posted 2015-10-31T02:20:27.730

    Reputation: 36 228

    1

    Kotlin, 24 bytes

    {"${it}spooky${it+2}me"}
    

    Try it online!

    snail_

    Posted 2015-10-31T02:20:27.730

    Reputation: 1 982

    1

    Assembly (MIPS, SPIM), 221 bytes

    .data
    a: .asciiz "spooky"
    c: .asciiz "me"
    .text
    .globl main
    main:
    li $2 5
    syscall
    la $9 a
    la $10 a
    move $8 $2
    l:
    move $4 $8
    li $2 1
    syscall
    li $2 4
    move $4 $9
    syscall
    bne $10 $9 e
    la $9 c
    addi $8 2
    j l
    e:
    li $2 10
    syscall
    

    Try it online!

    Couldn't get SPIM and TIO to play nice with argc/argv, so had to take it via input. String formatting in Assembly isn't pleasant.

    Andrew Baumher

    Posted 2015-10-31T02:20:27.730

    Reputation: 351

    1

    Keg, -no 13 bytes

    :&spooky&2+me
    

    This was way too spooky. It's not even October!

    Pushes the evaluated input and stores it in the register, pushes the sequence spooky, adds two to the value in the register and then pushes the sequence me.

    Uses the latest version of the interpreter which hasn't been updated on TIO thus far.

    Lyxal

    Posted 2015-10-31T02:20:27.730

    Reputation: 5 253

    1

    Wren, 31 bytes

    Not special, just uses some formatting

    Fn.new{|n|"%(n)spooky%(n+2)me"}
    

    Try it online!

    user85052

    Posted 2015-10-31T02:20:27.730

    Reputation:

    1

    MarioLANG, 221 bytes

    ;>+>+>+>+>.>)
    :"+"+"+"+"-"-
    )++++++++.-:-
    +++++++++--+-"
    +++++++++.-+-.
    +++++++++-.(--
    +++++++++-+.--
    +++++++++-++--
    +++++++++.++--
    ++++++++++++--
    ++++++++++++--
    ++++++++++++--
    ++++++++++++--
    +!+!+!+!+!+!.!
    =#=#=#=#=#=#=#
    

    Try it online!

    CoedRhyfelwr

    Posted 2015-10-31T02:20:27.730

    Reputation: 272

    1

    tq, 16 bytes

    ?"spooky"?+2"me"
    

    Explanation

    # Define an array with 4 items
    ?                # First item: input
     "spooky"        # Second item: "spooky"
             ?+2     # Third item: input + 2
                "me" # Fourth item: "me"
    
    # Print without a separator
    ```
    

    user85052

    Posted 2015-10-31T02:20:27.730

    Reputation:

    I may start trying to make it a golfing language as well. I am thinking about adding increment-by-2 and length-2 strings. – None – 2020-01-18T07:34:09.340

    1

    Burlesque, 21 bytes

    J2?+Cl"~spooky~me"jf~
    

    Needs fixed stack layout. Not usable except as a stand-alone program. Otherwise use one of the versions below that are more generic.

    Alternative versions:

    "~spooky~me"jbxJ2?+_+f~ [24 bytes]
    J"spooky"?+j2?+"me"?+?+ [24 bytes, too]
    

    mroman

    Posted 2015-10-31T02:20:27.730

    Reputation: 1 382

    1

    O, 20 bytes

    j.o"spooky"o))o"me"o

    Kinda long Try it online

    j          Get input as Number
    .          Clone the number to add to later
    o          Print the number
    "spooky"o  Print spooky
    ))o        Increment the input by two and print
    "me"o      Print me
    

    phase

    Posted 2015-10-31T02:20:27.730

    Reputation: 2 540

    1

    Bash, 24 bytes

    echo $1spooky$(($1+2))me
    

    Takes input as command line argument

    Fabian Schmengler

    Posted 2015-10-31T02:20:27.730

    Reputation: 1 972

    1There is also an old syntax for arithmetic evaluation: $[]. It is deprecated, but that usually not holds us back from using it. – manatwork – 2016-03-23T14:39:14.517

    1

    JS (ES5) 41

    Oh, ES6...

    function(a){alert(a+"spooky"+(a+2)+"me")}
    

    ev3commander

    Posted 2015-10-31T02:20:27.730

    Reputation: 1 187

    1

    Coffeescript, 23 bytes

    (n)->n+"spooky#{n+2}me"
    

    Anonymous function that takes int n and returns <n>spooky<n+2>me.

    Zane Martin

    Posted 2015-10-31T02:20:27.730

    Reputation: 31

    Nice! You could save two bytes with (n)->n+"spooky#{n+2}me". – ETHproductions – 2015-10-31T23:15:53.290

    @ETHproductions Didn't think of that! Thanks! – Zane Martin – 2015-10-31T23:23:32.563

    1

    C++11, 142 130 108 bytes

    Self-imposed challenge: no C headers

    #include<sstream>
    #include<string>
    [](int x){std::stringstream q;q<<x<<"spooky"<<x+2<<"me";return q.str();}
    

    Thanks to Mego for saving a few bytes with the return logic everything.

    James Murphy

    Posted 2015-10-31T02:20:27.730

    Reputation: 267

    Good tip. I'll make the changes accordingly. – James Murphy – 2015-10-31T23:53:41.590

    That's terrifying, and also really neat. – James Murphy – 2015-11-01T00:16:52.643

    Ooh. That's good. – James Murphy – 2015-11-01T00:24:06.700

    1

    C# 33 bytes

    string s(n)=>$"{n}spooky{n+2}me";
    

    DLeh

    Posted 2015-10-31T02:20:27.730

    Reputation: 1 111

    1

    Dart, 27 Bytes

    t(n)=>'${n}spooky${n+2}me';
    

    Unremarkable but competitive.

    Nick

    Posted 2015-10-31T02:20:27.730

    Reputation: 29

    Welcome to Programming Puzzles & Code Golf! – Dennis – 2015-11-02T20:44:55.717

    1

    Carrot (version ^3), 14 bytes

    #spooky(#+2)me
    

    Explanation:

    Carets ^ have now been made optional if you do not want to use commands. The # is the variable representing the input. Every instance of # is replaced with the value of input. Going to the parentheses, the expression inside the parentheses is evaluated and a number is returned.

    Test it online here. Please note that this is not permalinked.

    user41805

    Posted 2015-10-31T02:20:27.730

    Reputation: 16 320

    1Did you write this before the challenge, and do you have proof? – lirtosiast – 2015-11-03T15:04:29.233

    @ThomasKwa I started writing this on the 1st of November. And proof is in Carrot's website – user41805 – 2015-11-03T15:50:15.400

    1I might actually start using Carrot. XD – Addison Crump – 2015-11-08T11:59:51.800

    1

    Retina, 17 bytes

    This assumes that the integer n may be expressed in unary in the output. Each line would go in its own file, with one byte added per additional file.

    1+
    $_spooky$_11me
    

    If the input is 11, the output is 11spooky1111me.

    For non-unary output (but still unary input), use this (27 bytes):

    1+
    $_spooky$_11me
    (\d)+
    $#1
    

    Try it online

    mbomb007

    Posted 2015-10-31T02:20:27.730

    Reputation: 21 944

    Is unary the standard way of expressing numbers in retina? – Cyoce – 2016-02-23T06:14:33.377

    1

    ><>, 25 (+2) = 27 bytes

    :n'emykoops'oooooo{2+noo;
    

    Starting with a value (n) on top of the stack from -v (2 byte penalty). Explanation:

    :            Duplicates top item on stack
     n           Pops and outputs top value on stack as number -> n
      'emykoops' Pushes each character onto the stack
       o         x5 Pops and outputs top value on stack as character -> "spooky"
        {        Shift stack leftwards making input value top value
         2       Pushes 2 on the stack
          +      Pops top 2 elements, sums them and pushes result
           n     Pops and outputs top value on stack as number -> n+2
            o    x2 Pops and outputs top value on stack as character -> "me"
             ;   Ends execution
    

    Blake Lockley

    Posted 2015-10-31T02:20:27.730

    Reputation: 637

    1

    pl, 12 bytes

    _spooky_2┼me
    

    Try it online.

    Non-competing since pl was invented after this challenge.

    a spaghetto

    Posted 2015-10-31T02:20:27.730

    Reputation: 10 647

    1

    Seriously, 20 bytes (non-competing)

    "me",;⌐@"spooky"@kεj
    

    Since this challenge partially inspired this language, I figured I should go ahead and add a solution. Try it online!

    Mego

    Posted 2015-10-31T02:20:27.730

    Reputation: 32 998

    A golfing language partially based on this challenge got 20 whole bytes? – Cyoce – 2016-02-23T06:31:58.267

    @Cyoce I still haven't implemented the parts of the language that were inspired by this challenge (raw strings mode). – Mego – 2016-02-23T06:36:50.857

    1

    F#, 33 bytes

    fun n->printf"%ispooky%ime"n<|n+2
    

    Roujo

    Posted 2015-10-31T02:20:27.730

    Reputation: 353

    1

    Squirrel, 25 bytes

    @(n)n+"spooky"+(n+2)+"me"
    

    a spaghetto

    Posted 2015-10-31T02:20:27.730

    Reputation: 10 647

    1

    D, 71 bytes

    import std.string;string s(int i){return format("%sspooky%sme",i,i+2);}
    

    More verbose than Java...

    a spaghetto

    Posted 2015-10-31T02:20:27.730

    Reputation: 10 647

    1

    Jolf, 16 bytes

    "%spooky%me"J+2J
    

    Try it online.

    a spaghetto

    Posted 2015-10-31T02:20:27.730

    Reputation: 10 647

    1

    Applesoft BASIC, 28 bytes

    0input n:?n;"spooky";n+2;"me
    

    The question mark expands to PRINT and the missing final double quotation mark is implied.

    Tested with Joshua Bell's online emulator.

    dnep

    Posted 2015-10-31T02:20:27.730

    Reputation: 301

    1

    Pylongolf, 20 bytes  

    _:AA"spooky"A2+"me"~
    

    _ asks for input and :A puts it into the variable A.
    A"spooky" pushes A, and spooky then A2+ adds the input + 2.
    After that we push "me" into the stack and print it with ~.

    user47018

    Posted 2015-10-31T02:20:27.730

    Reputation:

    0

    ,,,, 18 bytes

    :↓2+"spooky"↓↓"me"
    

    totallyhuman

    Posted 2015-10-31T02:20:27.730

    Reputation: 15 378

    0

    Acc!!, 99 bytes

    N
    Write _
    Write 115
    Write 112
    Write 111
    Write 111
    Write 107
    Write 121
    Write _+2
    Write 109
    Write 101
    

    Try it online!

    FantaC

    Posted 2015-10-31T02:20:27.730

    Reputation: 1 425

    0

    Implicit, 20 17 16 bytes

    ì¯spooky]ì..ìme"
    

    Try it online!

    ì¯spooky]ì..ìme"
    ì                 « implicit integer input, convert to string     »;
     ¯                « copy input to memory                          »;
      spooky          « push the ASCII character codes for each letter in `spooky` individually »;
            ]         « copy memory to stack                          »;
             ì        « convert string to integer                     »;
              ..      « increment twice                               »;
                ì     « and back to string                            »;
                 me   « push character codes for `me`                 »;
                   "  « stringify the entire stack                    »;
    

    MD XF

    Posted 2015-10-31T02:20:27.730

    Reputation: 11 605

    0

    Python ≥ 3.6, 28 bytes

    lambda x:f'{x}spooky{x+2}me'
    

    Try it online!

    Makes use of formatted string literals, a feature that was introduced in Python 3.6.

    Mr. Xcoder

    Posted 2015-10-31T02:20:27.730

    Reputation: 39 774

    0

    SmileBASIC, 26 bytes

    INPUT N?N;"spooky";N+2;"me
    

    12Me21

    Posted 2015-10-31T02:20:27.730

    Reputation: 6 110

    0

    T-SQL, 40 bytes

    SELECT CONCAT(n,'spooky',n+2,'me')FROM t
    

    Input taken via a pre-existing table t with integer column n, per our input standards.

    CONCAT does an implicit type conversion, otherwise I'd have to do something like CONVERT(n,varchar(9)).

    BradC

    Posted 2015-10-31T02:20:27.730

    Reputation: 6 099

    0

    MATL, 18 bytes

    'spooky'yUQQV'me'v
    

    Try it on MATL Online

    sundar - Reinstate Monica

    Posted 2015-10-31T02:20:27.730

    Reputation: 5 296

    0

    OCL, 52 46 bytes

    Function a b Print b+"spooky"+(b + 2)+"me" End
    

    This one is pretty straight forward, I just wanted to show off an obscure language.

    Edit: I found out you can omit the spaces between the pluses when doing concatenation, but not addition. Weird.

    Tux1

    Posted 2015-10-31T02:20:27.730

    Reputation: 41

    0

    Pip, 23 bytes

    (a:q)."spooky".a+2."me"
    

    Try it online!

    Kenneth Taylor

    Posted 2015-10-31T02:20:27.730

    Reputation: 183

    0

    Stax, 14 bytes

    ü╫2┐╚╘Wö»§W╟╛╨
    

    Run and debug it at staxlang.xyz!

    Unpacked (16 bytes)

    .me;2+`tNCrf`,Wp
    .me                 Literal "me"
       ;2+              Peek from input stack, push to stack, and add 2
          `tNCrf`       Literal "spooky"
                 ,      Pop from input stack; push to stack
                  Wp    Pop and print everything from the stack with no additional newlines
    

    Khuldraeseth na'Barya

    Posted 2015-10-31T02:20:27.730

    Reputation: 2 608

    0

    Pyramid Scheme, 624 bytes

       ^      ^      ^      ^     ^      ^      ^      ^      ^
      / \    / \    / \    / \   / \    / \    / \    / \    / \
     /set\  /out\  /out\  /out\ /out\  /out\  /out\  /out\  /out\
    ^-----^^-----^ -----^ -----^----- ^----- ^-----^ -----^ -----^
    -    ^--    / \    / \    / \    / \    / \   /+\    / \    / \
        /#\    /chr\  /chr\  /chr\  /chr\  /chr\ ^---^  /chr\  /chr\
       ^---   ^----- ^----- ^----- ^----- ^-----/2\  - ^----- ^-----
      /l\    / \    / \    / \    / \    / \    ---   / \    / \
     /ine\  /115\  /112\  /111\  /107\  /121\        /109\  /101\
     -----  -----  -----  -----  -----  -----        -----  -----
    

    Try it online!

    Very straightforward. Gets an integer from input and saves it to the blank variable. Prints it. Prints "spooky". Prints blank+2. Prints "me". Follows the same pattern as Hello, World, for the most part.

    Khuldraeseth na'Barya

    Posted 2015-10-31T02:20:27.730

    Reputation: 2 608

    0

    Excel, 22 bytes

    =A1&"spooky"&A1+2&"me"
    

    Wernisch

    Posted 2015-10-31T02:20:27.730

    Reputation: 2 534

    0

    Forth (gforth), 39 bytes

    : f 0 2dup .r ." spooky"2 m+ .r ." me";
    

    Try it online!

    Code Explanation

    : f            \ start a new word definition
      0 2dup       \ add 0 to the top of the stack and duplicate the top two stack values
      .r           \ print the input with no following space
      ." spooky"   \ print "spooky"
      2 m+ .r      \ add 2 to the input and print with no following space
      ." me"       \ print "me"
    ;              \ end the word definition
    

    reffu

    Posted 2015-10-31T02:20:27.730

    Reputation: 1 361

    0

    Runic Enchantments, 18 bytes

    i:2+"me"S9´334E{@
    

    Try it online!

    Saves 1 byte by using 9´334E to pull "spooky" out of the word dictionary. 8b*E for "me" is the same length.

    Draco18s no longer trusts SE

    Posted 2015-10-31T02:20:27.730

    Reputation: 3 053

    0

    Stax, 12 bytes

    ïöeO¬‼3ì╡☻↔G
    

    Run and debug it

    Uses an unterminated template literal to embed instructions in an output string.

    recursive

    Posted 2015-10-31T02:20:27.730

    Reputation: 8 616

    0

    Japt, 14 bytes

    `èï`ri@°+T°
    

    Try it

    Japt, 13 bytes

    +`spooky{+2}´
    

    Try it

    Shaggy

    Posted 2015-10-31T02:20:27.730

    Reputation: 24 623

    0

    W d, 14 bytes

    ♠╚z[·7♦÷U# 1╘╖
    

    Explanation

    Uncompressed:

    "a"spooky"a2+"me"
    
    ""                 % Push an empty string for the first operand to render
      a                % The 1st operand
       "spooky"        % Push "spooky"
               a2+     % The 1st operand + 2
                  "me" % Push me
    

    user85052

    Posted 2015-10-31T02:20:27.730

    Reputation:

    0

    MATLAB, 33 bytes

    @(x)fprintf('%dspooky%dme',x,x+2)
    

    Pretty self explanatory. Tried a few ways and this was the shortest I could find.

    You should be able to run this with the Octave online interpreter.

    Tom Carpenter

    Posted 2015-10-31T02:20:27.730

    Reputation: 3 990

    0

    O, 20 characters

    Q"spooky"Q2+"me"+++p
    

    Sample run:

    bash-4.3$ o.sh 'Q"spooky"Q2+"me"+++p' <<< 42
    42spooky44me
    

    manatwork

    Posted 2015-10-31T02:20:27.730

    Reputation: 17 865

    0

    Fourier, 32 bytes

    I~zo115a-3avaa-4a121az+2o109a-8a
    

    Still using @isaacg's golfing algorithm ;)

    Beta Decay

    Posted 2015-10-31T02:20:27.730

    Reputation: 21 478

    0

    Haskell, 38 bytes

    a n=show(n)++"spooky"++show(n+2)++"me"
    

    Defines a function named a that takes a Num n. Returns <n>spooky<n+2>me.

    Zane Martin

    Posted 2015-10-31T02:20:27.730

    Reputation: 31

    You can save a byte by writing show n instead of show(n). – Itai Bar-Natan – 2016-02-22T16:28:16.880

    0

    Clojure, 26 bytes

    #(str %"spooky"(+ 2%)"me")
    

    First post. It's a function, as required. I think I took as many liberties with the tokenizer as possible, but I don't know. Here it is in action in the REPL:

    user=> #(str %"spooky"(+ 2%)"me")
    #<user$eval1176$fn__1177 user$eval1176$fn__1177@2d2d2f69>
    user=> (*1 55)
    "55spooky57me"
    

    Ray Toal

    Posted 2015-10-31T02:20:27.730

    Reputation: 589

    0

    Factor, 79 bytes

    : f ( x -- ) dup 2 + [ number>string ] bi@ "spooky" swap "me" 4array concat . ;
    

    First stab at it, just did it the obvious way.

    user29119

    Posted 2015-10-31T02:20:27.730

    Reputation: 61

    0

    Lua, 41 Bytes

    There's this other lua answer, but it doesn't work anymore since lua 5.3. It will now print 2spooky4.0me Here comes a code working under all versions of lua, and who's still in 41 Bytes:

    print(("%dspooky%dme"):format(...,...+2))
    

    Katenkyo

    Posted 2015-10-31T02:20:27.730

    Reputation: 2 857