The Challenge

Create a program or function that takes no input, and outputs (or returns):

I'm a programming paradox — no I'm not.

Without using a character twice in any string, or digit twice in any integer.


  1. You may not use any character twice within a string. For example, the word "test" would violate this rule.

  2. You may not use any character twice between strings. For example, if somewhere in your code you have the string "hi", no other strings may contain the substring "h" or "i".

  3. You may not use a digits more than once within an integer. For example, the integer 200 would not be acceptable.

  4. You may not use a digit more than once between integers. For example, if you have the integer 40 in your code, you may not have the integer 304.

  5. The above rules do not apply between data types. You could, for example, have the string "9" and the integer 9 in your code.

  6. An uppercase letter is considered a separate character from the lowercase.

  7. You may only use printable ASCII characters in your strings.

  8. You may not set variables to each character and add them together.


Here is an example, written in Python 2, of what the same challenge might look like with the string "Hello, World!" instead.

print"He"+"l"*2+"o, "+"W"+chr(int("1"*3))+"r"+chr(108)+"d!"

Note: For those wondering why I chose this particular string; I chose it because it has several repeated characters and a repeated word. It has no greater significance or meaning.

  • \$\begingroup\$ Does the repeated rule only apply to strings, and not the rest of the code? \$\endgroup\$ – ASCIIThenANSI Sep 24 '15 at 15:54
  • 16
    \$\begingroup\$ I don't like that you added a rule to rule out a posted answer. It's not fair to ETHproductions that they figured out a solution but don't get to use it because you don't like it. Also, I don't think saving chars to variables is any more cheap than using character codes as in your example. \$\endgroup\$ – xnor Sep 24 '15 at 17:11
  • 17
    \$\begingroup\$ -1 for changing the rules. \$\endgroup\$ – Dennis Sep 24 '15 at 18:10
  • 8
    \$\begingroup\$ The dash in the text "I'm a programming paradox — no I'm not." you posted is not ASCII 39 "-" \$\endgroup\$ – Max Sep 24 '15 at 18:27
  • 9
    \$\begingroup\$ It's not clear to me whether when you say string you mean string literal, and similarly for integer vs integer literal. \$\endgroup\$ – Peter Taylor Sep 24 '15 at 18:33

Javascript (ES6), 89 86 84 Bytes

`${y=>I0m3a3programming3paradox313no3I0m3not2}`.slice(3).replace(/\d/g,m=>"'—. "[m])

Python 2, 186 155 139 138 126 109 98 bytes

I don't know if this is a loophole...

print list(locals())[3].translate("adgimnoprtx' -.I"*16)

don't think I can golf more than this...

  • \$\begingroup\$ Very nicely done! \$\endgroup\$ – sweerpotato Sep 24 '15 at 17:42
  • 1
    \$\begingroup\$ This seems to use 3 twice in integers 35 and 39. You could always use 42-7 for 35 or something similar though. \$\endgroup\$ – Geobits Sep 24 '15 at 17:43
  • 3
    \$\begingroup\$ chr(39) can be replaced with "'" and chr(35) with "#". Saves you bytes and puts you in the rules. Also, you can do r=replace and save a ton of bytes. You're also calling list twice. \$\endgroup\$ – Morgan Thrapp Sep 24 '15 at 17:45
  • 1
    \$\begingroup\$ @MorganThrapp you have to call r like this: r("My String", "My", "A") which returns "A String". \$\endgroup\$ – FryAmTheEggman Sep 24 '15 at 18:08
  • 1
    \$\begingroup\$ @FryAmTheEggman Right, duh, I forget when you call it as a class method you have to pass in the instance. @Max I0m_a_programming_paradox_3_no_I0m_not1="#";r=str.replace print r(r(r(r(list(locals().iteritems())[4][-2],'0',chr(39)),"_"," "),"1","."),"3","-") saves you 10 bytes. \$\endgroup\$ – Morgan Thrapp Sep 24 '15 at 18:11

C++14, 327 bytes

#include <iostream>
#define x(y) <<(y)[s]
std::string s[]={"I'"," ","a","p","r","o","g","m","n","i","d","x","—","t","."};enum{J,S,A,P,R,O,G,M,N,I,D,X,W,T,Z};[]{std::cout x(J)x(M)x(S)x(A)x(S)x(P)x(R)x(O)x(G)x(R)x(A)x(M)x(M)x(I)x(N)x(G)x(S)x(P)x(A)x(R)x(A)x(D)x(O)x(X)x(S)x(W)x(S)x(N)x(O)x(S)x(J)x(M)x(S)x(N)x(O)x(T)x(Z);}();

I'm defining a macro which returns a string to the << operator, mapping the necessary characters in a string array and access them with an enum

  • \$\begingroup\$ I don't think I can golf this particular solution any more, but tips are always welcome! \$\endgroup\$ – sweerpotato Sep 24 '15 at 17:26

Javascript (ES6), 142 105 98 96 bytes

[a="I'm","a",`${y=>programming}`.slice(3),`${no=>paradox}`.slice(4),'-',x="no",a,x+"t."].join` `

Another possible rule-breaker, but it was fun, anyway. :)

Original version:

[a="I'm",(''+(b=>a)).substr(3),(''+(is=>programming)).substr(4),(''+(Fermi=>paradox)).substr(7),'-',(''+(yes=>no)).substr(5),a,'not.'].join` `
  • \$\begingroup\$ I don't know ES6 but.... googling i found thath is=>programming is like: function f(is){return programming} right? I don't understand why this should return the string "programming"? \$\endgroup\$ – Max Sep 24 '15 at 20:22
  • \$\begingroup\$ @Max Yes, you are correct about the fat arrow function declaration. ...`${y=>programming}`... is the same as ...(''+(y=>programming))..., (or ...(''+(function(y){return programming;}))...) which returns "y=>programming", and a substring is taken off of that. Not sure if this is allowed or not. \$\endgroup\$ – ETHproductions Sep 24 '15 at 20:24
  • \$\begingroup\$ does the string concatenation "generate" automagically a string representation of the function? \$\endgroup\$ – Max Sep 24 '15 at 20:28
  • 1
    \$\begingroup\$ @Max Yep. Javascript's type conversion can be ridiculous sometimes. \$\endgroup\$ – ETHproductions Sep 24 '15 at 20:31

Haskell, 320 bytes

import Data.Char

data Letter = A|D|I|I'm|MM|P|R|G|N|O|X|Y|S|T deriving Show

transform :: Letter -> String
transform S = " "
transform Y = "—"
transform I'm = "I'm"
transform x = map toLower $ show x

main :: IO ()
main = print $ transform =<<
  • \$\begingroup\$ What language is this? \$\endgroup\$ – Zach Gates Sep 24 '15 at 18:00
  • 2
    \$\begingroup\$ This is Haskell I believe. \$\endgroup\$ – a spaghetto Sep 24 '15 at 18:00

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