# Halloween Golf: The 2spooky4me Challenge!

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!

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.

## 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

• For bonus points: Input %dspooky%dme, validate and return next in series. – clapp Oct 31 '15 at 6:13
• True, but Dennis would still win – clapp Oct 31 '15 at 6:19
• Who is Dennis? :O – NuWin Feb 15 '16 at 20:39
• @NuWin Dennis is the way. Dennis is the light. – Alex A. Feb 15 '16 at 23:02
• @NuWin Dennis is love, Dennis is life – user63571 Jan 25 '17 at 19:40

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

• Holy hell, that's short. +1 – Addison Crump Oct 31 '15 at 23:47
• GJ, but Dennis might come over here and outmod you to preserve his reputation. – TheDoctor Oct 31 '15 at 23:48
• What no how how did you do that – a spaghetto Nov 1 '15 at 2:06
• I just realized... does gs2 stand for "golf script 2"? – mbomb007 Nov 3 '15 at 14:56
• By the way, I've added GS2 to my family of online interpreters, Try it online! – Dennis Dec 11 '15 at 22:57

# 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

• relevant – Downgoat Oct 31 '15 at 3:24
• Man, it's so weird that we currently have 4 languages tied for first and 3 languages tied for second :P – ETHproductions Oct 31 '15 at 20:15

# Stuck, 17 bytes

i_2+"spooky";"me"

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

• Hey cool, someone actually using Stuck :D – Kade Nov 1 '15 at 0:31
• @Shebang I actually really like Stuck. Although it would be nice if it had some better methods for manipulating arrays. – a spaghetto Nov 1 '15 at 2:07

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

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

• Mm. That's some spooky tastes you got there. – Addison Crump Nov 8 '15 at 15:36

# CJam, 18 bytes

ri_2+"spooky"\"me"

Try it online.

# Pyth - 17 bytes

s[Q"spooky"hhQ"me

# 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 • Welcome to the 18th byte! :P – a spaghetto Oct 31 '15 at 2:36 # 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. # dc, 20 bytes ?dn[spooky]P2+n[me]P # 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. • I'm sure this was pre-shoco, but I think you could've done {U}2me instead of {U+2}me :P – Oliver May 1 '18 at 18:27 # 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) # 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! • Just wondering, why are strings inverted? – Cyoce Feb 23 '16 at 2:32 • It's pushing chars to the stack one by one. – Soham Chowdhury Mar 23 '16 at 8:45 # 05AB1E, 14 10 bytes DÌs’ÿæªÿme Try it online. ## 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. • This seems to work with D removed for 9 bytes – dzaima Nov 10 '17 at 20:09 # 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. # 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. # 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! ## 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

• NOICE! You might be able to shorten the template strings, but I can't think of any way to do so – MayorMonty Oct 31 '15 at 17:21
• Two bytes saved: _=>_+spooky${_+2}me – ETHproductions Oct 31 '15 at 20:18 • 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 Oct 31 '15 at 21:11 # PHP, 55474642 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!

• function a($a){echo$a,"spooky",$a+2,"me";} – manatwork Oct 31 '15 at 12:25 • 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 Oct 31 '15 at 20:07

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

• The output is spookyme 4 2" (newline separated) – Fabian Schmengler Nov 1 '15 at 10:35
• @fschmengler I must have messed something up whilst updating the interpreter. Please stand by. – Conor O'Brien Nov 1 '15 at 17:11
• @fschmengler Alright, bugs have been fixed. It should work now. – Conor O'Brien Nov 1 '15 at 17:17

# Python, 31 bytes

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

• Python 3.6+ lambda n:f'{n}spooky{n+2}me' for 28 bytes. – mypetlion Nov 10 '17 at 23:14

# 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
• You still beat Vitsy. o-o – Addison Crump Oct 31 '15 at 15:53
• @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 Oct 31 '15 at 16:00
• Dennis wins again. – Addison Crump Oct 31 '15 at 16:02
• @VoteToClose What did you expect? He's a mod XD – Conor O'Brien Oct 31 '15 at 16:02
• We need to add this to the meme list. – Addison Crump Oct 31 '15 at 16:03

## C, 58 bytes

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

atoi() may be unnecessary.

• 1. Fails on my gcc, because it depends on evaluation order. 2. Save a byte with int**b. – ugoren Nov 3 '15 at 15:11

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

• Welcome 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 Oct 31 '15 at 14:19
• What about Row@{#,spooky,#+2,me}&? The output is visually similar if the variables are not defined. – 2012rcampion Nov 1 '15 at 7:06

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

• Surely it's shorter to just output the numbers as numbers? – Sp3000 Nov 1 '15 at 7:49
• Outputting as number automatically adds a space to the output. So it'd be "2 spooky4 me". – El'endia Starman Nov 1 '15 at 20:50

# Lua for windows, 41 bytes

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"

• Remove whitespace and save bytes n=io.read()print(n.."spooky"..n+2.."me") – Digital Veer Oct 31 '15 at 15:44
• @DigitalVeer - Without the whitespace 2. will be treated as a number. – Egor Skriptunoff Nov 1 '15 at 9:30
• p.lua: print(.....'spooky'.. ...+2 ..'me') How to run: lua51.exe p.lua 2 Size = 35 bytes. – Egor Skriptunoff Nov 1 '15 at 9:37

# Rotor, 15 bytes

&"spooky"~2+"me

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

• Dam son. You outgolfed Dennis. Finally. Hooray! – Addison Crump Jan 10 '16 at 6:15
• Rotor is dead to me don't try to resurrect it please. – a spaghetto Jan 10 '16 at 15:09
• Nice job, even in Rotor!! You should reward it with life. – Rɪᴋᴇʀ Mar 22 '16 at 21:33

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.
• @Mego Why did you add non-competing? Just asking. – user51533 Mar 23 '16 at 7:42
• The language was created 5 months after the challenge was posted. – Mego Mar 23 '16 at 7:46
• @Mego Didn't know about that system. Thanks for enlightening me ;) – user51533 Mar 23 '16 at 7:48
• 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 Mar 23 '16 at 7:50
• Right. That makes sense. – user51533 Mar 23 '16 at 7:50

# 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.
• One does not simply outgolf... quartata? – Arcturus Mar 31 '16 at 2:23
• I can't seem to outgolf quartata, but, since the answer is non-competing, I can give some help. +2ṭż“×¥X“ŀ`» – Erik the Outgolfer Feb 15 '17 at 17:45

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