| Bytes | Lang | Time | Link |
|---|---|---|---|
| 005 | tinylisp 2 | 230112T015430Z | DLosc |
| 005 | Uiua | 241123T214622Z | ErikDaPa |
| 016 | CASIO Basic casio fx9750giii | 241007T163623Z | madeforl |
| 009 | Base64 | 160724T122451Z | Ronronne |
| 041 | *nix shell POSIX/bourne | 190819T231556Z | user9289 |
| 015 | smotslang | 250507T091510Z | smots-18 |
| 027 | JavaScript | 250508T044355Z | smots-18 |
| 033 | JavaScript Node.js | 250507T103413Z | Steve Be |
| 038 | Bespoke | 250125T032111Z | Josiah W |
| nan | 241017T001912Z | RARE Kpo | |
| 010 | Uiua | 241008T015228Z | noodle p |
| 009 | Pyth | 240818T204800Z | adrianus |
| 050 | Setanta | 240731T063630Z | bb94 |
| 007 | APL 10 bytes | 140101T105850Z | marinus |
| 065 | Messenger | 240727T170304Z | squarero |
| 013 | ACCUMULATOR | 221129T050940Z | Rhaixer |
| 027 | YASEPL | 240507T200128Z | madeforl |
| 067 | Acc!! | 240422T012204Z | DLosc |
| 071 | Acc!! | 240420T164721Z | Mukundan |
| 4224 | Python 3 | 240421T023648Z | None1 |
| 011 | Rattle | 240205T190248Z | d01 |
| 037 | Commodore BASIC V2 | 240112T180547Z | Shaun Be |
| 051 | Python 2 | 140101T194656Z | dansalmo |
| 008 | Befunge98 FBBI | 140101T083920Z | Justin |
| 037 | Perl 6 | 140102T121355Z | null |
| 010 | GolfScript | 140101T134722Z | aditsu q |
| 054 | Python 3 | 240111T142011Z | vengy |
| 006 | dc | 140101T133301Z | daniero |
| 031 | C gcc | 140102T141214Z | fredover |
| 029 | Scala | 140101T174806Z | Mika |
| 045 | R | 140101T172201Z | AmeliaBR |
| 006 | Scala | 140103T193513Z | Rex Kerr |
| 023 | JavaScript Node.js | 140101T062722Z | logic8 |
| 032 | Python 2 | 140101T154019Z | Deneb |
| 009 | GolfScript | 140101T151341Z | Ilmari K |
| 020 | R | 140107T110125Z | djhurio |
| 014 | Forth gforth | 140101T094850Z | Darren S |
| 018 | Java | 240110T151534Z | Achaaab |
| 014 | GolfScript | 140101T053029Z | Doorknob |
| 009 | PowerShell | 140101T105235Z | Danko Du |
| 032 | Python 2 | 140101T074017Z | Bruno Le |
| 033 | C clang | 140101T060050Z | Sudharsa |
| 020 | Ruby | 140101T093435Z | Darren S |
| 002 | CJam | 140505T035547Z | aditsu q |
| 075 | Java JDK | 140101T151655Z | True Sof |
| 003 | Vyxal 3 | 240103T044812Z | pacman25 |
| nan | Swift | 231225T151250Z | Annett S |
| 024 | morsecco | 231222T194410Z | Philippo |
| 008 | !+~% | 231222T192718Z | Philippo |
| 015 | Desmoslang Assembly | 230530T052658Z | Dadsdy |
| 003 | Thunno 2 | 230527T180209Z | The Thon |
| nan | 230526T113659Z | RARE Kpo | |
| 025 | Desmos | 230420T141515Z | Not A Ch |
| 068 | Logically | 230428T003131Z | ATaco |
| 027 | Python 3 | 230103T134236Z | Joao-3 |
| nan | 221222T135159Z | bigyihsu | |
| 049 | Clojure | 140104T190253Z | Bob Jarv |
| 048 | Fig | 221111T203524Z | Seggan |
| nan | 221110T172826Z | RARE Kpo | |
| 076 | Pascal | 221104T130253Z | Kai Burg |
| 006 | 05AB1E | 161130T231848Z | Oliver N |
| 005 | Quetzalcoatl | 160302T225130Z | NoOneIsH |
| 009 | Python 3 | 220524T115606Z | Deera Wi |
| 033 | C++ gcc | 220207T113713Z | sinvec |
| 012 | Raku Perl 6 | 140101T205702Z | snoopy |
| 013 | Add++ i | 220101T053305Z | lyxal |
| 038 | APOL | 211209T135017Z | Ginger |
| 315 | Python 3 15 Bytes | 211029T212630Z | poggersb |
| 018 | PICO8 | 211103T034603Z | weatherm |
| 015 | Alphabetti spaghetti | 210710T065836Z | wasif |
| 003 | Hexagony | 210426T232822Z | je je |
| 083 | CSASM v2.4.0.2 | 210426T072943Z | absolute |
| 012 | Deadfish~ | 210424T080642Z | wasif |
| 011 | Branch | 210419T045322Z | hyperneu |
| 013 | Grok | 210413T162046Z | Aaroneou |
| 082 | Scratch | 210413T125812Z | Nolan |
| 003 | Vyxal | 200929T083059Z | lyxal |
| 1615 | Python 3 | 190830T190640Z | Sagittar |
| 016 | Python 3 | 210223T105606Z | Hunaphu |
| 8528 | ARM assembly | 210216T040503Z | EasyasPi |
| 016 | Phooey | 210214T011504Z | EasyasPi |
| 042 | Kotlin | 210213T145629Z | grian |
| 004 | BRASCA | 210128T130715Z | SjoerdPe |
| nan | 201209T220402Z | yosik | |
| 013 | DROL | 201206T233822Z | cnamejj |
| 049 | Python 3 | 201117T214735Z | Amir rez |
| 112 | Poetic | 201103T070736Z | JosiahRy |
| 016 | MAWP | 200806T022506Z | Razetime |
| 004 | Husk | 201102T172836Z | Razetime |
| 018 | Hexagony | 201102T171311Z | Undersla |
| 002 | Neim | 201009T014346Z | lyxal |
| 028 | MAWP | 200928T085727Z | Dion |
| 015 | MAWP 2.1 | 200928T091346Z | lyxal |
| 013 | Straw | 160914T174437Z | TuxCraft |
| 010 | Jelly | 160725T144122Z | xenia |
| 012 | Labyrinth | 200928T000035Z | Bubbler |
| 012 | Excel | 200805T204230Z | General |
| 069 | FEU | 200710T114052Z | PkmnQ |
| 026 | Python 2 | 140101T102611Z | Darren S |
| 049 | Python | 200131T004122Z | cdlane |
| 097 | Spice | 191224T182301Z | Slord6 |
| 032 | Rockstar | 180801T180635Z | Mayube |
| 002 | MathGolf | 191224T161957Z | Sagittar |
| 004 | W j | 191224T135248Z | user8505 |
| 011 | ABC | 191224T131903Z | Sagittar |
| 2524 | C# | 190830T192315Z | Sagittar |
| 007 | ><> | 190906T224120Z | Sagittar |
| 027 | Wren | 191206T150549Z | user8505 |
| 012 | Triangular | 191114T194234Z | squid |
| 014 | Emotinomicon | 160926T131659Z | Erik the |
| 006 | 05AB1E | 190902T075002Z | mekb |
| 020 | k4 | 190923T121931Z | scrawl |
| 011 | HaykamScript | 181215T201642Z | bb216b3a |
| 045 | Javascript | 190905T184337Z | rew |
| 004 | 05AB1E | 190906T163712Z | Grimmy |
| 014 | Flobnar | 190829T044941Z | Jo King |
| 007 | bc | 190819T222016Z | user9289 |
| 075 | C# .NET | 190819T232646Z | canttalk |
| 029 | Forth | 190810T120347Z | nonForgi |
| 002 | Keg | 190810T110532Z | Edgex42 |
| 009 | @ | 190810T104927Z | user8505 |
| 081 | Edited bash | 140115T091104Z | F. Hauri |
| 004 | ><> | 161116T105348Z | Teal pel |
| 031 | Symbolic Python | 181216T002241Z | Jo King |
| 007 | TIBASIC | 181130T191655Z | lirtosia |
| 028 | C# | 181130T101652Z | Teun |
| 824 | Aheui esotope | 181130T081032Z | cobaltp |
| 022 | Lost | 181101T091622Z | Kevin Cr |
| 068 | Javascript | 181101T141716Z | Twilight |
| 010 | K ngn/k | 181012T033624Z | Thaufeki |
| 002 | MathGolf | 180913T110846Z | maxb |
| 203 | # | 180907T204300Z | seadoggi |
| 002 | CJam | 180809T184553Z | lolad |
| 015 | SMBF | 160304T200049Z | mbomb007 |
| 031 | Lua 5.3.1 | 180803T033620Z | GalladeG |
| 010 | Z80Golf | 180803T020746Z | Bubbler |
| 005 | Ahead | 180802T035750Z | snail_ |
| 015 | x86 | 180621T031248Z | qwr |
| 046 | JavaScript ES6 | 180619T002341Z | r2d2292 |
| 009 | Julia 0.6 | 180618T200439Z | Sundar R |
| 042 | C# .NET Core | 180503T133215Z | Hille |
| 004 | Stax | 180323T162841Z | Khuldrae |
| 009 | PHP | 140101T104348Z | null |
| 027 | ObjectiveC | 180317T202753Z | Albert R |
| 005 | jshell | 180316T201925Z | null |
| 031 | R | 180309T235248Z | Puninten |
| 032 | TSQL | 180311T155749Z | Razvan S |
| 025 | Perl 5 + Perligata | 180310T231519Z | msh210 |
| 027 | Pyt | 180310T080002Z | drham |
| 024 | C | 170129T224057Z | Albert R |
| 016 | Python 3 | 180310T005041Z | Dat |
| 029 | JavaScript 59 | 140102T163022Z | zzzzBov |
| 1616 | JavaScript | 180308T205036Z | Job |
| 042 | SNOBOL4 CSNOBOL4 | 180308T211020Z | Giuseppe |
| 007 | Canvas | 180305T051431Z | hakr14 |
| 007 | ><> | 180226T173738Z | hakr14 |
| 055 | LibreLogo Paper Format Tabloid | 180305T041005Z | Grant Mi |
| 009 | Pyt | 180225T224221Z | qqq |
| 025 | PHP | 180205T114917Z | Agnius V |
| 007 | GolfScript | 140101T105928Z | Peter Ta |
| 010 | Aceto | 171118T152259Z | qqq |
| 023 | Brainfuck | 180127T103751Z | Dust |
| nan | 180112T024630Z | colin ro | |
| 016 | Pyt | 180107T224116Z | mudkip20 |
| 041 | Python | 180107T194755Z | John |
| 018 | Triangularity | 180107T174631Z | Mr. Xcod |
| 008 | √ å ı ¥ ® Ï Ø ¿ | 170414T195854Z | caird co |
| 011 | J | 140103T160400Z | swish |
| 021 | J | 171119T231621Z | FrownyFr |
| 003 | Implicit | 171120T003833Z | MD XF |
| 012 | TIBASIC | 171119T223641Z | Khuldrae |
| 059 | VB.NET | 140103T155545Z | Fozzedou |
| 029 | Lua | 171119T105441Z | MCAdvent |
| 037 | Javascript | 141019T142509Z | Dan Prin |
| 069 | Haskell | 140111T002328Z | user3175 |
| 1267 | JSFuck | 140101T204202Z | Cybermax |
| 047 | Mathematica | 140103T003046Z | Murta |
| 006 | Golfscript | 140305T151000Z | Vereos |
| 018 | LiveScript | 140101T052130Z | Brigand |
| 009 | Clojure | 140108T101809Z | OpenSauc |
| 018 | Racket | 141019T203901Z | Matthew |
| 003 | Jelly | 160914T191053Z | Erik the |
| 005 | Charcoal | 170626T093927Z | Charlie |
| 027 | Lua | 170809T053548Z | tehtmi |
| 007 | Ruby 8 bytes | 170724T090810Z | schmijos |
| 053 | Lean Mean Bean Machine | 170724T115334Z | Mayube |
| 035 | Clojure | 170724T093007Z | Joshua |
| 015 | Common Lisp | 170621T162602Z | Renzo |
| 076 | JavaScript | 170119T091017Z | dodov |
| 019 | Whitespace | 170606T120337Z | Censored |
| 018 | Vim 7.4 | 161218T131154Z | xenia |
| 003 | Braingolf | 170606T105640Z | Mayube |
| 216 | Go | 140103T110426Z | YOU |
| 016 | Python 3 | 170522T143136Z | Djaouad |
| 2940 | C | 140101T165506Z | Brian Ca |
| 012 | Fourier | 160914T101905Z | Beta Dec |
| 025 | C | 170521T233434Z | MD XF |
| 030 | C | 151214T083029Z | Khaled.K |
| 010 | Sinclair ZX81 | 170401T131634Z | Shaun Be |
| 010 | SmileBASIC | 170130T041810Z | 12Me21 |
| 008 | Groovy | 170209T135250Z | Matias B |
| 016 | tcl | 170107T155449Z | sergiol |
| nan | BrainFlak | 161219T024812Z | Wheat Wi |
| 018 | Javascript | 140101T121814Z | GOTO 0 |
| 003 | Pyke | 161213T001107Z | Blue |
| 010 | Microscript | 150526T123154Z | SuperJed |
| 148 | EXCEL | 161207T212638Z | tuskiomi |
| 027 | PHP | 161205T211925Z | Titus |
| 006 | Pushy | 161205T184254Z | FlipTack |
| 050 | BrainFlak | 161205T172323Z | DJMcMayh |
| 015 | Vim 8.0 | 161130T230605Z | DJMcMayh |
| 219 | The Shakespeare Programming Language | 161013T011109Z | Oliver N |
| 004 | Mouse2002 | 151209T000840Z | cat |
| 010 | QBIC | 160927T170634Z | steenber |
| 033 | Java 8 | 160907T161948Z | Shaun Wi |
| 015 | Actually | 160926T221334Z | Sherlock |
| 016 | Mathematica | 160826T144813Z | user4881 |
| 028 | Swift 2.2 | 160826T142511Z | JAL |
| 032 | Lua | 160823T235917Z | PiGuy |
| 049 | C gcc 5.3.1 | 160823T221537Z | Leaky Nu |
| 021 | VBA | 160821T090531Z | Anastasi |
| 010 | Mathematica | 160815T050556Z | Greg Mar |
| nan | 160724T123249Z | Ronronne | |
| 009 | JavaScript | 160424T133849Z | ericw314 |
| 010 | Factor | 160317T212531Z | cat |
| 050 | C++ | 140101T052057Z | zeeshan |
| 024 | Retina | 160304T201707Z | mbomb007 |
| 005 | Windows Calculator | 141004T104833Z | me and m |
| 024 | BASIC v2.0 Commodore 64 | 160119T205717Z | zsltg |
| 047 | MATLAB no char codes | 140101T194524Z | Christop |
| 032 | Japt | 151209T020303Z | ETHprodu |
| 003 | Jolf | 151207T163219Z | Conor O& |
| 022 | Milky Way 1.0.0 | 151202T185839Z | Zach Gat |
| 027 | TSQL | 151202T093802Z | Steve Ma |
| 028 | Perl 5 | 151201T211944Z | Dale Joh |
| 040 | TSQL | 140908T195710Z | Muqo |
| 005 | MATLAB | 140101T122200Z | jub0bs |
| 077 | Hassium | 151104T134408Z | Jacob Mi |
| 048 | Groovy | 151103T172616Z | K. Klass |
| 003 | Vitsy | 151101T040343Z | Addison |
| 007 | TeaScript | 151031T173651Z | Downgoat |
| 017 | q | 151003T074618Z | Alexande |
| 2468 | C | 151003T063317Z | Albert R |
| 014 | Cardinal | 150712T232451Z | M L |
| 015 | Ruby | 140101T053747Z | Doorknob |
| 030 | Python | 150702T161338Z | Brobin |
| 019 | JavaScript | 150702T134606Z | Ginden |
| 051 | Excel VBA | 150624T135820Z | user3464 |
| 042 | CMD | 150420T003141Z | unclemea |
| 019 | x86 machine code | 150324T005316Z | SirPytho |
| 068 | Python 2 | 140101T214242Z | user344 |
| 007 | Insomnia | 141202T162511Z | n̴̖̋h̷͉̃ |
| nan | Python 2 19 bytes | 150101T162243Z | Uri Gran |
| 030 | C++ | 150103T204349Z | bacchusb |
| 024 | JavaScript | 141227T201515Z | Optimize |
| 030 | Lua | 140916T210017Z | Brian Bo |
| 016 | TinyMUSH | 141101T053041Z | Muqo |
| 019 | Racket 20 | 140101T183631Z | Sylweste |
| nan | I and others have posted shorter Mathematica solutions to this challenge | 140101T231336Z | Michael |
| 005 | C# | 140711T090403Z | Cœur |
| 027 | Xojo | 140920T232014Z | silverpi |
| 112 | Java | 140920T162609Z | John P |
| 027 | C | 140916T150316Z | Gerwin |
| 028 | awk | 140915T171638Z | user1921 |
| 014 | Marbelous | 140909T114630Z | overacto |
| 031 | TIBasic | 140102T163004Z | Timtech |
| 013 | J | 140719T143845Z | ɐɔıʇǝɥʇu |
| 055 | Python | 140711T104059Z | Arne |
| 008 | Python | 140709T153335Z | MadTux |
| 004 | Pyth | 140708T060521Z | izzyg |
| 013 | Julia | 140108T125907Z | plannapu |
| 038 | GTB | 140103T000719Z | Timtech |
| 009 | ><> | 140510T081829Z | TalkTake |
| 018 | Pure bash | 140416T223004Z | F. Hauri |
| 115 | Java without the weird unicode charas @ 115 | 140416T200959Z | masterX2 |
| 008 | Bash 10 or | 140406T121428Z | gmatht |
| 045 | JavaScript | 140314T000426Z | wolfhamm |
| 021 | eTeX | 140313T192145Z | Heiko Ob |
| nan | 140101T160002Z | Cilan | |
| 036 | Sclipting | 140123T190047Z | Timwi |
| 016 | k [16 chars] | 140201T183650Z | nyi |
| 041 | ~~! No Comment | 140201T095318Z | cjfaure |
| 028 | Bash | 140101T120648Z | Dom Hast |
| 2626 | Delphi 26bytes & 26 chars | 140131T143207Z | Teun Pro |
| 017 | k 11 & | 140109T221422Z | Aaron Da |
| 022 | PHP | 140114T200913Z | Michael |
| 029 | R using roman numbers | 140114T152730Z | Tomas |
| nan | 140111T230450Z | Oliver N | |
| 016 | x86 | 140113T004223Z | Robert S |
| 034 | SAS | 140112T223325Z | Joe |
| 023 | Python | 140111T231712Z | flornqua |
| 047 | Javascript | 140101T162049Z | Ionică B |
| 000 | Python3.4.0b2 | 140111T160911Z | YOU |
| 015 | Bash | 140110T175149Z | Kevin Fe |
| 013 | Bat Windows batch | 140110T180648Z | Kevin Fe |
| nan | 140110T164921Z | brother | |
| 068 | Java | 140109T050312Z | javatarz |
| 013 | PHP | 140109T170526Z | primo |
| 049 | Clojure | 140108T083636Z | OpenSauc |
| 029 | Bash | 140109T055259Z | David Ya |
| 013 | vba immediate window | 140107T155924Z | SeanC |
| 010 | Ruby 1.9 | 140108T164712Z | Timtech |
| 027 | Fortran | 140101T183048Z | Kyle Kan |
| 030 | Python | 140108T121025Z | jur |
| 054 | PHP | 140103T083443Z | zamnuts |
| 024 | EXCEL | 140107T223835Z | mic-hall |
| 007 | BAT windows batch | 140107T192441Z | Einacio |
| 063 | C++ | 140107T025644Z | user1076 |
| 022 | Clojure | 140107T133419Z | mikera |
| 010 | Perl | 140101T112120Z | tobyink |
| 060 | C# | 140101T142822Z | user1248 |
| 056 | C# | 140105T080341Z | Merin Na |
| 031 | C | 140106T202336Z | treamur |
| 049 | JavaScript | 140106T114835Z | Pebbl |
| 250 | Multiboot x86 Assembly | 140106T053746Z | tecywiz1 |
| 018 | J | 140106T013650Z | cardinal |
| 024 | Perl | 140106T004648Z | user2905 |
| nan | 120 characters in Squeak Smalltalk trunk 4.5. | 140105T223232Z | aka.nice |
| 064 | C# | 140105T152632Z | shamp00 |
| nan | 140104T234713Z | tasegula | |
| nan | 140104T200520Z | tasegula | |
| 008 | Ruby — | 140101T193053Z | O-I |
| 1415 | Mathematica | 140101T184520Z | Michael |
| 044 | C | 140103T184111Z | Brendan |
| 061 | newLISP | 140103T181338Z | cormulli |
| 022 | Game Maker Language | 140103T152601Z | Timtech |
| 023 | Mathematica | 140101T101740Z | Ajasja |
| 029 | Javascript | 140103T124046Z | Serge |
| 001 | Solution | 140102T091221Z | Vereos |
| nan | 140103T103919Z | Thorsten | |
| 024 | Mathematica | 140103T080542Z | Ming-Tan |
| 035 | bash | 140103T013421Z | Stephen |
| 021 | PHP | 140102T150257Z | totymedl |
| nan | 140101T085930Z | Avi | |
| nan | 140101T131503Z | Milap Ku | |
| 010 | Golfscript | 140101T102335Z | Justin |
| 017 | Python 3 | 140101T213521Z | razpeiti |
| 052 | ANSI C | 140101T182728Z | Johannes |
| nan | 140101T215603Z | Zaq | |
| 024 | Haskell | 140101T073634Z | MtnViewM |
| 037 | C | 140101T142244Z | shiju |
| nan | 140101T174316Z | tuxdna | |
| nan | 140101T124021Z | mleise |
tinylisp 2, 5 bytes
(h"ߞ
Explanation
The same character-code solution as everybody else. h is short for head, which, when given a string, returns the character code of its first character. The string quote and the function-call parenthesis both auto-close at the end of the line/program.
Non-string solution, 43 bytes
(d T(+(*)(*
(d X(* T T T T T
(-(* X X T)X T
Here, we take advantage of the fact that tinylisp 2's multiplication builtin * is variadic: it can take any number of arguments, including zero. Without arguments, its return value is the product of an empty list, or \$1\$.
(d T(+(*)(*)))
Define T as the sum of \$1\$ and \$1\$, or \$2\$.
(d X(* T T T T T
Define X as the product of five \$2\$s, or \$32\$.
(-(* X X T)X T
Output the product of \$32\$ and \$32\$ and \$2\$, minus \$32\$, minus \$2\$ (the - builtin is also variadic): \$(32 \cdot 32 \cdot 2) - 32 - 2 = 2014\$.
Uiua, 5 bytes
-@ @߾
Explanation: (may not be needed)
-@ @߾
@߾ => codepoint 2046
@ => codepoint 32
- => subtract
CASIO Basic (casio fx-9750giii), 28 20 16 bytes
₁₀Int π
Ans+Ans+Int e^e^.!-.!
its literally \$ 2(10^{\left\lfloor\pi\right\rfloor})+\left\lfloor e^{e^1}-1\right\rfloor \$
the ₁₀ character is not a proper number, as it's the single character version of 10^ so it can't be used like a 10 unless you do ₁₀1
just a period (.) on its own is equal to 0 (for some reason?). that means .! is equal to 1
Starts off with 1000 (₁₀Int π), multiplies it by 2 (Ans+Ans), adds 15 (+Int e^e^.!), and subtracts 1 (-.!) to get 2014.
CASIO Basic (Casio fx-9750giii), 12 bytes
this runs on 3 technicalities.
- it prints
2014.928947which still kinda is 2014 - it requires you to press the EXE key (as opposed to the f1 key) to run the program
- the
²character is not a proper number in CASIO Basic
πGetkey²-₁₀Int π-π-.!
and just for fun, heres 2014 with only .! (456 bytes) :3
(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)+(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)+(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)+(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)-√((.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!))-∛((.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!))-∛√((.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!)(.!+.!
Base64, 9 Bytes
MjAxNA==
(You can decode it with: echo MjAxNA== |base64 -d)
*nix shell (POSIX/bourne), 41 bytes
a=.. c=. d=....;echo ${#a}${#b}${#c}${#d}
Other solutions in bash:
printf %x \'— with 13 bytes; try it online!
echo $[x=++y+y]$?$y$[x+x] with 25 bytes; try it online!
smotslang, 15 bytes
crumble 'ߞ run
(14 characters)
Explained:
crumble 'ߞ
-- store the number: [code point of U+07DE] = 2014 --
run -- output (2014) --
For an actual challenge whatsoever:
smotslang -s, 84 bytes
crumble '/
climb climb climb retry
fall fall retry
climb retry
climb climb climb run
With explanation:
crumble '/ -- code point of character '/'
(right before 0) --
climb climb climb retry -- add 3 to output char '2' --
fall fall retry -- subtract 2 to output '0' --
climb retry -- add 1 to output '1' --
climb climb climb run -- add 3 to output '4' --
(-- indicates comments in smotslang, and all whitespace is equal)
Also there is a "boring" answer of debug crumble 'ߞ run for 20 bytes (basically, debug just removes the -s flag)
retry vs run?
retry just outputs (format depends on -s, see below). It won't have a trailing newline though, only run has that.
What's -s?
Imagine the number 81 (51 in hex) is stored, which corresponds to the Unicode character 'Q' (U+0050). By default, using retry 3 times will output 818181; using -s gives QQQ instead. Similar with run (which is retry but with a trailing newline).
This answer is #1 of my smotslang challenge sweep
JavaScript, 27 bytes
(a=-~-~[])=>[a]+-[]+a/a+a*a
Zero argument anonymous function (in that it assumes that no input is given) that uses a keyword argument to create a=2 (type casting [] to 0 then repeateadly applying ~ (x to -x-1) and -), then getting (effectively) [2]+(-0)+(2/2)+(2*2) which (ab)uses JavaScript type casting to cast [2] to a string ('2' of course) and concatenates the rest (yielding "2014").
Yes, I've checked this is actually better than the other 100 JavaScript answers (as of writing this). Other similar answers haven't used assignment as an operation inside their expression.
As far as I can tell, it's only beaten by btoa`ÛMx`, atob`MjAxNA==`, and atob`MjAxNA` (which depends on atob implementation details and is worse than btoa`ÛMx` anyways)
There's no way I can shave more bytes off this right
Shorter variations depending on restrictions
Ignoring atob/btoa, here's what's optimal (as far as I know). My personal choice has been bolded (and that only just because it's the most interesting pick):
| Output type? | Output method? | Code | Byte count |
|---|---|---|---|
| (doesn't matter for output) | Printed | alert([a=-~-~[]]+-[]+a/a+a*a) |
29 bytes |
number |
Just not REPL | alert([a=-~-~[]]+-[]+a/a+a*a) |
29 bytes |
| Any type; just has to be 2014 | Just not REPL | (a=-~-~[])=>[a]+-[]+a/a+a*a |
27 bytes |
number |
Not in an error | +([a=-~-~[]]+-[]+a/a+a*a) |
25 bytes |
| Any type; just has to be 2014 | Not in an error | [a=-~-~[]]+-[]+a/a+a*a |
22 bytes |
(ignore leading spaces, that's just to help match up formatting; it's not part of the code)
Will note that Twilight Sparkle's answer is shorter than every other JS answer, but its downside is that it depends on implementation details.
Bespoke, 38 bytes
New Year is considered a good holida-y
Pushes 2014 onto the stack and outputs it. Pretty standard.
awk
gawk -p- -be 'BEGIN { print ++_+_--_++_++_^_ }'
2014
# gawk profile, created Wed Oct 16 20:17:32 2024
# Rule(s)
1 {
1 print ++_+_--_++_++_^_
}
Uiua, 10 bytes
/×-@?"ARt"
Try it: Uiua pad
I played around for a little to find a creative way but still be short. I landed on this—a program pondering the mystery ? of ARt.
Explanation: The prime factors of 2014 are 2, 19, and 53. Adding a question mark to each gives the string "ARt".
You can get a byte shorter by using 38 and 53, but I like this better.
Setanta, 50 bytes
Since Setanta doesn’t have an equivalent to ord, this gets the length of each string in ["aa", "", "a", "aaaa"] and joins them into a string.
scriobh(nasc@(thar(fad,["aa","","a","aaaa"]))(""))
APL (10 bytes, 7 chars)
⎕UCS'ߞ'
See the revision history for an older version that only works when run in 2014.
Messenger, 65 bytes
v>v >v
>S >S >
>= >>+S>>v
v SS>>v>S +
>v >S - >^>
v< >^> ^
>
Messenger is my first (completed) esolang. A Python 3.8+ interpreter for the command line can be found here. To use it in Try It Online, remove the ## WHILE RUNNING ## section of the code.
Explanation
Unused characters in each step have been replaced with a dot.
v
>
Creates a message going down, with NULL inside of it. The message is then redirected right.
>v
S
>=
This sets the message's content to NULL == NULL, or 1. This is how we get numbers in Messenger without using the digit functions.
v
·
SS
The SS splits the message into three: one that's going left, one that's going up, and one that's going down.
LEFT BRANCH:
v
>v
v<
>
The message already has a 1 in it, so it just goes to the right edge and gets printed.
TOP BRANCH:
>v
>S
>>+
Add 1 + 1. The message now has a 2.
>
S···
>· ·
Split the message...again. One message gets printed as a 2, and the other one...
>>v
S +
>^>
...gets added to itself and printed as a 4.
BOTTOM BRANCH:
·>>v
>S - ··>
>^> ^
The input message has a 1, but it gets subtracted from itself, so it becomes a 0 and gets printed.
Of course, all of these are delayed just the right amount so that it ends up printing 2014.
ACCUMULATOR, 2015 28 13 bytes
-1987 bytes due to an update in the language
-15 bytes by doing this simpler
AACMMCMMMMMMO
This is pretty simple:
- 2
As increment the accumulator:2 Cconcatenates it to itself:22- 2
Ms decrement:20 Cconcatenates it to itself:2020- 6
Ms decrement:2014 Ooutputs
YASEPL, 53 27 bytes
=f$+****++++++=t$+***-+f*f<
explanation:
=f$+****++++++=t$+***-+f*f< packed
=f$+****++++++ F = 2 * 2 * 2 * 2 * 2 + 6 = 38
=t$+***-+f*f T = 2 * 2 * 2 * 2 - 1 + F * F = 2014
< print out T (which is 2014)
Acc!!, 69 67 bytes
_^_+_^_
Count i while _*_-i {
Write (_+_+_+_/_)^_+i*i-i-i+(i-i)^i
}
Explanation
Inspired by Mukundan314's Acc!! answer, I wondered if it would be worth it to use a loop. After some finagling of formulas, it turned out that it was.
# The accumulator _ is initially 0
# Set the accumulator to (0^0)+(0^0) = 2
_^_+_^_
# Loop i from 0 to 3; when i becomes 4, 2*2-4 is 0 and the loop exits
Count i while _*_-i {
# Use the accumulator value to calculate 49:
# _+_+_+_/_ is 2+2+2+2/2 = 7
# (_+_+_+_/_)^_ is 7^2 = 49
# Then we want to add some function of i to get right character code
# The quadratic function i^2-2*i almost works: its values are 0, -1, 0, and 3,
# which gives us the digits 1, 0, 1, and 4
# We can correct the first digit by adding 0^i, which is 1 when i is 0 and 0 otherwise
Write (_+_+_+_/_)^_+i*i-i-i+(i-i)^i
}
Acc!!, 75 71 bytes
-4 bytes thanks to @DLosc
_^_+_^_
_+_+_+_/_
_*_
Write _+_/_
Write _-_/_
Write _
Write _+(_+_+_)/_
Explanation
Note: ^ represents exponentiation
_^_+_^_ # 0^0 + 0^0 = 2
_+_+_+_/_ # 2 + 2 + 2 + 2/2 = 7
_*_ # 7 * 7 = 49
Write _+_/_ # Output char code 49 + 49/49 = 50 (2)
Write _-_/_ # Output char code 49 - 49/49 = 48 (0)
Write _ # Output char code 49 (1)
Write _+(_+_+_)/_ # Output char code 49 + (49 + 49 + 49) / 49 = 52 (4)
Rattle, 1211 bytes
d|n*+b=+**b
Explanation
d| take "d" as input
n get the ASCII int value of 'd' (100)
* multiply (by 2 without an argument) to get 200
+ increment by 1 to get 201
b add "201" to print buffer
=+** reset, increment, multiply by 2, multiply by 2 to get 4
b add "4" to print buffer, output implicitly resulting in "2014"
Commodore BASIC V2, tested on the Commodore C64, 37 PETSCII characters. Non-competing
Note that the {CRSR LEFT} in the following "source code" is the cursor left control character.
A=.↑.:A%=π+A:?A♥("╮")"{CRSR LEFT}"R╮(ST▂(A%),A)
Non-obfuscated, this would look like this:
A=.↑.:A%=π+A:PRINTASC("╮")"{CRSR LEFT}"RIGHT$(STR$(A%),A)
or on a Commodore C64 screen, it would look like this:
Python 2, 51 bytes
print sum(ord(c) for c in 'Happy new year to you!')
Updated for 2015 thanks to @Frg:
print sum(ord(c) for c in 'A Happy New Year to You!')
Mouse over to see 2016 version:
print sum(ord(c) for c in 'Happy New Year to you!!!')
Befunge-98 (FBBI), 17 11 9 8 bytes
'-:*b-.@
Similar to the old version, but I remembered about '
'-:* pushes 45, duplicates it, then squares it, producing 2025
b- subtracts 11 from it, resulting in 2014
.@ prints the result, then ends the program
Interestingly, \$45^2-11\$ is the only pairing of numbers a,b where $$(a,b)∈[32,126]\times[10,15]\land a^2-b=2014$$ The significance of those sets is that \$[32,126]\$ is the set of printable ascii characters and \$[10,15]\$ is the set of easily accessible Befunge numbers. I found that pair with this python program:
for a in range(32,127):
for c in range(10,16):
if (a**2-c)==2014:
print("%s,%s"%(a,c))
Or, if your interpreter supports unicode, then this works:
Befunge 98 - 5 bytes (4 chars)
'ߞ.@
It at least works on http://www.quirkster.com/iano/js/befunge.html with the following code (Befunge 93 - 6 bytes / 5 chars):
"ߞ".@
Befunge-98 (FBBI), 9 bytes
Old version:
cdd**e-.@
computes the number, then prints it:
cdd pushes numbers to the stack so that it is this: 12,13,13
** multiplies top three values of stack, which is now: 2028
e pushes 14
- subtracts the top two values of the stack, resulting in: 2014
. prints the numerical value
@ end of program
Befunge-98 (FBBI), 17 bytes
Older version:
"*'&("#;:a`j@a+,;
Pushes the ascii values for 2014, -10. Then prints each after adding 10 to it.
Perl 6, 37 bytes
This is not my actual solution (the real solution is in PHP, and is shorter), but I decided to make shorter version of Python's solution, because it's a really interesting idea.
say [+] ords 'Happy new year to you!'
So, what does it do? Well, it gets list of character positions (ords function), sums them together ([] is a reduce operator, which takes the exact operator between square brackets, in this case +), and say prints the result with new line. Could be WAY shorter by abusing ~^ prefix operator (which isn't implemented in Rakudo Perl) or Unicode characters, but this is just for fun solution.
Perl 6 is a quite an interesting language, even if it's not as good as Perl 5 in most code golf tasks (because of mandatory whitespace in many situations, and generally less DWIM). However, in this case, because of builtin sum and ords, it wins with Perl 5.
GolfScript, 10 bytes
I can't beat Quincunx's 10-char plain ascii solution but I can match it:
'N,,'{}/*+
(it calculates 44*44+78)
GolfScript, 26 bytes
And now a different approach :)
'codegolfing is yummy'{+}*
Python 3, 54 bytes
n=mp.dps=ord('㤃');print(str(mp.pi)[n-len('year'):n])
How it works
Extracts the year \$2024\$ beginning at the \$14591^{st}\$ digit of \$\pi\$
3.14...27617285830243559830032042024512072872535581195840...
The next 10 years that eventually appear in Pi's decimal expansion!
dc, 6 bytes
DiBBCp
Dpushes 13 on the stack, even tho the input radix is 10 initiallyichanges input radix (to 13 from 10)BBCis 2014 base 13.pprints.
Console output:
$ dc <<< "DiBBCp"
2014
C (gcc), 31 bytes
main(){printf("%o",' b'/'\b');}
C (gcc), 32 bytes
main(){printf("%x%o",' ','\f');}
C (gcc), 30 bytes
main(){printf("%x",' j'^'~');}
C (gcc), 30 bytes
main(){printf("%d",'\a\xde');}
Scala, 32 29 bytes
+"Happy new year to you!".sum
Well ok if you really want it golfed with any chars, you can use:
Scala, 11 bytes
'@'*' '-'"'
Scala, 22 bytes
"{yz}"map(_-'I'toChar)
R, 72 45 bytes
This is far from the shortest answer posted, but no one has yet posted an answer that
- doesn't use character codes as a substitute for numbers, and
- doesn't call the system date.
Using pure math (okay, and an automatic boolean conversion) in R, from the R console:
x<-(T+T);x+floor(exp(pi)^x)*x*x-(x*x)^(x*x)/x
Prints out the number 2014. T is a pre-defined synonym for true in R. The floor and exp functions are directly available in the base package, as is the pi constant. R doesn't have an increment operator, but repeating the (x*x) turned out to be fewer characters that doing increment and decrement twice each.
Original version in Javascript (72 characters)
For the simple reason that I could test out in the console, and it doesn't mind a complete lack of whitespace:
m=Math;p=m.pow;t=true;++t+m.floor(p(m.exp(m.PI),t))*t*t++-p(++t,t--)/--t
run in your console and it will print back the number 2014.
Props to xkcd (and also) for getting me to think about exp(pi):

P.S. If you can make the same algorithm shorter in a different language, post a comment with it.
Scala, 6 bytes
"?="##
(## is Scala's symbol meaning hashCode, and the Java string "?=" hashes to 2014.)
Scala, 5 bytes
+'ߞ'
Math on our favorite unicode character produces an Int.
JavaScript (Node.js), 23 bytes
Uses Base 64 Conversion
alert(atob("MjAxNA=="))
Or
alert("MMXIV") // ;)
Python 2, 32 bytes
Had some fun writing this:
my_lst = []
for i in range(33, 126):
for j in range(i, 126):
if 2014 - 126 < i * j < 2014 - 33:
if j not in range(48, 58):
my_lst.append("ord('" + unichr(i) +
"')*ord('" + unichr(j) +
"')+ord('" + unichr(2014 - i * j) + "')")
for val in my_lst:
print val, '->', eval(val)
Prints all the possible ways I can write 2014 using Bruno Le Floch's method:
ord('!')*ord(':')+ord('d') -> 2014
ord('!')*ord(';')+ord('C') -> 2014
ord('!')*ord('<')+ord('"') -> 2014
ord('"')*ord(':')+ord('*') -> 2014
ord(')')*ord('/')+ord('W') -> 2014
ord('*')*ord('-')+ord('|') -> 2014
ord('*')*ord('.')+ord('R') -> 2014
ord('*')*ord('/')+ord('(') -> 2014
ord('+')*ord(',')+ord('z') -> 2014
ord('+')*ord('-')+ord('O') -> 2014
ord('+')*ord('.')+ord('$') -> 2014
ord(',')*ord(',')+ord('N') -> 2014
ord(',')*ord('-')+ord('"') -> 2014
Python 2, 10 bytes
But this is obviously redundant, so if your interpreter is set to utf-8 by default, then all it takes is:
ord(u'ߞ')
Python 2, 83 bytes
Also, thanks to AmeliaBR (for the idea), I tried my best to implement a pure math version:
from math import*
a,b,c=int(e),round(e),ceil(pi);print int(a**(b*c-(c-b))-a*a**c-a)
GolfScript, 9 bytes
Yet another GolfScript entry. I believe this is shorter than any of the printable GolfScript entries so far:
"!="{*}*)
(Peter Taylor's 7-char entry beats it, but includes non-printable control characters.)
I call this the "that's so last year!" entry, because what it actually does is generate the number 2013 in 8 chars, as 33 × 61, and then increments it by one. ;-)
R, 20 bytes
@popojan (he is not allowed to post an answer here yet) has provided the solution within 20 characters.
sum(T+T:exp(T+pi))-T
Output:
[1] 2014
R, 22 bytes
Anonymous user has suggested shorter solution.
strtoi("bbc",pi*pi+pi)
2014 is BBC in base 13. pi*pi+pi (=13.0112) is treated by R in this context as the integer 13. Output:
2014
R, 30 bytes
cat(a<-T+T,T-T,T/T,a*a,sep="")
Output:
2014
R, 31 bytes
cat(T+T,T-T,T/T,T+T+T+T,sep="")
Inspired from the answer by AmeliaBR. Output:
2014
Java, 18 bytes
Just for the sake of using hashCode().
"bmgjagr".hashCode() = 2014
"?=".hashCode() = 2014
"zsjpzdq".hashCode() = 2024
In order to find a candidate string, I iterated over all the strings of 7 and less characters in the range ['a', 'z']. It represents a set of 8'353'082'583 strings and thus a good probability that one of them has the required hashCode.
Thanks to anatolyg, using more characters allows a much simpler string : "?=" (ASCII 63 and 61), 63 * 31 + 61 = 2014.
79 bytes full class:
class C{public static void main(String[]a){System.out.print("?=".hashCode());}}
18 bytes lambda:
x->"?=".hashCode()
GolfScript, 14 bytes
'-+,/'{)))))}%
How it works: ASCII goes like this:
...
+
,
-
.
/
0
1
2
3
4
...
So, this takes the ASCII codes of each character, subtracts five, and sticks it in a string.
{...}% yields an array of the characters of a string mapped, when given a string as an argument. So, it increments each character by 5 () means increment).
PowerShell, 9 bytes
+"ߞ"[""]
ߞ (U+07DE NKO LETTER KA) is counted as two bytes according to the code-golf tag info.
[""] returns the first character from the string ("" is converted to 0). The unary plus opeartor (+) converts the character to an integer.
Python 2, 32 bytes
print ord(',')*ord('-')+ord('"')
Probably possible to reduce it using the 2014 th Unicode char ߞ, but I didn't try.
Quincunx notes that
a=ord('.');print a*a-ord('f')
is shorter by three chars.
Ruby, 20 bytes
p 'bbc'.to_i ?\r.ord
Explanation: bbc is 2014 in base 13. Shorter than Python. Not as short as Forth.
CJam, 2 bytes
KE
K and E are variables preset to 20 and 14.
I created CJam in 2014 so it's ok if it doesn't qualify.
Java (JDK), 77 75 bytes
75 characters if print is added in a class with the main method:
class C{public static void main(String[]a){System.out.print('#'*'<'-'V');}}
It means 35*60-86 which is equal to 2014
Vyxal 3, 3 bytes
~¥ᴴ
because of how the encoding works, vyxal 3 takes 4 bytes to use a base 252 encoding, but you can shave a byte because 2014 is only 2 bytes in base 255 and thus you can use the ~ element which converts 2 elements on the codepage to base 255
Swift, 92 bytes (for 2014)
func f(){print("..::.:....".components(separatedBy:":").map({x in "\(x.count)"}).joined())}
Count the number of items in the substrings between the colons, convert to strings and join them.
morsecco: 24 bytes
Now a more serious answer:
. -----.----. -.- -. ---
Morsecco codes numbers as binaries with dots and dashes (you could also write it as morse code, but each digit takes 6 bytes, resulting in a much longer code), so . -----.----. Enters 2014 on the stack, -.- -. Konverts this to a decimal Number which gets Output by ---.
!+~%, 8 bytes
++!+~%+!
Stumbled over this challenge and sorry, could not resist. I promise this will not happen again. (-;
An explanation, to make this look serious:
++twice adds 7 to the initial 6, so we end up at 20, that gets printe by!- to the accumulator resetted to 6,
+adds 7, and the~reverses the result from 13 to 31 %does a modulo from the number with a leading 1, so 131 mod 31 happens to be 7.- the
+adds another 7, and!prints the 14 behind the 20.
Desmoslang Assembly, 15 Bytes
PDPP+PDDP+P+POT
Thunno 2, 3 bytes
«¬ẓ
Attempt This Online! Simple compressed integer.
Thunno 2, 4 bytes (UTF-8)
'ߞC
Attempt This Online! Charcode.
Thunno, 4 bytes (UTF-8)
'ߞO
Attempt This Online! Basically the same so I won't create another answer for it.
awk
mawk 'BEGIN { print (_+=++_)!_!!_ _^_ }'
2014
Desmos, 40 26 25 Bytes
b=\ln ee
k=bb
k^kkb-kkb-b
Now smaller by a whole 1 more byte! Yaaay...
Version that needs each line to be pasted individually, 24 23 bytes
b=lnee
k=bb
k^kkb-kkb-b
Logically, 68 bytes.
@w:a,b,c;WRITE(h,a,b,c,l,h,h,l,l)()
@M w(l,h)()w()()w(h)()w(l,l,h)()
Consists of two gate definitions. w writes the 3 passed bits in the form of 00110cba, and then M has 4 w gates for each of the digits.
Whilst logically can use numbers for both argument unrolling and high-low states, it can be avoided pretty easily.
Python 3, 27 bytes
I went through the effort of writing this script:
def to_base(n: int, b: int) -> str | None:
if not 1 < b < 37:
raise "Impossible base, try using a base between 1 and 37 (beginning and end not included)"
if n == 0:
return '0'
possible_digs = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
res = []
while n > 0:
res += possible_digs[n % b]
n //= b
return ''.join(reversed(res))
def to_base_letters_only(n: int) -> str:
bases_found = []
for b in range(11, 37):
c_n = to_base(n, b)
digs_l_10 = False
for d in c_n:
if d in "0123456789":
digs_l_10 = True
break
if not digs_l_10:
bases_found.append([c_n, b])
print(bases_found)
if bases_found == []:
return "No conversion found"
return f"Conversion found: {(min_base := min(bases_found, key=lambda c: len(c[0])))[0]} in base {min_base[1]}"
print(to_base_letters_only(2014))
Which found BBC in base 13, which is 2014, without using arabic numerals.
So, my answer is this:
print(int("BBC",ord("\r")))
\r is Unicode 13.
Fun fact: This answer is 1 byte behind the Python 2 answer, because of print needing parentheses.
That script can also be used to find solutions for other numbers.
Go, 56 bytes
func f(){for _,c:=range`-+,/`{print(string(c+'F'-'A'))}}
Alternative to that other Go answer. Prints to STDERR.
Clojure (177 49 characters)
EDIT
Just tripped over this question again and realized there's a much better way to approach this:
(Integer.(apply str(map count["AA""""A""AAAA"])))
which cuts the length down by quite a bit.
How it works:
(map count ["AA" "" "A" "AAAA"])returns(2 0 1 4), which is a list containing the lengths of each of the strings in the argument vector.(apply str (...))converts the elements of the list(2 0 1 4)into the string"2014".(Integer. (...))converts the string from #2 ("2014") into the integer value2014.- This snippet returns the value
2014.
Original
In the true Lisp-ish spirit that "too many parentheses are never enough" I present:
(Integer. (clojure.string/join [(+ (second (range)) (second (range))) (first (range)) (second (range)) (+ (second (range)) (second (range)) (second (range)) (second (range)))]))
How it works:
The function range produces a lazy sequence of numbers. If no starting point and ending point are specified the range starts at zero and extends infinitely in the positive direction; however, because it's a lazy sequence the numbers are not produced until needed. Thus, applying the first function to the result of the range function without arguments produces the value 0, which is the first element in the sequence 0 to positive infinity. Applying the function second to such a range produces the value 1. From there it's a simple matter of producing enough 1's and summing them up to get 2 and 4, then converting them (implicitly) into strings to join then together, then converting the resulting string back to an integer. (I find it amusing that this is actually longer than some of the Brainf*ck answers - and to add to the horror, it's also legible :-).
Share and enjoy.
:-)
not sure if others have used this one already :
from any UTF-8 aware shell
printf %d \'ߞ
13-chars spanning 14-bytes. the following are equivalent forms :
printf %d \'$'\xDF\x9E'
printf %d \'$'\737\636'
Pascal, 76 B
See also Delphi.
This program requires a processor supporting ISO standard 10206 “Extended Pascal”, specifically constant definitions may be expressions (ord(true) is an expression).
program p(output);const I=ord(true);begin write(I+I,I-I:i,I:i,I+I+I+I:i)end.
If ord(maxChar) ≥ 2014 we can use just one character in the 43 character program
program q(output);begin write(ord('X'))end.
where X needs to be substituted by the implementation-defined char value having the ordinal value 2014.
For reference, an Extended Pascal program printing the current year looks like this:
program t(output); var t: timeStamp; begin getTimeStamp(t); writeLn(t.year) end.
05AB1E, 6 bytes
T·žvÍ«
Uses the CP-1252 encoding. Try it online!
Explanation:
T # Push 10
· # Multiply by 2
žv # Push 16
Í # Subtract 2
« # Concatenate
# Implicit output
Quetzalcoatl, 11 4 5 bytes
::ord('ߞ')
The box should be replaced by Unicode character 2014.
Edit
This is for an old version of Quetzalcoatl. New version:
'ߞ'O
Python 3, 9 bytes
license()
unfortunately this does not work on tio.run but it does work on my device
license() stdouts text which luckily contains 2014 :)
...
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.
...
Raku (Perl 6), 12 bytes
say 'ߞ'.ord
Add++ -i, 13 bytes
L,"j"O"&"OL/*
Caird why no halve built-in you have like 3 fricking built-ins for doing special stuff with doubling but absolutely nothing for halving why do you do this to me?
Explained
L,"j"O"&"OL/*
L, # start a lambda that's automatically called by the -i flag
"j"O # push the number 106 to the stack - that's the ascii value of j
"&"O # push 38 to the stack - that's the ascii value of &
L/ # push the length of the stack (2) and divide 38 by that. This is not a definitive way to consistently divide by 2...it's a miracle the circumstances allowed this. This results in 19
* # and multiply the two items (106 and 19) to get 2014.
APOL, 38 bytes
-(⒏ l(*("eeeeeeeeeeeeeeeee" l("ee"))))
⒏ is a built-in constant that equals 2048, which is only 34 off from 2014. I use the length function to take the length of a 17-character string multiplied by 2 (which is shorter than a 34-character string) and implicitly print the result.
Python 3 (15 Bytes)
print(ord('ߞ'))
Python 3 (24 Bytes)
print(ord('')+ord('*'))
JavaScript (28 Bytes)
-~!+[]+[+[]]+-~[]+-~!''-~!''
PICO-8, 24 18 bytes
?ord("⁙")*ord("j")
ord() gets the numerical index of a character; in P8SCII, ⁙ is at index 19 and j is at index 106, creating the equation \$19*106=2014\$.
CSASM v2.4.0.2, 83 bytes
func main:
push " "
len
print
push ""
len
print
push " "
len
print
push " "
len
print
ret
end
The only way to push numbers to the stack without using numbers is to create str instances and then get their lengths.
Branch, 11 bytes
}}#/#}#^}}#
Try it on the online Branch interpreter!
Branch does have numbers in it. } is increment and { is decrement. # outputs as number. / goes to the left child, which is automatically initialized to 0, which is shorter than {{. Finally, ^ goes to the parent, which is 2 when that command is called. Actually, since the current node is 1, and the parent is 2, we could do ^}} or }}} to get 4.
An alternative solution that produces 2014 on the tree itself instead of outputting it character by character:
Branch, 50 bytes
}}^\}}}}}^*^\}}^*{^\}}^*^\/}}}}}}^\}}}}}}}}}^*{^*#
Try it on the online Branch interpreter!
Scratch, 82 bytes
when gf clicked
say(join(length of[The year two thousnd])(length of[and fourteen
Python 3, 16 bytes (15 characters)
print(ord('ߞ'))
Explanation
ord returns the decimal Unicode of a character, and the decimal Unicode of ߞ happens to be 2014.
Python 2?
I tried doing the same thing in Python 2 (print ord('ߞ')), which would be 1 byte less, but this doesn't work. Why? Well, in Python 3, len('ߞ') returns 1, so everything is fine. However, in Python 2, it returns 2. And since ord only takes a string of length 1, Python 2 doesn't really like that: TypeError: ord() expected a character, but string of length 2 found
ARM assembly, 94 85 bytes (28 bytes compiled)
Textual assembly for ARM mode.
s:subs sb,sb
adc sb,sb
add sb,sb
lsl sl,sb,sb
add sb,sl,lsl sb
rsb sb,sl,lsl sl
bx lr
A function which returns 2014 in sb (r9)
Clobbers sl (r10) and sb (r9).
Expanded version:
// It feels so empty here...
.globl s
s:
// use the quirky way subs affects the flags
// to set r9 to 1
subs r9, r9, r9
adc r9, r9, r9
// double r9 by adding it to itself
// lsl works just as well
// r9 = 2
add r9, r9, r9
// r10 = r9 << r9
// r10 = 2 << 2
// r10 = 8
lsl r10, r9, r9
// r9 = r9 + (r10 << r9)
// r9 = 2 + (8 << 2)
// r9 = 2 + 32
// r9 = 34
add r9, r9, r10, lsl r9
// r9 = (r10 << r10) - r9
// r9 = (8 << 8) - 34
// r9 = 2048 - 34
// r9 = 2014
rsb r9, r9, r10, lsl r10
// Return
bx lr
This uses the same idea as my Phooey answer, of generating 2048, then subtracting 34. While I do have access to push and pop, ARM isn't a stack machine. It is a register machine. Additionally, we have lsl for shifting left which makes a few cases easier.
It is yet another rare case where the inverted carry flag on ARM is useful for something other than 64-bit subtraction, as it allows us to set a register to 1 when combined with adc.
Additionally, this only works in ARM mode: Thumb-2 did not show the return of shifting by register (which kinda was a dumb waste of encoding bits)
It uses the classic register names instead of the format which is r[0-15].
Phooey, 16 bytes
=@+$i>$i=$i<@+$i
# Stk Tape
=@+$i>$i=$i<@+$i # (0) >0 0 (initial state)
= # (0) >1 0 tape = stack == tape to get 1
@ # 1 >1 0 push to stack
+ # (0) >2 0 pop; add stack to tape
$i # (0) >2 0 print tape as integer (2)
>$i # (0) 2 >0 move tape ptr right, print (0)
=$i # (0) 2 >1 same as above to get 1 again, print (1)
<@ # 2 >2 1 move back, push
+$i # (0) >4 1 add stack to tape, print (4)
Thank goodness for Phooey's = operator. This would be impossible in Foo.
Phooey, 23 19 bytes
This version actually generates the number 2014 instead of printing 2,0,1, and 4.
=@+@@@+@**@@*@+--$i
# stack | tape
=@+@@@+@**@@*@+--$i # (0) | 0 initial state
= # (0) | 1 tape = tape == pop() (to get 1)
@+ # (0) | 2 double by adding to self
@@ # 2 2 | 2 push two copies to the stack
@+ # 2 2 | 4 double
@* # 2 2 | 16 square by multiplying by self
* # 2 | 32 multiply by 2
@ # 2 32 | 32 push 32 for later
@* # 2 32 | 1024 square
@+ # 2 32 | 2048 double
- # 2 | 2016 pop and subtract
- # (0) | 2014 pop and subtract
$i # (0) | 2014 print 2014
Kotlin, 42 bytes
fun main()=print("ް.".map{it.code}.sum())
I used U+1968 which is ް and a . which is U+46.
BRASCA, 4 bytes
'ߞn
Explanation
'ߞ - Push the character ߞ (Codepoint 2014)
n - Print as number
Alternative solution, 9 bytes
ll+'.E-Sn
Explanation
ll+ - 10+10 = 20
'.E- - code point 46-32 = 14
S - Concatenate 20 and 14
n - Print as number
Raku (previously Perl6)
Raku interpret Unicode numbers as usual numbers, so:
In REPL – 7 bytes (3 chars):
⑳~⑭
Without REPL – 11 bytes (7 chars):
say ⑳~⑭
you can run it as rakudo -e "say ⑳~⑭"
DROL, 13 bytes
ziill<ukl<dfo
I wanted to add a language that wasn't already included...
DROL is a limited instruction assembler-like language with only two registers as storage. The language does include numbers, so it think it qualifies for this question. But numbers are only used for loop length indicators, as well as being used as the name of some instructions. It's described on the Esolang Wiki DROL page.
Here's a rundown of what the code does:
z set R1=0
ii increment R1 by 1 twice (2)
ll square R1 three two (16)
< shift left R1 (32)
u set R2=R1 (32)
k increment R2 (33)
l square R1 (1024)
< shift left R1 (2048)
d decrement R1 (2047)
f subtract R1 = R1 - R2 (2014)
o print R1 as an integer
Python 3, 49 bytes
for i in['..','','.','....']:print(len(i),end='')
Python 3, 15 bytes
print(ord('ߞ'))
Poetic, 112 bytes
two`s a bad thing
using a two?o,hardly!i am using a poem
a numeric poem?oh,clearly,but a limited one for certain
MAWP, 16 bytes
!!M:!!A:!:!!M!M:
chr:pos:stack
! : 1 : [1,1]
! : 2 : [1,1,1]
M : 3 : [1,2]
: : 4 : [1]
! : 5 : [1,1]
! : 6 : [1,1,1]
A : 7 : [1,0]
: : 8 : [1]
! : 9 : [1,1]
: : 10 : [1]
! : 11 : [1,1]
! : 12 : [1,1,1]
M : 13 : [1,2]
! : 14 : [1,2,2]
M : 15 : [1,4]
: : 16 : [1]
Hexagony, 18 bytes
g{A*'-"'-'"Av<@!}/
g { A
* ' - "
' - ' " A
v < @ !
} / .
I had trouble getting it to fit in 19 bytes (side length 3) because I was always 1 short, then I rearranged my memory accessing to be 1 shorter, which also allowed me to use a very efficient layout. Then I was able to shift a no-op somewhere in the code to the very end saving a byte.
MAWP, 30 28 bytes
!!+!!!!++!*+/!+!!+!+!!++++*:
This will be fun to golf.
This is longer than @Lyxal 's answer, but outputs only one time as one number.
Straw, 13 bytes
(…………………σ)«$>
« sum the codepoint of all characters in a string, $ convert from unary to decimal and > is the print operator.
Jelly, 10 bytes
⁹⁴×H_⁴Ḥ¤’’
Explanation:
⁹ Set the current value to 256.
⁴× Multiply by 16. The current value is now 4096.
H Divide by 2. The current value is now 2048.
_⁴Ḥ¤ Subtract by 16/2. The current value is now 2016.
’’ Decrement twice. The current value is now 2014.
Labyrinth, 12 bytes
))!!)!))))!@
))))_#!!#!!@
))_#"
) !!@
))!"
)
)#!!@
I tried both linear and complex layouts, but I can't figure out how to remove a single byte from any of these programs.
Excel, 12
=UNICODE("ߞ
Second best I could do was =ARABIC("MMXIV at 14 bytes.
Python, 52 49 chars
from math import*
print(int((e*pi+e)**pi+e/e+e))
Works in Python 2 and Python 3.
Spice, 145 97 bytes
Improvement using multiplication to get the 9 from 2*2*2+1, as we already had those values.
;t;z;o;n;i@LEN i z;ADD i i i;LEN i o;PUT i i i;LEN i t;MUL t t i;MUL t i i;ADD o i n;OUT t z o n;
Un-golfed explanation
;t;z;o;n;i@ - Declare vars
LEN i z; - Get the length of [], 0, and store in z
ADD i i i; - Adding implicitly uses the first element, or 0 if there is none, so we insert 0 into i
LEN i o; - Store length of [0], 1, in o
PUT i i i; - Insert 0th element of i into i at position i[0] (we're increasing the array size)
LEN i t; - Store length of [0, 0], 2, into t
MUL t t i; - Multiply t, 2, by itself and store in i
MUL t i i; - Multiply t, 2, by i, 4, and store in i
ADD o i n; - Add o, 1, to i, 8 and store in n
OUT t z o n;- Write to console - "[2] [0] [1] [9]"
Original
;t;z;o;n;i@LEN i z;ADD i i i;LEN i o;PUT i i i;LEN i t;PUT i i i;PUT i i i;PUT i i i;PUT i i i;PUT i i i;PUT i i i;PUT i i i;LEN i n;OUT t z o n;
Un-golfed explanation
In Spice, all variables are double arrays. Importantly, variables that have no assigned value are either treated as an empty list [] or 0 depending on the operation. The built-in LEN will give the length of an array and we can therefore produce numbers:
;t;z;o;n;i@ - Declare vars
LEN i z; - Get the length of [], 0, and store in z
ADD i i i; - Adding implicitly uses the first element, or 0 if there is none, so we insert 0 into i
LEN i o; - Store length of [0], 1, in o
PUT i i i; - Insert 0th element of i into i at position i[0] (we're increasing the array size)
LEN i t; - Store length of [0, 0], 2, into t
PUT i i i; - Now repeat until there are 9 elements...
PUT i i i;
PUT i i i;
PUT i i i;
PUT i i i;
PUT i i i;
PUT i i i;
LEN i n; - ... and store in n
OUT t z o n; - Write to console - "[2] [0] [1] [9]"
For the original 2014 version, you save bytes for less PUTs - 95 bytes. So this solution will improve next year!
Rockstar, 34 32 bytes
X was up equalizing a word
Say X
Say hello to rockstar! (No I didn't make this one)
Explanation:
This first line:
X was up equalizing a word
Uses Rockstar's Poetic number literals. (As opposed to regular literals, which use numbers).
This means that the length of every word after was indicates the digit in that position. So here we have a 2 length (up), a 10 length (equalizing) a 1 length (a) and a 4 length (word). The length is % 10, so equalizing becomes a 0, and the result is that the variable X has the value 2014.
Then of course we print it with Say
W j, 4 bytes
ë‘"C
Explanation
ë‘" % Push a list
C % Convert to list of ord codes [20,14]
flag:j % Join without a separator
```
ABC, 11 bytes
aacncacaaac
Explanation
a increments the accumulator, c outputs it and n sets it to 0.
C#, 25 bytes (24 characters)
Console.Write((int)'ߞ');
Explanation
The decimal Unicode of ߞ is 2014, so you can just cast it to an int and 2014 is printed.
><>, 7 bytes
aa+nen;
You can try it on The Online ><> interpreter.
Explanation
a # push 10
a # push 10
+ # push sum of top two values (10 + 10 = 20)
n # output top value as number
e # push 14
n # output top value as number
; # halt program
This doesn't print the following:
20
14
because n outputs the top value as a number without a newline.
Alternate Solution (9 bytes)
This one actually puts 2014 on the stack as a single number and outputs it.
cbde**+n;
I basically just tried random values for this one :P
Wren, 27 bytes
Just like most other answers, convert to code points and print. However this uses control characters in the source code.
System.printAll("".bytes)
Explanation
"" // An unprintable chain containing 0x14 (20 in decimal) and 0x0e (14 in decimal)
.bytes // Convert them to a list of their decimal codes [20, 14]
System.printAll( ) // Print them all without a separator (2014)
Triangular, 12 bytes
tE**%Cdd.`>/
Y'know, I was just about to post a 14-byte solution; luckily I went back to double-check and had a hunch.
Ungolfed:
t
E *
* % C
d d . `
> /
-- Actual Execution Order --
t*C` The first multiplication does nothing.
12 is pushed twice, then direction changes and both are multiplied to get 144.
E*d>/d% Push 14, then multiply 14*144=2016. Decrement twice and print.
The 14-byte I was going to post:
t*CE.`*...>dd%
Emotinomicon, 14 bytes
😭ߞ😲😨
Explanation:
😭 ߞ 😲 😨 explanation
😭 begin quote string
ߞ
😲 end quote string
😨 pop N and output as a number
ߞ is U+7DE. 0x7DE is 2014.
05AB1E, 22 10 8 7 6 bytes
T·žvÍJ
How it works:
Tpushes 10,·doubles it, we get 20.žvpushes 16,Ísubtracts 2, we get 14.
Lastly, we concatenate them using J!
k4, 20 bytes
*/(-)."j"$("Ud";"/")
"j"$("Ud";"/") / convert "Ud" and "/" to underlying integer representation -> (85 100;47)
(-). / subtract 47 from 85 and 100 -> 38 53
*/ / multiply over
HaykamScript, 11 bytes
s[⛉,☄]i
Explanation
s - string
[ - executed parameters
⛉ - constant for 201
,
☄ - constant for 4
]
i - convert to integer
Other Years
It's pretty simple to make any other year with the same amount of bytes, Unicode codepoints 0x2600 to 0x26FF represent integers 0 to 255 in my language.
For example, to make the year this was posted:
s[⛉,☈]i
Javascript, 45 characters
_=> new Date().getFullYear()-new Date().getDate()
Very Temporary!!
Another Day, another very Temporary answer :-)
f=new Date().getFullYear()-new Date().getDay()
05AB1E, 4 bytes
ToRÀ
T # 10
o # 2**x (1024)
R # reverse (4201)
À # rotate left (2014)
# implicit output
Flobnar, 17 14 bytes
<+\@:!
+<>.!..
Explanation:
@ Start, going left
\ Push to the stack the value from the bottom row
>
.!.. Several print statements we will get back to
< :! Add the not of the top of the stack to itself
+ This is !0+!0 = 2
. Print the 2
. Print the result of the print (0)
.! Print the result of the not of the print (1)
\ Continue forward after pushing the zero to the stack
<+ :! Add the same 2 from the beginning to itself
+< (!0 + !0)+(!0 + !0) = 4
And print implicitly as the last value
bc, 7 bytes. Try it Online!!
K*ZZ+Y
bc, 8 bytes. Try it Online!!
K*A*A+E
Which needs 14 bytes to run in bash:
bc<<<"K*A*A+E"
In bc the upper (single) letters maintan their meaning as a number in 10-36 range in any input base.
A previous approach changed the input base:
echo ibase=D\;BBC|bc
Make numeric base 13 (D) and print BBC in that base --> 2014.
C# .NET 75 bytes
public class p{public static void Main(){System.Console.Write((int)'ߞ');}}
Just displaying the integer value of the unicode character ߞ
Try online (also has 2015-2019)
Keg, 2 bytes
ߞ
Keg auto pushes any characters that aren't instructions to the stack, and ߞ has a unicode value of 2014, which then gets printed.
@, 9 chars
-Σ*{~~}82
Explanation (syntactically invalid)
- 2 Subtract the result by 2(2014)
Σ Summation of all ASCII codes in the string(2016)
* 8 Duplicate the string 8 times
{~~} Define the string "~~"
There is no Try It Online for @.
If the current year is 2016, it would be perfect(7 chars):
Σ*{~~}8
Edited: bash 81 chars!
Just for fun:
wc -c < <(echo {,}{,,}{,}{,,,}{,}{,,,}film dbugjkqstvxz{,}{,,} 'Happy New Year!')
there is no numbers, all letters are used and this print exactly:
2014
( This method could reasonably be used until 2016: by just adding one or two exclamation point after the wish:
wc -c < <(echo {,}{,,}{,}{,,,}{,}{,,,}film dbugjkqstvxz{,}{,,} 'Happy New Year!!') 2015;-)
bash 27 chars
.;v=$?;echo $v$?${#v}$[v+v]
This will output:
bash: .: filename argument required
.: usage: . filename [arguments]
2014
Ok, this will generate some unwanted output, but 2014 is printed and is a valid token!
The two following sample are error free (a little longer but near golfed)
v=$(echo {V..v});echo $[${#v}#vu]
2014
or
printf -vv "%d" $?xfbc;echo $[v>>${#?}]
2014
or even:
echo $[$[$[${#?}$?-${#?}]$?>>${#?}]#Iy]
2014
Inspired by comment from GammaFunction:
echo $[$[a-a]xfbd>>${#?}]
><>, 7 4 bytes
"nߞ
Explanation
"nߞ : Put the string nߞ onto the stack. Stack: [110, 2014]
n : Print the top item of the stack as a number. Stack: [110]
ߞ : Error out.
Symbolic Python, 31 bytes
_=-~-~-~(_==_)
_=`""`[_::_]
Symbolic Python bans numbers anyway.
Explanation:
_=-~-~-~(_==_) # Set _ to 4
_= # Set _ to
`""` # From the representation of some unprintables
# Which is '\x12\x10\x11\x14'
[_::_] # From the 4th character, take every 4th character
# Output the contents of _ implicitly
A more interesting solution at 34 bytes:
_=-~(_==_)
_=`_`+`_-_`+`_/_`+`_*_`
_=-~(_==_) # Set _ to 2
_=`_`+`_-_`+`_/_`+`_*_`
# '2'+'2-2'+'2/2'+'2*2' = '2'+'0'+'1'+'4' = '2014'
TI-BASIC, 7 bytes
int(₁₀^(³√(tan(cosh(cos(π
A significant improvement from the previously winning 12-byte TI-BASIC answer. Using one-byte functions allows the greatest number of chances to achieve a certain value within a given byte count.
C#, 28 bytes
You don't need to cast to an int as Hille does, so it becomes
Console.WriteLine('ϱ'+'ϱ')
Aheui (esotope), 8 chars (24 bytes)
반밝따바뱟해망어
It's too easy for Aheui since it never use any kind of digits at all.
Explanation:
# An Aheui code starts with default stack "아".
반: push 2, move cursor right by 1(→).
밝: push 7, →
따: mul(push 14), →
바: push 0, →
뱟: push 2, move cursor right by 2(→→).
해: end.
망: print as integer, →
어: move cursor left by 1(←).
Note: Print instruction moves cursor in reverse direction if current storage is empty.
Lost, 57 23 22 bytes
<^/*(
)/@+
">>v
^?%<<
My first Lost answer. Thought I'd start with an easy one.
Byte-count more than halved (-35 bytes) thanks to @JoKing.
Try it online or verify that it's deterministic.
General explanation about Lost:
Let me start with an explanation of Lost itself. Lost is a 2D path-walking language. Most 2D path-walking languages start at the top-left position and travel towards the right by default. Lost is unique however, in that both the start position AND starting direction it travels in is completely random. So making the program deterministic, meaning it will have the same output regardless of where it starts or travels, can be quite tricky.
A Lost program of 2 rows and 5 characters per row can have 40 possible program flows. It can start on any one of the 10 characters in the program, and it can start traveling up, down, left, or right.
In Lost you therefore want to lead everything to a starting position so it follows the designed path you want it to. In addition, you'll usually have to clean up the stack when it starts somewhere in the middle.
Program explanation:
The 22-bytes program is similar as the previous 23-bytes program below, but with a smarter path to save that byte:
v<<<<<>>>>>
>%?"^ <"*+@
Let me start with an explanation of the 23-bytes program:
The "^ <" will push the character-codepoints for the three characters in the string, being 94 32 60 respectively. The * multiplies the top two, and + adds the top two of the stack, so it becomes 94+(32*60), which results in 2014.
The @ will terminate the program, but only if the safety is 'off'. When the program starts the safety is always 'on', otherwise the program starting at the exit character immediately terminates without doing anything.
The % will turn the safety 'off'. So as soon as the % is encountered and the safety is 'off', the program can be terminated with an @.
The ? is to clean up the stack if it started somewhere in the middle.
And finally the v<<<<<>>>>>, > and use of ^ < in the string are to lead the program path towards the correct starting position for it to correctly print 2014. Note that the top line could have been v<<<<<<<<<<, but that the reversed part >>>>> will wrap-around to the other side, making the path shorter and therefore the performance slightly better. The byte-count remains the same anyway, so why not.
Now for the 22-bytes solution, and how it actually is the same as the 23-bytes solution, but with a different path.
The arrows are still used to lead the path into the given direction. The / are used as a mirror. So if we go from right to left and encounter the /, it will continue downwards; if we go from the top to the bottom and encounter the /, it will continue towards the left; etc.
The ( will pop the top value on the stack and push to to the scope, and the ) will do the reversed: it pops from the scope, and pushes it back to the stack.
So regardless of where we start and in which direction we travel, the path leads towards the first < of the bottom row. From there, the program flow travels in this order:
%?^ Direction changed upwards
" <^" < Direction changed towards the left
(*/ Direction changed downwards
/ Direction changed towards the left
) +@
So it will:
- Turn the safety 'off' with
%; - Clean the stack with
?; - Push the character-codepoints for
" <^", which are32 60 94respectively; - Pop the
94and store it in the scope with(; - Multiply the
32 60with*, resulting in1920; - Push the
94from the scope back onto the stack with); - Add the
1920 94together with+, resulting in2014; - And then terminates the program with
@, implicitly outputting the top of the stack.
Javascript, 6 characters (8 bytes)
I never saw any rule saying we had to produce the number 2014 in the absence of any other output.
(Nor anything about not outputting to an error, but that's more obvious.)
new`—`
For me, on Firefox Nightly, this produces TypeError: "\u2014" is not a constructor, which contains the number 2014.
(If it isn't obvious, this happens because the em dash, —, is U+2014. Or, in other terms, it's the unicode character that can be represented by the hexadecimal number 2014.)
K (ngn/k), 10 bytes
"&"*-/"U "
and 2018 just because this is so late
K (ngn/k), 11 bytes
-"^"-*/"@!"
EDIT: I'm unsure when this language was created, it's a variant of k which has existed for a long time, but the gitlab link seems to indicate that it may be only a year or so old (judging by commit info), so this answer may be invalid as a result
MathGolf, 2 bytes
ID
Explanation
I Pushes 20
D Pushes 14
The stack is printed in full on termination.
;# - 203
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#
CJam, 2 bytes
KE
K is predefined as 20, E is predefined as 14. The stack gets automatically printed after the program.
SMBF, 15 bytes
\x00 is a literal NUL byte. This program adds 5 to each of /,+- and prints.
<[+++++.<]\x00/,+-
Only my Python interpreter can accept non-printable ASCII. Change the data line to this, and substitute the code you want to run with the non-printable values escaped (on line 169):
data = bytearray(b'the above code goes here')
Lua 5.3.1, 31 bytes
It's an old question, but I may as well join in on the fun!
For those not familiar with Lua, the # operator returns the length of an array or string, and the .. operator is for string and number concatenation. The // operator is integer divide, and is used so that there is no trailing decimal in the numbers caused by Lua treating the result of regular divisions as a float.
2014 in 31 bytes: t=#"aa"print(t..t-t..t//t..t*t) = print(2..2-2..2/2..2*2)
2015 in 36 bytes: t=#"aa"print(t..t-t..t//t..t*t+t//t) = print(2..2-2..2//2..2*2+2/2)
2016 in 33 bytes: t=#"aa"print(t..t-t..t//t..t*t+t) = print(2..2-2..2//2..2*2+2)
2017 in 38 bytes: t=#"aa"print(t..t-t..t//t..t*t+t+t//t) = print(2..2-2..2//2..2*2+2+2/2)
2018 in 33 bytes: t=#"aa"print(t..t-t..t//t..t*t*t) = print(2..2-2..2//2..2*2*2)
The solutions for other years are pretty similar. Here's a function that can do any number:
function f(y)
t=#"a"
s=""
for i=t, #(y.."") do
n=t-t
for j=t,(y..""):sub(i,i) do
n=n+t
end
s=s..n
end
return s
end
And here's the golfed version of the function at 108 bytes:
function f(y)t=#"a"s=""for i=t,#(y.."")do n=t-t for j=t,(y..""):sub(i,i)do n=n+t end s=s..n end return s end
Z80Golf, 10 bytes
00000000: 080a 0b0e 767e 23e5 ee3a ....v~#..:
Disassembly
start:
ex af,af' ; db $3a ^ '2' ($08)
ld a,(bc) ; db $3a ^ '0' ($0a)
dec bc ; db $3a ^ '1' ($0b)
ld c,$76 ; db $3a ^ '4' ($0e)
; halt ($76)
ld a,(hl)
inc hl
push hl
xor $3a
Essentially the Hello World trick in Z80Golf.
In short, hl serves two purposes: data address for a and return address for putchar (which is at $8000 and accessed by going all the way through zeroed memory, instead of call $8000).
The instructions in the data section have to be effective no-ops (not touching hl and sp should suffice), and the last one should be 2-byte in order to shadow $76 (halt). I carefully selected the xor value so that the resulting binary has no digits ($30 to $39).
Z80Golf, 10 bytes, 2018 edition
00000000: 1416 171e 767e 23e5 ee26 ....v~#..&
Disassembly
start:
inc d ; db $26 ^ '2' ($14)
ld d,$17 ; db $26 ^ '0' ($16)
; db $26 ^ '1' ($17) ; rla
ld e,$76 ; db $26 ^ '8' ($1e)
; halt ($76)
ld a,(hl)
inc hl
push hl
xor $26
Same principle, but this time we can't use ld c,$76 since it gives $36 for the xor value. So I moved to e which starts with 1e. Also, different starting address gives two different interpretations of the data section:
$16 $17:ld d,$17$17:rla(Rotate the register A to the left)
So I had to check both are effective no-ops in this program.
x86, 15 bytes
No numbers in the source code. Returns in eax. Uses (252*4 - 1) * 2.
0: 31 c0 xor %eax,%eax
2: fe c8 dec %al
4: 48 dec %eax
5: 48 dec %eax
6: 48 dec %eax
7: d1 e0 shl %eax
9: d1 e0 shl %eax
b: 48 dec %eax
c: d1 e0 shl %eax
e: c3 ret
If we permit numbers in the source but not binary, we have mov $2014,%ax/ret for 5 bytes.
JavaScript (ES6), 52 46 bytes
t=-~'';console.log(`${++t}${t-t}${t/t}${t*t}`)
Will log through console.log the number 2014 as a string.
Thanks to Jacob for multiple optimizations saving 6 bytes
Explanation
t=-~'';
In JavaScript, ~~ will convert the proceeding value to a number, in this case, true equates to 1.
Set the value of t to 1 by using ~ on an empty string, which would equate to -1, then take the opposite of that number, 1.
For more info about tilde in JavaScript, see this article.
console.log(` ... `)
Logs the template string ... with ${} expressions available, where ... includes:
${++t}
Sets w to t+t, which would be 2, which would return the number 2. Added to string.
Set t to itself + 1, and display the final result, 2
${t-t}
Displays t-t, which would be 0, which would return the number 0.
${t/t}
Takes the value of t and divides by itself, returning 1.
${t*t}
Takes the value of w*w*w*w-w (or w ^ 4 - 1), where w (as previously set) is 2, and subtracts w from it, and returns the result. Added to string.
Takes the value of t*t (or t ^ 2), where t (as previously set) is 2.
The added expressions equate to 2014, which ... is in the log.
Julia 0.6, 9 bytes
Int('ߞ')
Just for completeness' sake. Here's 2018 (same trick, different character):
Int('ߢ')
And just for fun, here's a function using bit shifting and arithmetic instead of using character codepoints (depends on this being Julia version 0.6, which seems an appropriately golf-y hack):
Julia 0.6, 47 bytes
(l=VERSION.minor,o=true)->o<<(l+l-o)-o<<~-l-o-o
Here, o=true evaluates as 1 during arithmetic. VERSION is an inbuilt constant containing the current Julia version, and VERSION.minor is 6 in this case. We left shift 1 by 6+6-1=11, giving 2048, then subtract 1<<(6-1)=32 and 1 and 1 from it, to give 2014.
2018 version would be:
(l=VERSION.minor,o=true)->o<<(l+l-o)-o<<~-l+o+o
C# (.NET Core), 42 bytes
System.Console.Write((int)'ϯ'+(int)'ϯ');
// Btw. it's now 2018 ^^ so
System.Console.Write((int)'ϱ' + (int)'ϱ');
Stax, 4 bytes
ü◘♥┐
Obligatory Stax answer. This unpacks to 2014. Implicit print.
I haven't yet found a shorter version.
PHP, 9 bytes
This requires PHP 7.1 or lower. It will work in PHP 7.2, but it will result in a warning. No guarantees for any future version.
xxd needed because of binary data (so copying and pasting it would be easier). May return E_NOTICE, but it doesn't really matter, does it?
~ $ xxd -r > 2014.php
0000000: 3c3f 3d7e cdcf cecb 3b <?=~....;
~ $ php 2014.php
2014
Alternatively, save this using ISO-8859-1 encoding.
<?=~ÍÏÎË;
Objective-C, 27
NSLog(@"%i",'&'*('V'-'!'));
jshell, 5 bytes
How to make Java an useful code golf language? Simple, just remove the need to declare classes, methods, make things automatically print and so on.
+'ߞ'
R, 39 31 bytes:
x=T+T;x^(x*x*x+x)*x-x^(x*x)*x-x
R, also 39 31 bytes:
x=T+T;z=x*x;x^(z*x+x)*x-x^z*x-x
Thanks Scrooble!
More entertaining version: 46 bytes
z=pi;x=z*z;y=exp;j=z/y(z);floor(y(x)/(x-j-j))
Not especially efficient, but I had a lot of fun messing around with this. I'm sure there's a shorter way using just those two numbers
Long-form, subbing in the variables:
floor(exp(pi*pi)/((pi*pi) - pi/exp(pi) - pi/exp(pi))
In real-person numbers:
floor(19333.69 / (9.869604 - 0.1357605 - 0.1357605)) =
floor(2014.328)
T-SQL, 32 bytes
Based on the idea of Steve Matthews, but avoiding unprintable characters:
SELECT -~(ASCII('=')*ASCII('!'))
Alternative (but rather obvious) solution, 23 bytes:
PRINT UNICODE(N'ߞ')
Perl 5 + Perligata, 25 bytes
Byte count uses the new rule that command-line switches for choosing appropriate modules don't count.
perl -MLingua::Romana::Perligata -e'MMXIVimum egresso scribe.'
Tested in Strawberry 5.26.0 with Perligata 0.601 (with " instead of ' in the above code).
Pyt, 27 bytes
ɳąḞḞ⬠⬠⬠π⎶⁻⦋ĐąžΠ²+ĐŚřƩ½*-⁻⁻Ɩ
Not exactly a serious contender, just had some fun.
ɳ push '0123456789' as string
ą convert to array of digits [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
ḞḞ for each item in array, replace with xth fibonacci # (2x) [1, 1, 2, 3, 8, 34, 377, 17711, 9227465, 225851433717]
⬠⬠⬠ for each item in array, replace with xth pentagonal # (3x) [1, 1, 1820, 66045, 240027425, 29321506727800, 6947548864499411875070L, 165405818231059923692911546880492501L, 898044801648686628863443901192030771814779461710865094720L, 115670237695821250427139838385782853032222541808893547195455834936957002151009052998969975100L]
π⎶⁻ push pi, round, and decrement (2)
⦋ get the 2th element of that list (1820)
Đ Duplicate 1820
ąž make an array of digits and remove zeroes [1, 8, 2]
Π multiply together (16)
²+ square and add (2076)
ĐŚ Duplicate and sum digits (15)
řƩ make a range from 1 to 15 and sum all (120)
½* multiply by 1/2 (60)
- subtract (2016.0)
⁻⁻ decrement (2x) (2014.0)
Ɩ cast to integer (2014)
implicit output
C, 24
(Using GCC-4.9.2)
f(){printf("%i",'Þ');} (Properly formatted version on Pastebin)
IMPORTANT NOTE: There is a U+0007 in-front of the Þ character but stackexchange removes it for some reason. Make sure you edit it back in before compiling my code. Here is a pastebin of the code that does include the unicode characters needed.
JavaScript 59, 44, 36, 29
a=+'';b=''+a+++a++;a+++b+ ++a
Assuming alert can be skipped due to implicit return
a=+'';b=''+a+++a++;alert(a+++b+ ++a)
alert([-~-~'',+'',-~'',-~-~-~-~''].join(''))
Those are
l characters not 1
l='length';alert([[,,][l],[][l],[,][l],[,,,,][l]].join(''))
JavaScript, various solutions: 131, 44, 43, 30, 28, and 16 characters (16 bytes)
Original answer:
JS-fuck inspired JavaScript, 131 characters:
(!![]<<(!![]<<!![])<<!![]<<(!![]<<!![])<<!![]<<(!![]<<!![])<<!![]<<(!![]<<!![]))-((!![]<<!![])<<!![]<<(!![]<<!![])<<!![])-!![]-!![]
Shifty truth edition:
(true<<(true<<true)<<true<<(true<<true)<<true<<(true<<true)<<true<<(true<<true))-((true<<true)<<true<<(true<<true)<<true)-true-true
Addenda
Edit: I'm having too much fun with this... combining type coercion with hex strings, 44 characters.
a=+[];(a+'xade')-(a+'x'+(+!a+!a+!a)+a+a)
a=+[];(a+'xade')-(a+'x'+(++a+a+a)+--a+a)
a is 0, 0xade is 2782. We need to subtract 768 to get 2014. 768 is 0x300. (a+'x'+(+!a+!a+!a)+a+a) and (a+'x'+(++a+a+a)+--a+a) are two ways of producing "0x300", so the final result is "0xade" - "0x300", which JavaScript coerces back to numbers, resulting in 2014.
Here is a radix 36-based parseInt solution, 43 characters:
(a=+[]);parseInt(++a+'jy',a+++a+++''+(a+a))
First, we initiate a variable a at 0 (clearly this requires non-strict mode), increment it to 1, concatenate with 'jy' - 1jy happens to be 2014 in radix 36. The quickest way call parseInt at this radix is to generate the string "36" and abuse type coercion again: a++ + a++ results in 3, with a set to 3 as well, which means (a+a) is 6, so a+++a+++''+(a+a) results in "36", resulting in 2014.
After coming up with these two solutions I started looking at other JavaScript answers (thanks for the tip, Scrooble!), to see if combining ideas from other people gives interesting results.
Zaq's approach can be shortened with the hex string trick to 28 characters:
-~[]+!![]+[+[]]+ +(+[]+'xe')
How it works: -~[]+!![]+[+[]] results in "20", +[]+'xe' results in "0xe". +"0xe" is 14, so "20" + +"0xe" becomes "20" + 14, which becomes "2014".
Now here's a fun fact: 20 in hexadecimal is 0x14! Oh, and 14 is 0xe. So +('0x' + 0xe) produces 20. Combining this with the above results in a 30 character solution:
_=+[]+'x';+(_+ +(_+='e'))+[+_]"
Finally, initially inspired by Dan Prince's answer I came up with what might be the shortest possible JavaScript solution abusing hex-strings, at 16 characters:
+[]+'xfbc'>>!![]
0xfbc is 4028. Shift right by one, and we have 2014. If anyone knows of a shorter way to generate 0 or 1, let me know.
Edit2: having exhausted the hexadecimals, we should of course also look at binary and octal notation!
// +'0b11111011110'
+(a=+[],a+++'b'+(a+(((a+=[a]+a+a+(+[])))+a)))
// +'0o3736'
+(a=-~[],a=a+++a+++''+(a+a),+[]+'o'+((+a+1)+a))
SNOBOL4 (CSNOBOL4), 42 bytes
&UCASE 'N' @X ARB 'T' @Y
OUTPUT =Y X
END
@ assigns the index of the match and (space) concatenates them.
I know, it's 2018, so I should go home...
Canvas, 7 bytes
AA+q⁷┤t
AA | Push 10 to stack twice
+ | Add top two items in stack
q | Print top item in stack on current line
⁷ | Push 16 to stack
┤ | Decrement top item in stack twice
t | Print top item in stack on current line, disable implicit output
><>, 7 bytes
aa+nen;
aa + n e n ;
^^ ^ ^ ^ ^ ^
Push 10 to stack twice, add top two items in stack, print top item in stack as a number, push 14 to stack, print top item in stack as a number, stop.
LibreLogo (Paper Format: Tabloid), 55 bytes
The document must be in Tabloid Format for this method to work.
Code:
print ''.join(set(str(pagesize.pop()))).replace('.','')
Result:
Explanation:
pagesize ; Returns [792.0, 1224.0] (Tabloid Format)
pagesize.pop() ; Returns 1224.0
str(pagesize.pop()) ; Returns "1224.0"
set(str(pagesize.pop())) ; Returns {u'2', u'0', u'1', u'.', u'4'}
''.join(set(str(pagesize.pop()))) ; Returns "201.4"
''.join(set(str(pagesize.pop()))).replace('.','') ; Returns "2014"
PHP, 25 bytes
<?=IntlChar::ord("ߞ");?>
GolfScript, 10 8 7 chars
This solution contains non-printable characters. As xxd output:
0000000: 2714 0e27 7b7d 2f '..'{}/
As base 64:
JxQOJ3t9Lw==
Unpacks the ASCII codes for characters 20 and 14 and prints those numbers without any separation.
To actually generate the number 2014, I'm currently at 8 chars:
0000000: 2713 6a27 7b2a 7d2a '.j'{*}*
JxNqJ3sqfSo=
Takes a string containing characters with ASCII values 19 and 106 and multiplies them to get 2014.
Aceto, 10 bytes
IIppIpPiIp
Uses int(Pi) to it's advantage
11 bytes (previous answer)
IIppIpIIIIp
Simply increments from zero 2, 0, 1, and 4 times, then prints each time
Fun Version
Piddd++DsJiPidIIJi*p
Uses int(Pi) to base equations off of
Lame Version
'ߞop
Converts the codepoint to number, which is 2014
Brainf*ck
>++++++++++[<+++++>-]<.--.+.+++.
More readable version:
> Move pointer pos over
++++++++++ Add 10
[ Start loop
<+++++>- Add 5, move over & subtract 1
] End loop
<.--.+.+++. Do some other stuff
Yes, I know this is an old post, but I'm really bored and want to get enough rep to comment because I don't have access to my other account.
Pyt, 16 bytes
áŁ!⁺²Đ⁺⁺!₀⁻⁻⇹ᴇ+₅
Explanation:
á Push stack into list (pushes empty list)
Ł Get length of top of stack (0)
! 0!=1
⁺² (1+1)^2=4
Đ Duplicate top of stack
⁺⁺! (4+2)!=720
₀⁻⁻ 720/10-2=70
⇹ Swap top two items on stack (4 is on top)
ᴇ 10^4=10000
+₅ (10000+70)/5=2014
√ å ı ¥ ® Ï Ø ¿, 8 bytes
TTX''_o
The rest of the code in the TIO link is the Python interpreter (because I can't be bothered to ask Dennis to add √ å ı ¥ ® Ï Ø ¿
J - 11 bytes - Base arithmetic
+:_bj*p:_bf
Explanation
_bf and _bj are 15 and 19 in infinite base, therefore p:_bf is 15th prime, which is 53. The result is then 19*53 doubled, which is 2014.
J - 31 28 bytes - Math
(((!>:&+:)-(!>:))+:&+:)>.^*_
Explanation
The implementaion of A004126 sequence from OEIS where I searched for the ways to calculate 2014. Basically it's C(2*n+1,3)-C(n+1,3) where n=12.
This means ceiling(exp(signum(infinity))), which is 3
>.^*_
To get 12 we double it two times.
+:&+:
Everything else is a combo of a dyadic fork and monadic hook. You can read about them here.
Other's solution in J
+/(>.^*_)&u:'Happy new year to you!'
Which normally is +/3&u:'Happy new year to you!', it's a shame we need a number to work with strings.
It was fun to remember J :).
J, 21 bytes
,":,.$,:~}.,:,:'golf'
'golf' One dimensional array
,:,: Itemize twice (1x1x4 array)
}. Drop first element (0x1x4)
,:~ Append to itself as distinct items (2x0x1x4)
$ Get dimensions (2 0 1 4)
,. Flatten items, essentially prints 2014 vertically.
(so there are no spaces)
,": To strings, flatten.
20 bytes
#.(#_),,~(,~,~#_),%_
#.(#_),,~(,~$,._),%_
15 bytes
do'bbbc',~":_bd
11 bytes
,":_bk,:_be
Implicit, 3 bytes
`ߞ
implicit push command
` character
ߞ U+07DE (2014 in decimal)
implicit integer output
TI-BASIC, 12 bytes
A completely new approach.
iPart(π+iPart(e)sinh(π+√(π
This could probably be golfed further, using a 1-byte token in place of e, but I have spent far too long on this today...
VB.NET, 59 bytes
MsgBox(((Asc(vbTab) + Asc(vbTab)) & Asc("~")) / Asc(vbTab))
takes the ascii values of a Tab twice (18) concats the ascii value of "~" (126), giving "18126" and then divides the lot by ascii of a Tab (9) = 2014
Alternatively, you can do
MsgBox Asc("j") * vbKeyPause
i.e. ascii of "j" (106) * value of the constant vbKeyPause (19), for a total of 28 characters (less than half the original).
Lua, 29 bytes
b=("").byte print(b"?"..b"?")
NB: the two question marks are substitutes for characters that are not appearing properly in the post. See the tio link below for proof.
As an interesting point, although this is not the case with Lua, a language with an implementation of pi to at least 3137 digits would be able to print pi and find '2014' at digits 3133-3136!
Javascript, 37 bytes
((_=+!![])<<''+_+''+_)-(_<<_+++_+_)-_
It's not code golf until someone bitshifts.
$ node
> ((_=+!![])<<''+_+''+_)-(_<<_+++_+_)-_
2014
It is actually Javascript, I promise.
((_=+!![]) // create 1 and save in _
<< // left bitshift by 11 to get 2048
''+_+''+_ // create 11 from '1' + '1'
)
- // subtract (2048 - 32) === 2016
(
_<< // bitshift by 5 to get 32
_+++_+_ // create 5 from 1 + (++1) + 2
)-_ // subtract 2 to get 2014
Haskell, 69 bytes
How do you get a number without using any digits in the source? Lots of people had already done it with characters or strings, so I decided to use pi, predefined in most languages. From pi, you can get the numbers 3 and 4 easily using the ceiling and floor functions. Then you can use some combination of addition, subtraction, multiplication, and maybe division to get 2014. Just by experimenting around, it would be easy to figure out a function that takes in 3 and 4 and returns 2014 (such as 4^4 * 4 + 3^3*3^3 + 4*(3^4) - 4*4*4 + 4 - 3 = 2014). This one's 70 characters:
main=print$(\x y->y^y*y+x^x*x^x+y*x^y-y*y*y+y-x)(floor pi)$ceiling pi
Now, that's fine, but writing a function like that isn't much different than just repeatedly writing floor(pi) and ceiling(pi). Is it doable with only one pi? Well, in Haskell, functions can be treated as Monads with an instance defined in Control.Monad.Instances:
instance Monad ((->) r) where
return = const
f >>= k = \ r -> k (f r) r
So you can use the bind function to pass one value into two different functions: g (f x) (h x) can be rewritten f >>= flip (g.h). id >>= f can be used to pass the one value twice into the same function: id >>= (^) for example is a function that returns x to the x power. The resulting program at 207 characters is more obfuscated than golfed, but it was fun to write:
import Control.Monad.Instances
main=print.((id>>=(^)>>=flip((+).(id>>=(+)>>=flip((+).(id>>=(-)>>=flip((+).(id>>=div))))))).floor>>=flip((-).(id>>=(^)>>=flip((*).(round.sqrt.fromInteger>>=(*)))).ceiling))$pi
JSFuck, 1267 bytes
In Javascript, here is the alert(2014) ! (Try in browser Console).
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+[!+[]+!+[]]+[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()
This sample uses only six different characters to write and execute code. This was generated by https://github.com/aemkei/jsfuck.
Mathematica, 47 bytes
Total@ToCharacterCode@"Happy New Year for all!"
2014
Golfscript, 6 chars
{xy}.*
Inspired from Peter Taylor's answer.
This solution involves non-printable characters too.
Where x and y represent 20 and 14 in ASCII (the non-printable characters we were talking about before).
LiveScript, 18 bytes
The temporary solution
new Date!.getYear!
Unicode
\ߞ .charCodeAt!
Over Excitement
x=!Happy
Happy = -> console.log it
New = -> +it
Year = ->++x and Year
Year.valueOf = -> x
Happy New Year!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Clojure, 9 bytes
Inspired by the Matlab answer, converts char \u075e to an int:
(int \ߞ)
Racket, 18 bytes
(~a(+ #xa #xa)#xe)
Charcoal, 5 bytes
I²⁰¹⁴
Language was created after January 1, 2014, but as Charcoal uses the superindices ⁰¹²³⁴⁵⁶⁷⁸⁹ to represent the numbers, the answer is valid. :-)
Lua, 27 bytes
Should work in Lua 5.1, Lua 5.2, and Lua 5.3.
x="ɅɅ"print(x:byte()..#x)
This is mean to be saved with the UTF-8 encoding. The first byte of the string is 201, and its length is four. Lua is mostly encoding agnostic, so as long as these things are true in whatever encoding, it works.
With only ASCII, 28 bytes:
x=""io.write(x:byte(y,#x))
Note: the string must contain ASCII 20 and ASCII 14 (which are not printable characters). y here is an undefined variable, so it is nil, which byte defaults to 1 in the first parameter.
Ruby (8 bytes, 7 chars)
'ߞ'.ord
The question mark is ߞ represented in two bytes UTF8.

Clojure - 35 characters ASCII only
(print(-(*(int\#)(int\<))(int\V)))
Based on True Soft's answer
JavaScript, 81 76 bytes
l="length";alert(("hi"[l]<<"javascript"[l])-"wow"[l]*"hello death"[l]-true);
Whitespace, 19 bytes
Visible representation:
SSSTTTTTSTTTTSNTNST
Just pushes 2014 onto the stack and prints it. Whitespace's lack of any visible characters makes this pretty easy.
Valid as numbers are completely valid tokens in whitespace, they just don't do anything.
Vim 7.4, 18 bytes
:h os_v<CR>$bbbyiwZZp
Here, <CR> means a literal newline. Uses the help page os_vms.txt which contains the number 2014 on the first line.
How it works:
:h os_v<CR> This opens the help page for os_vms.txt, the line the cursor lands on contains '2014'.
$bbb Move the cursor to the '2014' (end-back-back-back)
yiw Copy it (yank-in-word)
ZZ Close the help page
p Paste the copied word
If numbers were allowed we could do:
i2014
Braingolf, 3 bytes
#ߞ
The ordinal of ߞ is 2014, # pushes the ordinal of the next character to the stack, and Braingolf implicitly outputs the last item on the stack.
Go, 2 bytes (UTF-16)
One unicode character (2 bytes in UTF-16, 3 bytes in UTF-8 format), output 2014 as part of an error
—
can't load package: package :
prog.go:1:1: illegal character U+2014 '—'
Python 3, 16 Bytes :
print(ord('ߞ'))
2017 version, 16 Bytes :
print(ord('ߡ'))
C, 29 bytes (Emacs) / 40 bytes (VI)
Before creating program, execute the shell command
stty -ixon ### 11 bytes, with the newline
N.B this is required for most terminal editors, but is not required for emacs
then write this code:
main(){printf("%d",'j'*'^S');}
N.B. '^S' is a single XOFF character e.g. in VI use control-V, control-S; in emacs use control-Q, control-S; emacs turns off flow control by default.
I assume the comment [You can't type ^S in a Linux terminal] below left off an implied [without the stty command or equivalent e.g. emacs default behavior upon startup], otherwise that comment is inaccurate.
And here is the requested hexdump:
$ od -a -t x1 x.c
0000000 m a i n ( ) { p r i n t f ( " %
6d 61 69 6e 28 29 7b 70 72 69 6e 74 66 28 22 25
0000020 d " , ' j ' * ' dc3 ' ) ; } nl
64 22 2c 27 6a 27 2a 27 13 27 29 3b 7d 0a
Fourier, 12 bytes
Non-competing: Fourier is newer than the challenge
I know I'm two years too late, but it seemed like a fun challenge to do in Fourier.
^^ovvo^o^^^o
The command ^ increments the value of the accumulator (which starts at zero) and v decrements the value of the accumulator.
C, 25 bytes
f(){printf("%d",L'ߞ');}
24 characters, but one character is UTF-8 encoded. Still the shortest C answer! How it works:
U+07DE ߞ NKO LETTER KA
7DE in decimal is 2014.
C, 33 30 bytes
Numerical Solution 1
f(){printf("%d",'<'*'#'-'V');}
// 2014 = 60 * 35 - 86
C, 86 83 bytes
Numerical Solution 2
#define A ((int)'}')
#define B (((int)'r')-((int)'d'))
f(){printf("%d",A*B+A+A+B);}
// A = 125
// B = 14
// 2014 = 125*14 + 125 + 125 + 14
C, 53 50 bytes
ASCII Art 1
f(){printf("┌┐ ┌┐ ┐ ┐┌\n┌┘ ││ │ └┤\n└┘ └┘ ┴ ┴");}
Result
┌┐ ┌┐ ┐ ┐┌
┌┘ ││ │ └┤
└┘ └┘ ┴ ┴
C, 94 91 bytes
ASCII Art 2
f(){printf("╔═╗ ╔═╗ ╗ ╦ ╦\n ║ ║ ║ ║ ║ ║\n╔═╝ ║ ║ ║ ╚═╣\n║ ║ ║ ║ ║\n╚═╝ ╚═╝ ╩ ╩\n");}
Result
╔═╗ ╔═╗ ╗ ╦ ╦
║ ║ ║ ║ ║ ║
╔═╝ ║ ║ ║ ╚═╣
║ ║ ║ ║ ║
╚═╝ ╚═╝ ╩ ╩
Sinclair ZX81 15 bytes 10 bytes
PRINT CODE "=";CODE ":"
As the ZX81 has a non-ASCII compatible character set, the character code for = is 20 and for : it is 14 - simples.
SmileBASIC, 10 bytes
?&HFBC>>!.
&HFBC is hexadecimal for 2014*2, which is right shifted by not(0.0)
?ASC("ߞ") looks shorter, but it's actually the same length when saved in UTF-8, and about 100000x more boring.
Groovy, casting to int, 8 bytes
(int)'ߞ'
Brain-Flak, 46 + 3 = 49
(([()]([(()()())]((((({}){}){}()){}){})))()())
This one uses the -A flag for +3 bytes. It pushes the ASCII values for 2014 to the stack which outputs as 2014 in ASCII mode.
Javascript, 18 characters
alert(btoa('ÛMx'))
Update: in ES6, using a template literal can save two characters:
alert(btoa`ÛMx`)
The code above is fairly easy to understand by keeping in mind that btoa converts a string into another string according to a set of well-defined rules (RFC 4648). To see how the conversion works, we're going to write the input string "ÛMx" as a sequence of binary digits, where each character is rendered as its 8-bit character code.
Input character | Û | M | x Character code (decimal) | 219 | 77 | 120 Character code (binary) | 11011011 | 01001101 | 01111000
After reorganizing the binary digits in the last row in groups of 6, we get the binary representation of 4 new numbers, corresponding to the Base64 indices of the 4 characters in the string "2014".
Base64 index (binary) | 110110 | 110100 | 110101 | 111000 Base64 index (decimal) | 54 | 52 | 53 | 56 Output character | 2 | 0 | 1 | 4
As per HTML specification, the output characters can be retrieved from their Base64 indices according to this table: http://dev.w3.org/html5/spec-LC/webappapis.html#base64-table.
If you don't care about the details, you could let the browser do the calculations for you and find out that "ÛMx" is the result of evaluating atob('2014') in Javascript.
Pyke, 3 bytes, noncompetitive
w߾
Where ߾ is 0xDFBE
Loads ord(0xDFBD-0x20) as an integer and implicit prints it
Microscript, 10 bytes
Noncompeting, language postdates the question..
'js'(s';-*
Explanation: 106*(59-40), using the language's equivalent of character literals. I'd do 53*38, but the character corresponding to 53... is the digit 5. And the character corresponding to 19 is, of course, nonprintable, so that wouldn't work.
EXCEL: 148 bytes
=POWER(ROW()+ROW(),(ROW()+ROW()+ROW())*(ROW()+ROW()+ROW())+ROW()+ROW())-(POWER(ROW()+ROW(),ROW()+ROW()+ROW())*(ROW()+ROW()+ROW()+ROW())+ROW())-ROW()
only works in A1.
PHP, 27 bytes
not in any way competitive to xfix´s solution, but here are a few versions with 27 bytes each:
<?=hexdec($c=hexdec(e)),$c; # e->14->20, e->14
<?=ord(U)-ord(A),hexdec(e); # 85-65,14
<?=($c=ord(","))*$c+ord(N); # 44*44+78
<?=($c=ord("."))*$c-ord(f); # 46*46-102
The first one already has been posted by brother Filip; but the others have not.
This one has 37 bytes, but I like it (inspired by the Calculator solution)
<?=dechex(hexdec(dfeb)^hexdec(ffff));
or 13 bytes with
<?=sqpu^AAAA;
But that idea has already been used by primo
Pushy, 6 bytes
`��`j#
Contains control characters, so here's a hexdump:
0000-0006: 60 14 0e 60 6a 23
The first unprintable is the literal DC4 byte (\x14), and the second is SHIFT-OUT (\x0e).
First these bytes are pushed as charcodes, so the stack is [20, 14]. The j operator concatenates these and # outputs the result: "2014".
10-byte solution:
`<:;>`KT-"
Uses char-code manipulation and the builtin T (10).
`<:;>` Push string as char-codes: [60, 58, 59, 62]
KT- Take 10 from each: [50, 48, 49, 52]
" Interpret as char-codes and print: results in "2014"
Brain-Flak, 50 bytes
((((((()()()()()){}){})){}{}()){()()({}[()])}{}())
Brain-flak is great for restricted source challenges because there are only 8 valid character to begin with: brackets. (e.g. []{}()<>).
This was made possible with the help of @ASCII-only's integer metagolfer, which is currently hosted online at brain-flak.github.io/integer
Vim 8.0, 15 bytes
:h u
ggf:wywZZp
I didn't see a vim answer yet, so I figured I'd add one. This opens up a helpfile, so it is specifically vim 8.0, since it might not work with a future version that updates that file.
The Shakespeare Programming Language, 219 bytes
I am using drsam94's compiler.
.
Ajax,.
Puck,.
Act I:
Scene I:
[Enter Ajax and Puck]
Ajax:
You is the difference between a fat fat fat fat fat fat fat fat fat fat fat cat and the sum of a fat fat fat fat fat cat and a fat cat!Open thy heart!
[Exeunt]
Explanation
.
Everything from the first line to the first period is the title, parsed as a comment.
Ajax,.
Puck,.
These are characters from Shakespeare's plays, and descriptions (also comments)
Act I:
Scene I:
Act I and Scene I, used for gotos (not used here)
Ajax:
The character speaking.
You is the difference between
Assigns the difference of the next two values to the character being spoken to.
a fat fat fat fat fat fat fat fat fat fat fat cat
Every adjective multiplies by 2, a noun is either 1 or -1 depending on its connotation (in this case it's 1). 2^11 * 1 = 2048.
the sum of a fat fat fat fat fat cat and a fat cat
The sum of the next two values. 32 + 2 = 34, so 2048 - 34 = 2014
Open thy heart!
Prints the value of the character being spoken to as a number.
Mouse-2002, 4 bytes.
That's 4 bytes of pure, sweet ASCII.
In Mouse, the letters of the alphabet are initialised to the values 0-25. ! is the operator for printing integers, thus this prints 20 then 14 (no intermittent newline).
U!O!
There's no online interpreter available, but here you will find an interpreter written in C (needing some tweaks before one can coerce gcc to compile it) and the same compiled interpreter for Win32 but which works perfectly on Linux with wine.
Here you can find the fixed version of the interpreter, which compiles.
QBIC, 10 bytes - Not Competing
?z^s*r+z+t
Calculates 2014 from the pre-initialised variables q-z (1-10) and prints it. Development of QBIC started some two years after 2014...
Alternative 12-byte version:
?(u*y)^r-z-q
Java 8, 33 bytes
()->Integer.parseInt("bbc",'\r');
Actually, 15 bytes
This language was created long after this challenge was made, but I thought I'd still try my hand at it. This answer avoids all numerals, including Actually's ² for a*a. Golfing suggestions welcome. Try it online!
╜⌐u;*⌐úl¬¬τu;*-
Ungolfing
╜ Push register 0 (initialized to 0).
⌐u Add 2 and increment. Returns 3.
;* Duplicate and multiply. Equivalent to squaring. Returns 9.
⌐ Add 2 again. Returns 11.
úl Pushes the lowercase alphabet and gets its length. Returns 26.
¬¬ Subtracts 2 twice. Returns 22.
τ double(). Returns 44.
u Increment. Returns 45.
;* Square. Returns 2025.
- Subtract. Returns 2025 - 11 == 2014.
Mathematica, 16 bytes
FromDigits@"JAE"
Swift 2.2, 28 bytes
print("\(ENOTDIR)\(EFAULT)")
Falling back on Darwin/glibc error codes from errno.h.
Lua, 32 bytes
print(#'XX'..#''..#'X'..#'XXXX')
This makes use of the length operator # used on string literals to get numbers, and the lengths are concatenated (with ..) to print 2014
C (gcc 5.3.1), 49 bytes
Pure arithmetic! \o/
main(a){printf("%d",(++a<<(a<<a|a))-(a<<a+a)-a);}
Undefined behaviours.
Specifically, use this compiler (languages are defined by implementation).
Without undefined behaviour (which would work on all compilers), 51 bytes
main(a){a++;printf("%d",(a<<(a<<a|a))-(a<<a+a)-a);}
Explanation
Basically 2048 - 32 - 2, constructed using powers of 2.
VBA, 21 characters
?cells(,"BYL").column
Write and run the above code in the Immediate Window. Basically, the code converts column name BYL to its column index (2014).
Mathematica, 10 bytes
N[E,E^E^E]
Prints the decimal expansion of the number e to over 3.8 million decimal places. The first occurrence of 2014 in that decimal expansion starts at the 3180th decimal place.
JavaScript, 17 Bytes
atob("MjAxNA==")
JavaScript, 9 bytes
btoa`ÛMx`
This Base-64 encodes ÛMx to make 2014.
Factor, 10 bytes
Not gonna beat my winning answer, but as a follow-on to the other "2014th Unicode char" answers:
CHAR: ߞ .
Prints 2014.
C++, 50 bytes
#include<iostream>
int main(){std::cout<<'U'^'A';}
Retina, 24 bytes (newer than challenge)
Note the trailing space on lines 2 and 3. Language is newer than the challenge.
xx x xxxx
+`(x)*
$#+
Windows Calculator - 5 characters
Inspired by this answer to a different question.
Open the Windows Calculator in Programmer View (Hex mode) and type:
DFEC±
This is what the result looks like.

BASIC v2.0 (Commodore 64), 24 bytes
PRINT ASC("&")*(ASC("V")-ASC("!"))
The Commodore BASIC tokens are single-byte representations of BASIC keywords. This should result in storing the above line as 24 bytes instead of 34.
I was aiming to construct an equation based on character codes, so I was looking for ideal characters in PETSCII. To minimize the number of operations in the equation, it seemed like a good idea picking a pair of divisors of 2014.
However, none of the combinations were perfect, because either one of the divisors were too large, too small or the character code of a number.
So I ended up using 38 which is CHR$("&") and 53, but instead of directly using the latter which is CHR$("5"), I used the difference of 86 and 33. These are the character codes for CHR$("V") and CHR$("!") respectively.
MATLAB (no char codes), 47 chars
p=pi,q=p^p;e=exp(p);floor(q*q+q*e-q-q-q-p-e-e)
Japt, 3 bytes (2 chars)
Japt is newer than this competition (created in 2015), but was not created specifically to answer it.
#ߞ
That's right. 2 chars. Explanation:
# // Char-code of next character
ߞ // Character with char-code of 2014
// Implicit output
Jolf, 3 bytes
(It's almost 2016. Language obviously postdates question.)
@ߞ
@ Get charcode of next character
ߞ charcode 2014
Milky Way 1.0.0, 22 bytes
<^a:::+;:l+:>h<::++-<-
Explanation
< < < # rotate the stack leftward
^ # pop the TOS without outputting
a # logical not on the TOS
::: : :: # duplicate the TOS
+ ++ # push the sum the top two stack elements
; # swap the top two stack elements
> # rotate the stack rightward
h # push the TOS to the power of the second stack element
- - # push the difference of the top two stack elements
The stack defaults to ["", 0].
Stack Visualization
["", 0] # default stack
[0, ""] # <
[0] # ^
[1] # a
[1, 1, 1, 1] # :::
[1, 1, 2] # +
[1, 2, 1] # ;
[1, 2, 1, 1] # :
[1, 2, 1, 10] # l
[1, 2, 11] # +
[1, 2, 11, 11] # :
[11, 1, 2, 11] # >
[11, 1, 2048] # h
[1, 2048, 11] # <
[1, 2048, 11, 11, 11] # ::
[1, 2048, 33] # ++
[1, 2015] # -
[2015, 1] # <
[2014] # -
By default, if nothing has been output manually, the bottom stack item is output on termination of the program.
Milky Way (current version), 8 bytes
XZ*W+U+!
Explanation
X # push 20 to the stack
Z # push 100 to the stack
* # push the product of the TOS and STOS
W # push 10 to the stack
+ + # push the sum of the TOS and STOS
U # push 4 to the stack
! # output the TOS
T-SQL 27 bytes
PRINT ASCII('')*ASCII('j')
Note that the character that isn't rendered here is the DC3 (CHAR(19)) in the first set of quote marks. It's unicode U+009F which, it would appear, doesn't copy and paste here too well but I can assure you it works in SQL Management Studio.
Perl 5, 8 28 bytes
say 38*53
Seems to do it.
Oh, without cheating ?
$z=ord("!")*ord("=");say++$z
T-SQL, 50 40
My original entry seems too straightforward. How's this?
PRINT RIGHT(CHECKSUM(',,.'),LEN('````'))
(Disclaimer: Given Steve Matthews's comment, the above may be dependent on configuration.)
Here's the SELECT version in SQL Server 2012.
Original entry:
This may look obscene in more ways than one, but it's valid.
DECLARE @ INT=\PRINT CONCAT(-~-~@,@,-~@,-~-~-~-~@)
Try it in SQL Server 2012. Here is a version using SELECT.
Explanation: "\" is a valid currency symbol. (Do a find for "String to" here.) If you assign just a currency symbol to an INT variable, you store 0. Also, "@" is a valid variable name. "~" is bitwise NOT, and "-" is negative. If you negate a NOT-ed INT, you get the INT plus 1. So, repeat "-~" until you make @ into the digit you need. Then CONCAT() your digits.
MATLAB, Scala (4 characters, 5 bytes)
You can take advantage of MATLAB's (and Scala's) relatively weak type system, here.
The trick is to apply the unary + operation on a string composed only of the character ߞ (of UTF-8 code point U+07DE, or 2014 in decimal). This operation implicitly converts the string to a double (in MATLAB) and to an Int (in Scala):
+'ߞ'
Byte-count details:
+is ASCII and counts for 1 byte'is ASCII and counts for 1 byte (but appears twice in the expression)ߞis a 2-byte UTF-8 character
Total: 5 bytes
TeX (32 26 characters, as many bytes)
\def~{\the\catcode`}~}~\\~\%\bye
An even shorter alternative (proposed by Joseph Wright) is
\number`^^T\number`^^N\bye
XeTeX/LuaTeX (13 characters, 14 bytes)
If XeTeX or LuaTeX are allowed, UTF-8 input can be used directly (as proposed by Joseph Wright):
\number`ߞ\bye
Hassium, 77 Bytes
Really excited about this one. It gets Math.pi and divides it by itself in variable a (1), then uses increment and basic math operators to get it to 2014.
use Math;func main(){a=Math.pi;a/=a;print(++a)print(a-a)print(a/a)print(a*a)}
Run online and see expanded here
Groovy, 48 bytes
For 2015 change cabe to cabf...
n={it.each{print(((int)it)-(int)'a')}}
n('cabe')
Vitsy, 5 4 Bytes, 3 Characters
When in Rome...
'Nߞ
Get the character with the value 2014 and then print it as a number. Simple.
More Interesting Version (12 10 9 Bytes):
"ca-^b-N-
My language supports hexadecimal, too. ;)
" Capture the entire source as string by looping around the source.
ca- Push 2 to the stack
^ 45^2
b- -11
N Output as a number.
- Only here for character value 45.
TeaScript, 7 bytes
'ߞ'c()
Takes the char code of the character with a char code of 2014
q, 20 17 bytes
{x+y*z}."j"$"$+."
C, 24 / 68
main(){printf("MMXIV");}
Haha, Roman Numerals For The Win!
Or, for real:
main(){printf("%i%i%i%i",strlen("aa"),nil,strlen("a"),sizeof(int));}
Cardinal, 14 chars
%n=*+.-d++.
d
The pointer starts at %, reads in the character ‘d’(ASCII 100), creates a duplicate as inactive value (the bottom of the stack), adds active and inactive values, resulting in 200, adds 1, prints out the result 201, subtracts one, divides by inactive value (100), resulting in 2, adds two, prints out 4.
Cardinal pointer stacks can only carry values up to 255 (OEM 437 range), everything above leads to a wrap-around.
0 100 100 200 201
0 0 100 100 100
>n=*+.-d++. %>=*+.-d++. %n>*+.-d++. %n=>+.-d++. %n=*>.-d++.
d d d d d
———————————————————————————————————————————————————————————————————————
201 200 2 3 4
100 100 100 100 100
%n=*+>-d++. %n=*+.>d++. %n=*+.->++. %n=*+.-d>+. %n=*+.-d+>.
print:"201"
———————————————————————————————————————————————————————————————————————
4
100
%n=*+.-d++>
print:"4"
Result:
Executing program..
2014
Execution complete.
Ruby, 15
p Time.new.year
Temporary ;)
Note that the section of the question
independently of any external variables such as the date or time or a random seed
was not edited in until long after I posted my answer...
Jan Dvorak offers a great alternative in the comments:
Happy = Time
Happy.new.year
But it's so unenthusiastic. I prefer:
Happy = Time
class Time; alias year! year; end
Happy.new.year!
Or even:
class Have; def self.a; A.new; end; end
class A; def happy; Time; end; end
class Time; alias year! year; end
Have.a.happy.new.year!
And here's correct English punctuation:
def noop x = nil; end
alias a noop
alias happy noop
alias new noop
alias year! noop
def Have x
p Time.new.year
end
Have a happy new year!
Okay okay, I couldn't help it:
def noop x = nil; end
eval %w[we wish you a merry christmas! christmas and a happy new].map{|x|"alias #{x} noop"}*"\n"
def year!; p Time.new.year; end
we wish you a merry christmas! we wish you a merry christmas!
we wish you a merry christmas and a happy new year!
Python (30 chars)
(10 + 9) * 106 = 2014
(ord('\t')+ord('\n'))*ord('j')
JavaScript (19)
Obvious cheating, but these expression ran in REPL print strings "2014" and "2015":
''+'ߞ'.charCodeAt() // 2014
''+'ߟ'.charCodeAt() //2015
TIL: .charCodeAt implicitly converts it's first argument to 0.
Excel VBA, 51 bytes
MsgBox Len("aa") & Len("") & Len("a") & Len("four")
As it's 2015 you could add an extra character onto "four" for an extra byte.
CMD - 42 bytes
set/aa=f
set/a%a%xAAA-%a%xFF-%a%xFF-%a%xCE
The 'trick' is that when using the /a switch on the set command, letters (and other invalid characters) are evaluated as 0. I then just use hexadecimal to evaluate 2014. The 0 is needed because in CMD hexadecimal must be expressed with the leading 0x. There is almost definitely a shorter way to get to 2014...
%a%xAAA - %a%xFF - %a%xFF - %a%xCE = 2730 - 255 - 255 - 206 = 2014
x86 machine code, 19 bytes
B8 3A 0E 2C 08 CD 10 2C 02 CD 10 04 01 CD 10 04 04 CD 10
Assembly code equivalent:
mov ax, 0E3Ah; ah = 0Eh (bios teletype), al = 3Ah (ascii semicolon)
sub al, 08h; ascii 2
int 10h
sub al, 02h; ascii 0
int 10h
add al, 01h; ascii 1
int 10h
add al, 04h; ascii 5
int 10h
Yeah, I know: it logs 2015 rather than 2014.
But seeing that this challenge is old and now the year is 2015, it seemed more appropriate to use the current year (it's my excuse for not "going home" :) )
Note: This was tested using DOSBOX
Python 2, 68 bytes
Not really short, but it abuses the fact that Python accepts booleans where an integer is required, because bool is a subclass of int.
import string;d=string.digits;T=True;print d[T+T]+d[:T+T]+d[T+T+T+T]
Insomnia, 7
Each line is one program doing the same thing: print 2014 to output stream.
e}u#Hi-
e}u#Hs-
e}u#H}-
e}g#*i-
e}g#*s-
e}g#*}-
e}gKHi-
e}gKH}-
e}gKxi-
e}gKxs-
e}gKx}-
e}u#dK-
e}u#eK-
e}u#fK-
e}gKdK-
e}gKeK-
e}gKfK-
Python 2 (19 bytes, ASCII only, CPython-specific)
print hash("w_'qe")
Tested only on 64-bit, but I assume/hope that since 2014 is small and positive the results would be the same on 32-bit? Originally tested on Python 3, but ProgramFOX confirms it also works on Python 2.
Python 3 (31 bytes, ASCII only)
print(ord("\N{NKO LETTER KA}"))
Quite fond of this one, even though better solutions exist. The equivalent Python 2 code is no shorter, as it required a u string prefix.
C++ 30
main(){cout<<('&')*(']'-'(');}
JavaScript, 24 bytes
A bit long, but no idea how this way got left out...
alert("ߞ".charCodeAt())
Explanation
The character ߞ is obtained by doing String.fromCharCode(2014) . Thus the code is actually just converting that character back to its character code and alerting it.
Thanks to hsl for this shorter version
Lua - 30 bytes
b=#" "print(b..b-b..b/b..b+b)
# is the length operator, so b = 2.
Racket: 20 (19 chars)
(char->integer #\ߞ)
ߞ is a unicode character that has 2014 as it's code.
This abuses the fact that every top level form gets its evaluation printed to stdout. This is quite unique amongst LISPs which usualy only have this behaviour in the REPL and not when running programs.
Scheme: 29 bytes (28 chars)
(display(char->integer #\ߞ))
I and others have posted shorter Mathematica solutions to this challenge, but here are two methods that I don't believe have been tried in any of the other examples, in any languages.
Mathematica, 27 characters / 27 bytes
FromDigits["MMXIV", "Roman"]
Mathematica, 37 characters / 37 bytes
(ToString /@ FromDigits /@ {"K", "E"}) <> ""
and the following 58 character variation
FromDigits[Flatten[IntegerDigits /@ FromDigits /@ {"K", "E"}]]
C#, 4 characters, 5 bytes
+'ߞ'
Note: you need LINQPad to run it, not Visual Studio. LinqPad is good for CodeGolfing in C#.
Xojo, 27 chars (all ASCII)
MsgBox Str(&hFBC/(&hC-&hA))
(Java, 553 bytes as .class, 112 bytes as it stands, 84 bytes after renaming the class to 'm' and removing whitespace.)
This probably isn't the kind of answer you're looking for, but there are a bunch of strings that share a hashcode of 2014.
public class make2014 {
public static void main(String[] args){
System.out.println("={".hashCode());
}
}
C, 27 Bytes
main(){printf("%d",'\aÞ');}
Just a reminder that multi-character constants do exist :)
Alternatively, three bytes more:
main(){printf("%x",' i'-'U');}
awk (28)
There's definitely a need for an "awky" answer... ;-)
BEGIN{print++I+I--I++I++I*I}
...oookaaayyy... the last * may be a + too. But please don't call it an "awkf*ck" solution then... ;-)
BEGIN{print++I+I--I++I++I+I}
I think, I prefer the later version now because of less different characters...
(tested with gawk and mawk)
Marbelous 14
CB
CE
CF
CD
~~
How it works
the first 4 lines are language literals, in hexadecimal. Their values are 203, 206, 207 and 205. They will fall down by one cell on each tick. If you perform an 8-bit binary not on those values (which is exactly what ~~ does) you get the following values: 52, 49, 48 and 50. These values happen to be the ascii values of 4, 1, 0 and 2 respectively. The literals then fall off the board which causes their corresponding ascii character to be printed to STDOUT.
TI-Basic, 49 41 31
π/π+π/π→B:B^B^B→C:C^C(C/B)-CB-B
Explanation
π/π+π/π→BStore 2 in B:B^B^B→CStore 16 in C:C^C(C/B)-CB-BDisplay2014
J (13)
#.a.i.'_!!! '
Interprets the ASCII value of _!!! (95 33 33 33 32) as a binary number (it's weird that this is possible, I agree). This produces 2014.
J (15)
This one doesn't use any character strings. It's based on the weird coincidence that the sum of the first 46 primes is 4028: double 2014.
-:+/p:i.<:+:_bn
If anyone knows of a shorter way than <:+:_bn to represent 45 (preferably without strings), please let me know.
Python, 55 bytes (no math import and no char or unicode trickery!)
x=False;a=x**x;b=a+a;c=b+b;print c**c*(c+c)-b**(c+a)-b
Uses the fact that zero to the zeroth power is defined as one and False can be implicitly casted to 0. Hence a, b and c will contain 1, 2 and 4 respectively.
Python, 8 characters
ord('ߞ')
I think this ought to be valid :P
Ok, if you want me to use print(),
15 characters
print(ord('ߞ'))
Julia, 13 characters
('x'-'e')*'j'
In Julia, most arithmetic operations, when applied to a single character, convert this character to its ASCII integer value. x, e and j are respectively 120, 101 and 106, therefore (120-101)*106 is 19*106=2014.
julia> ('x'-'e')*'j'
2014
Edit: 11 characters, thanks to Glen O
A different choice of characters allows us to skip parentheses:
'.'*'.'-'f'
><> (9 bytes ASCII)
In pure ASCII,
'd!:'*+n;
This pushes d, !, and : to the stack, then multiplies the numerical values of top two entries, and adds the value of the last entry before outputting the value on top of the stack as a number and ending.
Using Unicode this can be reduced to 6 bytes:
'ߞ'n;
Simply outputs the numerical value of ߞ and ends.
Pure bash 18
Without fork!
echo $[$[$#xd]#bbc]
2014
Java without the weird unicode charas @ 115
enum A{A;public static void main(String[]z){int a=A.ordinal(),b=a++;System.out.print(""+(a<<a)+b+a+(a<<(a<<a)));}}
enumerators are pretty handy :)
Bash - 10 (or 8)
Well there have been a couple of answers that have been disqualified because they rely on the year. When golfing, one side goal is to see how close we can get to breaking the rules as currently written without breaking the letter of the rules (I include the clarifications by Joe Z in the 66 existing comments on the rules). The question very specifically states that I can not depend on 2014 being the current year. I instead rely on it being 8:14pm in my timezone.
date +%H%M
When I ran it, it output 2014 exactly, thus it satisfies it No, it has to be 2014 exactly. comment. (Due to context people seem to misread it as ... 2014 always, but that was not what was written, even if that were perhaps what was intended.) This lets me beat the current Bash record, at least until this loophole is closed. This interpretation may seem too cheaty since all the existing popular answers assume that the rules really meant always. Indeed some of them exploit this and export something that isn't exactly 2014, but instead contains 2014. I am fine with that interpretation too since Bash can do:
cat /*/*
This is a mere 8 characters, which will concatenates a bunch of files including /dev/urandom/, and it generally takes my machine under a minute to find 2014 in /dev/urandom. Although my rule twisting golfing code of honour won't let me pick this solution since it violates the letter of Joe Z's clarification, the only objection Joe Z raised to the random approach in the 66 comments was that it was too long. At 8 characters this answer is actually shorter than my rules-lawyer answer.
JavaScript 45
alert(parseInt('bbc','twentyonefour'.length))
e-TeX, 21 bytes
\the\numexpr`*`j\bye
It contains an invisible control character with code 19 (0x13) before the asterisk. A version with printable ASCII characters needs two more bytes:
\the\numexpr`^^S*`j\bye
In TeX ` takes the character code of the next token:
[0x13](^^S): 19j: 106
\numexpr calculates: 19 * 106 = 2014
The result is a DVI file with "2014" on the first page.
Variant with 2014 as page number:
\pageno\numexpr`^^S*`j~\bye
(25 bytes, if ^^S is replaced by the byte with character code 19).
You never said we couldn't put it on an external page!
Javascript - 19 Chars
location='//x.vu/u'
PS. It took 2 tries to get a shortened URL without numbers :P
k [16 chars]
(*/"i"$".,")-@""
2014
Explanation
Get the ASCII value of ",.".
"i"$".,"
46 44
Find the product
*/"i"$".,"
2024
Get the data type of char.
@""
10h
On running the complete code (2024-10)
(*/"i"$".,")-@""
2014
~-~! (No Comment), 41
Pretty basic solution.
'=~~~~~:''=~~,','@'':@''-~~:@''-~:@''+~~:
Pretty good for just 8 unique characters, eh? xD So this could theoretically be stored in 123 bits, or ~15.4 bytes.
Bash 28
echo $((`printf %d \':`#yG))
Similar to the Ruby and Python solutions, but uses base62, now without literal 6 and 2 (but pretty long...)! Using base58 as recommended by @DigitalTrauma along with removing quotes around the printf format string, Thanks!
Better 17 (Thanks @user13955 and @DigitalTrauma!)
tr a-l /-:<<<dbcf
"It's shorthand for tr abcdefghijkl /0123456789:. Not very geeky, I'm afraid." -user13955 Also updated to use a heredoc instead of echo, thanks @DigitalTrauma!
Delphi (26bytes & 26 chars)
ord('-')*ord('/')-ord('e')
Ascii values
- : 45
/ : 47
e : 101
45*47 = 2115 - 101 = 2014
k 11 & 17 chars
this 11-char one is from a colleague
@:[:']*.(.)
this 17-char one is the best i could come up with on my own; it's a variant on ASCII abuse:
.,/$-/"i"$$`zz`fl
and just for interest, here are a few others of mine:
."c"$"RPQT"-"e"$" " / ascii (only 2.x)
."c"$-/"e"$("RPQT";" ") / ascii (all versions)
-_-(s*(exp acos@-`=`)xexp x)-(s xexp s:x*x)%x:+/``=`` / port of David Carraher's solution above
.,/$#:'(``;();`;````) / another approach
PHP, 22 bytes
echo ord('').ord('')
Edit
SE is stripping the characters. Working version here: http://codepad.org/unzjXNY2.
R using roman numbers, 29 characters
as.numeric(as.roman('MMXIV'))
PYTHON
print(str(len('Happy new year to me')) + str(len('Happy new year')))
x86 - 16 bytes (Assembled)
This little snippet moves the stack so it overlaps the video memory, to then push the individual numbers straight to the screen (They even blink! Surely a sign of good times to come).
Code: (Note: '0'-'9' -> 0x30-0x39)
B890A8 8ED0 2C5C 50 2C04 50 48 50 40 40 50
Assembled from:
mov ax, 0xA890
mov ss, ax
sub al, 0x5c
push ax
sub al, 3
push ax
dec ax
push ax
inc ax
inc ax
push ax
Build'n run:
nasm -f bin -o 2014.com 2014.asm
dosbox 2014.com
SAS, 34 characters/bytes
data a;x=put(' ',hex.);put x;run;
That puts it to the log, it's 6 longer if you need it to the output window. Note I'm not seeing the second character there; it is backwards-P, which is hex 14.
There should be a shorter solution with %sysfunc(putc(..., but I can't get that to work properly.
Python, 23
print ord("<DC3>")*ord("j")
<DC3> should be replaced with ASCII symbol 19 (device control 3).
Javascript: 47 characters
Not the shortest, but another solution:
$ node
> [!+[]+!+[]]+[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]]
"2014"
Javascript: 6 characters
Your task is to make a program that prints the number 2014 without using any of the characters
0123456789
Ok, here you go: 6 characters.
$ node
> "²⁰¹⁴"
'²⁰¹⁴'
Yeah, only for ASCII lowers. :-)
Will I win? :-D
Python3.4.0b2 (0 bytes)
% python3.4
Python 3.4.0b2 (v3.4.0b2:ba32913eb13e, Jan 5 2014, 11:02:52)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Bash, 15 bytes
echo "^T "|od -x
(^T is one character.)
Bat (Windows batch), 13 bytes (characters)
echo.^T |od -x
(^T is one character.)
PHP (27) - not shortest ASCII PHP but more readable
<?=hexdec($e=hexdec(E)).$e;
Java (68)
Solution 4: 68 chars (Thanks @radiodef))
class C{public static void main(String[]a){System.out.print(+'ߞ');}}
Solution 3: 69 chars (Thanks @Kamran)
class C{public static void main(String[]a){System.out.print(~~'ߞ');}}
Solution 2: 71 chars
class C{public static void main(String[]a){System.out.print(''+' ');}}
Solution 1: 72 chars
class C{public static void main(String[]a){System.out.print((int)'ߞ');}}
<3 Unicode.
Solution Derivation Technique: Copy the output from the following line and convert that character back to int for your a working solution.
System.out.println((char)2014));
PHP - 13 bytes
<?=m_n_^_o_k;
A fairly trivial ASCII-only solution.
Other variants:
<?=Q__Q^cone;
<?=VonV^d__b;
<?=PAAP^bqpd;
<?=BEAU^pupa;
etc.
Clojure, no unicode tricks (49 characters/bytes)
Uses the fact that * called with no args evaluates to 1:
(let[b(inc(*))j(+(* b b b)b)](+(* b j j j)j b b))
Using the same trick and doing string concatenation instead of arithmetic, the lowest I could get was 51 chars:
(let[n(*)t(+ n n)z(+)f(+ t t)](print(str t z n f)))
Bash, 29 bytes
Bash without using external programs:
echo $((x=++y+y))$?$y$((x+x))
vba (immediate window), 38 26 13
using regular ascii characters (no funny typing needed)
?&ha+&ha&&&he
26
?val("&hfbc")/-(true+true)
38
?year((cdbl(asc("ê"))*cdbl(asc("²"))))
find a date that can be represented as a number, and select the year from that (in this case, Jan, 13, 2014)
have to use cdbl, as it assumes signed int, and overflows
Ruby 1.9, 10 bytes
p 'ߞ'.ord
Fortran: (43 27)
print*,z'FBC'/len('hi');end
Thanks to Hristo Iliev, the above is about 40% smaller! z'FBC' returns the decimal form of that hex value (which is 4028), len returns the length of hi (i.e.,2).
Original answer:
print*,ichar(',')*ichar(',')+ichar('N');end
Converts the string , and N to ASCII values: 44 & 78 respectively: 44**2 + 78 = 1936 + 78 = 2014.
Python, 30 chars
s=int('RZ',ord('$'));print s+s
2014 => 2 * 1007 => RZ in base 36 => ascii code for $ character
In interpreted mode, without the print statement it is 24 chars:
s=int('RZ',ord('$'));s+s
PHP: 54 chars
Slightly different approach, albeit long, using concatenation, and not using ordinal values:
<?=floor(M_E).floor(M_EULER).ceil(M_EULER).ceil(M_PI);
EXCEL, 24 characters:
=COLUMN(T:T)&COLUMN(N:N)
BAT (windows batch), 7 characters
echo %*
save as a.bat and invoke as a 2014
is there any restriction on using command line parameters? – Einacio
I don't think so, but
echo $1still has a number in it. – Joe Z.
not a so valid answer, but noone was posting an answer in this wonderful language
C++ - 63 bytes
I'm not sure if this method has been used, but I designed this myself anyway:
#include<iostream>
int main(){std::cout<<int('&'*(','+'\t'));}
Clojure - 22
(apply *(map int"j#"))
(note: the # is ASCII character 19, Stack Overflow doesn't seem to like this but it's valid Clojure source...)
Clojure - 36
(dec(reduce +(nnext(range(int\@)))))
Perl - 10 characters
This solution is courtesy of BrowserUK on PerlMonks, though I've shaved off some unnecessary punctuation and whitespace from the solution he posted. It's a bitwise "not" on a four character binary string.
say~"ÍÏÎË"
The characters displayed above represent the binary octets cd:cf:ce:cb, and are how they appear in ISO-8859-1 and ISO-8859-15.
Here's the entire script in hex, plus an example running it:
$ hexcat ~/tmp/ten-stroke.pl
73:61:79:7e:22:cd:cf:ce:cb:22
$ perl -M5.010 ~/tmp/ten-stroke.pl
2014
Perl (without high bits) - 14 characters
say'````'^RPQT
This uses a bitwise "or" on the two four-character strings "RPQT" and "````" (that is, four backticks).
$ ~/tmp/fourteen-stroke.pl
73:61:79:27:60:60:60:60:27:5e:52:50:51:54
$ perl -M5.010 ~/tmp/fourteen-stroke.pl
2014
(I initially had the two strings the other way around, which required whitespace between print and RPQT to separate the tokens. @DomHastings pointed out that by switching them around I could save a character.)
Perl (cheating) - 8 characters
This is probably not within the spirit of the competition, but hdb on PerlMonks has pointed out that Perl provides a variable called $0 that contains the name of the current program being executed. If we're allowed to name the file containing the script "2014", then $0 will be equal to 2014. $0 contains a digit, so we can't use it directly, but ${...} containing an expression that evaluates to 0 will be OK; for example:
say${$|}
For consistency, let's do the hexcat-then-perl thing with that:
$ hexcat 2014
73:61:79:24:7b:24:7c:7d
$ perl -M5.010 2014
2014
I think this is cheating, but it's an interesting solution nonetheless, so worth mentioning.
C#, 60 characters
class a{static void Main(){System.Console.Write(- -'ߞ');}}
Thanks to mleise for the original answer for D!
Note: space between hyphens is important
C# (56 characters)
Class P{static void Main(){Console.Write(','*','+'N');}}
C, 31 bytes -- without a multi-character literal
main(){printf("%o",'\xe'*'J');}
JavaScript, 49 Chars
A mathematical JavaScript version making use of only PI and E as source numbers.
(m=Math).pow(e=m.E,e*(p=~~m.PI))/m.sqrt(p)+e+e|""
... mmmm PIE.
Oh and just in case implicit returns are vetoed (56 Chars with alert):
alert((m=Math).pow(e=m.E,e*(p=~~m.PI))/m.sqrt(p)+e+e|"")
Multiboot x86 Assembly (250 bytes):
[BITS N]
%define L(x) mov dword [eax],'zaza'-x
O equ 'A'<<`\xe`
F equ 'bab'-'aaa'
M equ `\xFF\xAF\xAA\xFA`-`\xFD\xFF\xFC\xDE`
C equ -(M+F)
h:
dd M
dd F
dd C
dd h+O
dd h+O
dq 'a'-'a'
dd s+O
s:
mov eax,'\'<<`\r`
L('HBJB')
add eax,'e'-'a'
L('IBFB')
hlt
Compile with:
nasm src.S -o 2014.bin -f bin -DN=32
(If someone has a suggestion for replacing the N macro, I'm all ears)
J (18)
This one doesn't use any character codes. Uses the idea that the sum of the sequence of natural numbers from 1 -> 63 = 2016.
<:<:+/i.*:+~+~p:%_
Perl, 24 bytes
print-ord(A)+ord for U,O
Pure ascii, no nonprinting characters or utf8-only characters used. Uses the 21st and 15th letters of the alphabet to print 20, 14.
120 characters in Squeak Smalltalk trunk (4.5).
I did not search the shortest, but kind of graphical solution:
((Text string:'Happy\New year'withCRs attribute:TextEmphasis narrow)asMorph borderWidth:Float one+Float one)bounds area
It depends on font, margins, and so is quite fragile, but at least for me it worked.
In Squeak 4.4, it works with lowercase 'happy\new year'.
C# - 64 chars
class P{static void Main(){System.Console.Write('!'*'>'-' ');}}
pretty printed
class P
{
static void Main()
{
System.Console.Write('!' * '>' - ' ');
}
}
C/C++ 39
main(){printf("%d%d",':'-'&',':'-',');}
ASCII for: ':' = 58, '&' = 38, ',' = 44. Using that, 58-38 = 20 and 58-44 = 14.
Python 51
Using true = 1 and false = 0
t=True
print str(t+t)+str(t-t)+str(+t)+str(t+t+t+t)
Ruby — 8 characters
p ?ߞ.ord
where ߞ is Unicode character U+07DE — N'Ko letter ka.
This is what it looks like when I copy and paste the above line and run it in my Terminal. Notice the character does not display:

Mathematica, 14 characters (or 15 if you count the bitmap as a character)
TextRecognize@
C - 44 characters (85 with headers)
What, no one is abusing strings yet?
#include<stdio.h>
#include<netinet/in.h>
main(){printf("%u",ntohs(*(int*)"\a\xde"));}
Interestingly, this is a special case where neither character is printable, but their special code doesn't involve a number.
If we want no warnings, it needs to become 55 (96) characters:
#include<stdio.h>
#include<netinet/in.h>
int main(){return!printf("%u",ntohs(*(int*)"\a\xde"));}
newLISP - 61 characters
I can't seem to play golf in Lisp -- is it just too wordy?
(int(apply string(map(fn(c)(find c'(b c a e d)))'(a b c d))))
Game Maker Language, 22
show_message(ord("ߞ"))
Mathematica, 23 bytes
Tr@ToCharacterCode@"ߞ"
(Using the 2014 unicode char. Credit for Tr goes to alephalpha)

Mathematica, 46 bytes (pure math)
a=⌊E⌋;b=⌈E⌉;c=⌈Pi⌉;a^(b*c-(c-b))-a*a^c-a
idea taken from here.
Javascript (29 chars)
t=!'',a=t+t+'';a+!t*t+t*t+a*a
Not the shortest but some boolean logic
Solution 1
Octave/Matlab (55 chars)
a=pi;b=a*a;disp(ceil(a^a^a/a/a/a-b*b*a-a^a*b+b*b-b-b));
Solution 2
PHP (9 chars without tags, 12 with them Actually 2022 because of the new lines involved)
<!--Comment
previous
2013 lines -->
<?=__LINE__; <!-- This should be on line 2014 -->
guess this is already beaten but I like the approach:
<?php
$three=round(pi());
$one=pi()/pi();
$two=$three-$one;
$four=$three+$one;
$zero=$one-$one;
echo $two.$zero.$one.$four;
?>
Mathematica (24)
Found by randomly generating expression trees. TraditionalForm chops 5 characters for the floor symbol but I think rich text doesn't count.
Floor[π E(Sin@E+E^E)E^E]
bash 35
I want something that doesn't use ASCII or UNICODE.
[ ];x=$?;y=$[x+x];echo $y$?$x$[y+y]
If you don't mind some error messages mixed in (28 characters):
[;x=$?;echo $x$?$[x/x]$[x+x]
You can get rid of the error messages if you don't mind corrupting a file (32 characters):
[ 2>x;x=$?;echo $x$?$[x/x]$[x+x]
PHP (21 chars)
<?=ord('').ord(''); //These are not empty strings ;)
If you don't believe it, see the proof.
AutoHotkey 31/13
send % ++(z:=true) z-z true z+z
This year special solution
send % A_year
Objective C
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy"];
NSLog(@"%@",[formatter stringFromDate:[NSDate date]]);
Golfscript - 11 10 chars
'&~I'{}/-*
computes 38 * 53 (ie an expansion of the prime factorization of 2014: 2 * 19 * 53)
Old Version
'f.'{}/.*\-
This computes 462-102.
'f.'{}/ puts the ascii values of f and . on the stack.
.* squares the value of the .
\- swaps the two values, then subtracts
Python 3 (17 bytes)
print(ord("ߞ"))
Python 2 (50 bytes)
s,t=str,True;print s(t+t)+s(t-t)+s(t/t)+s(-~t<<t)
ANSI C - 95 47 52 characters
#include <stdio.h>
main() { printf("%i", (('a' + 'a')/'a') * ('\a' + '\f') * ('<' - '\a') ); }
This program uses characters to initialise integers and multiplies: 2 * 19 * 53.
#include
main(){printf("%i",'\aÞ');}
This program initialises an integer using charaterbytes and prints it. '\aÞ' is the bitpattern 00000111 11011110 this is also the bitpattern of 2014.
Disclaimer: this was made on a windows system with visual studio. This code depends on a lot of things, including - How your compiler endodes the characters you input. Þ has an ascii value of 222 (or its negative equivalent), this may vary depending on your system. The notation int a = 'abcd'; is in itself evil and depends on how memory is handled on your system - this includes endian issues. int a = '\0A'; a is 65 on my system but may be 16640 on your system.
main(){printf("%i",('C'-'A')*('T'-'A')*('v'-'A'));}
I went back to Version one and multiplied 2 * 19 * 53. This version uses only one byte at a time so it is endian compatible. Also it uses only characters in the range of [0 - 127] to be compatible to all systems.
JavaScript:
alert(+!![]+!![]+[+[]]+ +!![]+(+!![]+!![]+!![]+!![]));
each +!![] is 1 (![] is false, !false is true and +true is 1)
+[] is 0, and [0] is "0"
so this turns into 1+1+"0"+1+(1+1+1+1)
Haskell, 23 characters, 24 bytes
main=print$fromEnum 'ߞ'
That's U+07DE N'Ko letter KA
C, 37 Characters
main(){printf("%d%d",'d'-'P','\xE');}
Ruby:
p eval("#{""=~//}x#{"\a".ord}de")
Here is how it works inside IRB shell:
>> p eval("#{""=~//}x#{"\a".ord}de")
2014
D
ϯ has the numerical value 1007 in Unicode encoding.
as compiler message during compilation (20 chars)
pragma(msg,'ϯ'+'ϯ');
runtime version (45 chars)
import std.stdio;void main(){write('ϯ'+'ϯ');}

