Welcome 2014 !!!

I was code golfing on stack exchange and came across a simple but interesting problem. The task was to create a program which will print 2014 without using any numeric characters [0123456789] and also it should not depend on 2014 being the current year.

If the 2nd constraint was not placed, it could have been a trivial program in q, just calling .z.d and casting it to year.

q)`year$.z.d
2014i 

Since it a was a code golf program, i tried multiple solutions to save characters.

Here are some of the solutions which i thought; you are most welcome to add if something more smaller comes in your mind.

q)/27 chars
q)k)+/"i"$"}}}}}}}}}}}}}}}JA"
2014

q)/21 chars
q)k)-[*/"i"$"..";"i"$"f"]
2014

q)/16 chars
q)k)(*/"i"$".,")-@""
2014

q)/17 chars
q)k)-(@.z.t)*"i"$"j"
2014

2 thoughts on “Welcome 2014 !!!

  1. jm February 20, 2014 / 4:15 pm

    q)k),/$:.Q.a?”uo”
    “2014”
    q).Q.a?”cabe”
    2 0 1 4

    • ak February 20, 2014 / 4:42 pm

      Excellent!!! much shorter than what i have posted…. cheers

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.