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
q)k),/$:.Q.a?”uo”
“2014”
q).Q.a?”cabe”
2 0 1 4
Excellent!!! much shorter than what i have posted…. cheers