text:
Make a code square with your favorite word
Pick your favorite 6 letter common English word that has no repeated letters, such as wombat.
Write a program in an N×N grid of characters without comments such that each row and column contains all the letters of your word in lowercase in any order. The program must output a definition of your word in 36 characters or more.
Rules

Output to stdout. There is no input.
Your word must be on Dictionary.com and only contain a-z. No proper nouns, no acronyms, no abbreviations, no contractions.
Your program and output may only contain printable ASCII characters (hex codes 20 to 7E). (This isn't counting the necessary newlines in the program grid.)
Comments are anything that the compiler or interpreter traditionally ignores. You may use code that does not contribute to the output or doesn't officially get executed.
The output definition should be grammatical and accurate, but certainly may be funny or clever.
Any row or column that at least contains your word`s 6 unique letters in lowercase is valid. Diagonals do not matter.

Scoring
This is code golf but since all submissions must be in the same square format you can simply specify your score with N. The lowest N wins, and of course an N below 6 is impossible. In case of ties, the highest voted answer wins.
Example
If your word was wombat your program might look like this (N = 7):
wombatD
ombatEw
mbatFwo
bat(wom
atWwomb
tBwomba
)wombat

Notice that every row and every column has the characters w o m b a t.
The output might be: (40 chararacters)
Cute short-legged Australian marsupials.

OK, you have to create a grid using a 6 letter word, but then I do not understand the output: "Cute short-legged Australian marsupials.".

@CousinCocaine That's a description of a wombat. You should output a grammatical and accurate description of the word you choose.

As this is code golf, who decides whats right? "Cute short-legged Australian marsupials" or "short-legged marsupials"?

Right. The example grid is not of course a real program, just a theoretical one that somehow encodes the description while meeting the other constraints. I imagine N will have be much larger than 7.

@CousinCocaine The output can be any decent definition of your word. But it must be at least 36 characters (see spec).

Is it OK if a letter of your word is in uppercase in your program?

@ProgramFOX Sure, as long as all the lowercase letters are in there too. wombatW or WOMBATbatwom would be fine for the first row but not wombaT.

@MartinBüttner Space counts as printable ASCII. Wont that suffice?

@Calvin'sHobbies never mind, I didn't check the link and figured all whitespace was excluded because you specifically allowed newlines.

Idea: Have the word be "golfed", and the definition "a description of this program's code" (for anyone who can figure out how to do this!).

damn, i don't have favorite 6 character long word

I really want to make one using the word square, but I don't have the skills :(.

@TomHart I gave that a go

I've voted to close because neither "without comments; comments are anything the compiler traditionally ignores" nor "the output definition should be grammatically correct and accurate" are objective requirements.

Perl - grapes - 11
edit: I accidently made this 12 lines...
$epagsr=$";
$,=$epagsr;
/gaerp/;say
grep!/a*s/,
qw(A searpg
purple sgar
rpssg pear?
No, a sgerp
s great pse
as grape; s
eat prgpsga
up! sgarse)

Output:
A purple pear? No, a great grape; eat up!

Update!
I eliminated a line to get it down to 11 but I had to change the sentence. Hopefully I didn't make any mistakes this time!
$gpasre=$";
$,=$gpasre;
/paerg/;say
grep!/a*s/,
qw(A sgrpea
purple sarg
ressp game?
No, a rgspe
s great gsp
as grape; s
eat),$spegr

Output:
A purple game? No, a great grape; eat

The output is 37 characters.

I like this one primarily because of the little output poem. Shame it wasn't a haiku :)

This is 12x11...

@schism wow... Shoot! I'll fix it. Thanks!

About to accept this, but it's still 12 tall.

Javascript - action - 15x15
"Definetly not the shortest one, but PEW PEW PEW." - James Bond
ction="action "
ction+="means "
actionac="PEW "
ctionact="PEW "
tionacti="PEW "
ionactio="PEW "
onaction="PEW "
nactiona="PEW "
ction+=actionac
ction+=ctionact
ction+=tionacti
ction+=ionactio
ction+=onaction
ction+=nactiona
alert(""+ction)

Link to the jsfiddle
Output (37 chars):
action means PEW PEW PEW PEW PEW PEW

Your first row should contain a lowercase a.

@Calvin'sHobbies You are right. I fixed it.

Befunge 93, n=13
This works by redirecting the string with "v and >".  This only works when the side-length and word-length are coprime and when the side-length is greater than 11. Right now, it works for the "word" vwombat, and therefore for wombat.
"laip"vwombat
wombat>"usr"v
"am "vwombat>
ombat>"nai"vw
lar"vwombat>"
mbat>"tsu"vwo
 d"vwombat>"A
bat>"egg"vwom
-"vwombat>"el
at>"tro"vwomb
"vwombat>"hs
t>"tuC"vwomba
vwombat>:#,_@

Outputs Cute short-legged Australian marsupial

C  (word : "finder", N = 16)
main() finder{ f
printf(finder  i
"it's defined "r
"as a t"finder d
"hing t"finder e
"hat ca"finder r
"n find other t"
"hings" finder);
finder finder f\
inder finder fi\
nder finder fin\
der finder find\
er finder finde\
r finder finder
 finder finder n
return 0;finder}

Compiled with GCC, with the options -Dfinder="" -Df="" -Di="" -Dn="" -Dd="" -De="" -Dr="".
It outputs it's defined as a thing that can find other things (50 characters). I believe it follows all the rules, but feel free to tell me if there is any mistake !

Looks correct, though I'm not crazy about all the compiler options.

Of course, I bent the rules a little here. At first I was going for a lot of defines, that's why I chose the word "finder" (since it contains almost the same letters as "define").

its not a good idea to use macros. if it's allowed, you can say n=6 and compile it with these:
"-Dfinder=main(){puts(it's defined as a thing that can find other things);}" -Dinderf=; -Dnderfi=; -Dderfin=; -Derfind=; -Dnderfi=;

That's right, I didn't even think of that.

GolfScript, N = 12
wombat"Cute"
ombat" sho"w
mbat"rt-l"wo
bat"egge"wom
at"d Au"womb
twomb"stra"a
wom"lian "bt
ttwomb"mar"t
"sup"wbwomat
"ia"womabbtt
"ls"bawomtbt
aaawomobt"."

The wombat example encoded in GolfScript. Output is
Cute short-legged Australian marsupials.

as given in the question. The interesting part is that you may use most words and answers and simply insert the corresponding letters into the solution as long as you don't produce a GolfScript built-in which are very rare, p, n being to obvious ones. All other combinations lead to valid GolfScript variables which are no-ops by default.

So I guess one could cut this down significantly with a clever phrase that uses a lot of the letters from the word.

@MartinBüttner I tried, but the 36 characters make it quite hard.

I used your approach for a "square" submission (see below). It's actually one character larger than yours, but with some clever shifting around it might be possible to compress it.

Befunge-98 (n=12)
I chose kelvin because it had a v in it. Outputs kelvin is like celsius but it's lowe
"ewol "vnlik
"t's"ke<ilnv
kelniv"t i"<
elnik>"ub "v
nkv"elsius"<
ln>"c eki"vl
v0ke"is l"<n
>" nivlek" v
ielnv,k4'k#<
 vivlevlnek<
 ilkkninevei
  elnkn vnle

unfortunately, Si temp is 29 characters short of 36. ;)

It seems that whenever I post in Befunge-93, someone follows up with a similar Befunge-98 solution...

@Zaq don't worry, -93 is more fun anyways.

Line 2 has no i.

Also, line 4 is missing a k and column 9 is missing an e.

I believe I've fixed all the missing characters now, let me know if there's anything else I missed.

Python, n=15
Word is "canoes"
def canoe(s='S\
ecret weap',sno
='ce',a='ons o\
f the Can',oces
=1,oesn=1,c='a\
dian navy',cose
="""aoenscanaen
canceessanoeeca
anoasanooscanoe
noescccccaeescc
oescneocaeoesca
escaoescan"""):
 canoes=s + a+c
 print (canoes)
s=1;    canoe()

Output:
Secret weapon of the Canadian navy

This is 16x15!

Thanks...at some point I miscounted and felt the need to add that single line with canoes in there.  Fixed.

Perl - repeat - 11
$repeat=qq(
repeat);say
"repeat\n"x
length'pear
repeatrepea
epeatrepeat
peatrepeatr
eatrepeatre
atrepeatrep
trepeatrepe
repeat....'

Output:
repeat
repeat
repeat
repeat
...keeps going

Looking back maybe I should have made this a loop.

Falls short of the word that has no repeated letters requirement.

@Howard There are at least 2 e's per line though so I figured I might as well post it.

Ruby, haters, N = 10
After hours of attempts by hand, writing a generator program, and tweaking parameters, I have finally found a solution for N = 10!
aser=ts=?h
tah=re=?\s
sh='Haters
nurse hate
in hardest
hearts.'
rtse=erha=
era=sh.tr'
',tah;aser
 puts erha

Outputs Haters nurse hate in hardest hearts., exactly 36 characters. Try it online!
I chose Ruby because its variables don't need $ (Perl), and single-quoted strings can contain newlines (Python). The fact that the tr method uses two of my word's letters was an unexpected bonus. The core of the program is straightforward:
# Store the definition, with newlines
sh='Haters
nurse hate
in hardest
hearts.'
# Transliterate newline to space
erha=sh.tr('
',' ')
# Output
puts erha

Getting all the letters to line up, of course, was not simple. I went through several variations on the same structure and learned a couple things about Ruby in the process (tr doesn't need parentheses, and ?\s is another way of getting a space). There were many dead ends and several false positives. And then... success!
Here's a gist of my hacked-together generator program, if anyone's interested.

Golfscript (n=10)
My first golfscript! It prints kelvin is like celsius but it's lowe
"kelvin is
like ce"vn
evn"lsiu"k
k"s "elvni
in"bu"kelv
"t "knviel
vl"it'"nke
nevkil"s l
o"ivnkel"w
e"lnevik

What does "lowe" mean?

dictionary.com says that it can mean low

That only refers to the verb, meaning: to burn; blaze / (of a person) to feel strong emotions; glow with excitement. I don't see how that works here.

Look at the quote on the top right of the page

That's Middle English, not exactly the same language. In fact, it's unreadable to me. But.. whatever, I don't really care that much.

Sorry, but "lowe" is a bit too obscure. I'll accept this if you can make it "low" or "lower".

GolfScript, 13x13
Not the smallest...
squae"A squar
"uarsquaresqu
uareq"e has f
"resuaresquar
resqa"our equ
"squresquares
quars"al side
"arequaresqua
areuq"s and r
"esqaresquare
esqur"ight an
"quaesquaresq
quar"gles..."

... but ...
A squar
e has f
our equ
al side
s and r
ight an
gles...

(Having the line-breaks within the words is intentional, because otherwise I'd have leading or trailing whitespace which would look less square.)

Python, N=11
Word is "parent".  This code is not pretty, but it works.
eprnt=" a "
at="person"
rnep="that"
nrpt="made"
ea= " prnt"
e="parent:"
pa =(eprnt+
at+" "+rnep
+ea[0]+nrpt
+ eprnt+at)
print(e+pa)

Output:
parent: a person that made a person
Edit: Somehow I missed the fact that columns must also contain the word.  In retrospect, a language that includes endline characters as part of the language was not well suited to this puzzle.

Nice, but not every column contains the word parent. The first one, for example, does not have an a.

It's still missing a bunch. p is missing in 6 and 8. a: 4, 6, 7, 11. r: 4, 10, 11. e: 4, 5, 8, 9, 11. n: 3, 5, 7, 11. t: 1, 3, 6, 8.

Pip, n=14 (noncompeting)
The language is newer than the question. The word is quines.1
n_n|quine say&
qu ines     qi
as  harle quin
se?(equins)ns.
 plums|quinces
|quicken bus++
iness|q++++i u
u:++ingl es?eq
ni*:u; s|qe:",
which "Rns|que
eRL:i|quotesne
PUsn    quiet!
u|qe."print".s
JW"quines"  :)

Outputs the following (admittedly incomplete) definition:

quines print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines

Try it online!
The meaningful part of the code runs thus:
++i          Increment i (initially set to 0)
++++i        Increment i twice
u:++i        Increment i again and assign to u (i & u are now 4)
i*:u         Multiply i by u in-place (i is now 16)
e:",         Assign the string ",\nwhich " to e...
which "Rns   after replacing the newline with a space
eRL:i        Make a list of 16 copies of e and assign back to e
ePUs         Push a space to the front of list e
e."print".s  Concatenate "print" and a space to each element of e...
JW"quines"   and join on "quines", wrapping the result in "quines"

The rest of the code is arbitrary no-ops. The main difficulty in the "filler" sections was never to evaluate q, since it will prompt the user for a line of input (not a problem on TIO, but I wanted to make it correct in all environments). I used short-circuiting logic operators | and &, and ternary ?, to prevent q's evaluation.
1 Dictionary.com has an entry for quine, with a section on the programming meaning at the bottom. Since "quine" is a countable noun, I would argue that "quines" is a valid word.

Javascript, N = 8
My word is alerts.
s= alert
alert(s+
s+alert)
aaltrsee
leraatts
ertsalar
rtsaaela
tsaesarl

My code outputs the definition of the javascript alert function multiple times. Javascript's definition of alert is "function alert() { [native code] }".
Only the first three lines of code actually contribute to the output. The last 5 lines are syntax errors but the original rules stated that not all the code has to be executed as long as the output is correct.
Here is a link to the fiddle: http://jsfiddle.net/tze76pum/

Nice, but not quite common English.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
When was the last time the date was divisible by n?
A date can be represented by an unsigned integer as such: YYYYMMDD. What you need to do, is write the shortest program or function that figures out the most recent date whose number was divisible by a given number n (including today's date) and then returns that date in the format showed above. If there has never been a date (between 00000101 and today inclusive) divisible by the given integer, you should return -1.
Examples
Current Date     Input     Output

30 July, 2014      4       20140728
30 July, 2014      7       20140729
28 July, 2014      4       20140728
28 July, 2014      7       20140722
28 July,    5    90000     -1

Input
You can read from STDIN or take a function argument or even expect the input to be stored in a variable. The input will be an unsigned integer.
Output
Write to STDOUT or return (or save in a variable) the integer representing the date in the format YYYYMMDD.
Restrictions
You may use any standard library your language offers. Standard loopholes apply.
Winning conditions
This is a code-golf, so smallest program (in bytes) wins. In case of a tie, the answer with the most votes wins.

Date 00000101 does not exist. Year count starts by 1. http://en.wikipedia.org/wiki/0_%28year%29

@edc65 can we pretend it does exist?

What about Feb 29th?  Do we need to apply full leap year rules to check for valid dates? http://en.wikipedia.org/wiki/Leap_year

What about the days lost due to the Julian-Gregorian calendar switch?  Or are we going Gregorian all the way?  http://en.wikipedia.org/wiki/Gregorian_calendar

Your input/output specs are rather loose. For example, should the "expect the input to be stored in a variable" count the variable declaration in a language like C? You say "write a program", yet you say "take a function argument" - does that mean we can write just a function rather than a full program?

@Bob, yes, thanks for pointing that out, you CAN just write a function.

What calendar is used ?

@edc65 "ISO 8601 prescribes, as a minimum, a four-digit year [YYYY] to avoid the year 2000 problem. It therefore represents years from 0000 to 9999, year 0000 being equal to 1 BC and all others AD." from Wikipedia http://en.wikipedia.org/wiki/ISO_8601
So year 0000 exists in ISO 8601. Which year it really means is a bit unclear though.

Mathematica, 93 60 bytes
For[i=0,(r=DatePlus@i--~FromDigits~100)>0&&!n∣r,];r~Max~-1

Expects the input to be stored in n.
Note that the vertical line ∣ is the unicode character for "divides", which I've counted as 3 bytes (UTF-8).
Edit: Found a neat trick to avoid the bloated DateString and format specification :).
Edit: Totally forgot about the -1 requirement. Fixed now.
Here is an explanation
For[i=0,            i--                        ,];         (* i is the number of days AFTER
                                                              today. Hence, we decrement
                                                              it. *)
For[i=0,   DatePlus@i--                        ,];         (* If no reference date is
                                                              provided, DatePlus will add
                                                              the given number of days to
                                                              today's date. The result is a
                                                              list of 3 integers, luckily
                                                              in order {year,month,day} *)
For[i=0,   DatePlus@i--~FromDigits~100         ,];         (* Interpret these as the digits
                                                              of a base 100 number. The
                                                              beauty is that FromDigits
                                                              doesn't care about digits
                                                              greater than the base and
                                                              just carries them over. *)
For[i=0,(r=DatePlus@i--~FromDigits~100)        ,];         (* Store the number in r. *)
For[i=0,(r=DatePlus@i--~FromDigits~100)>0      ,];         (* Make sure it's positive. *)
For[i=0,(r=DatePlus@i--~FromDigits~100)>0&&!n|r,];         (* And keep going while n does
                                                              not divide r. *)
For[i=0,(r=DatePlus@i--~FromDigits~100)>0&&!n|r,];r~Max~-1 (* Clamp result to -1. *)

Note that I've used | instead of ∣ in the explanation, because the Unicode one messes with monospacing.

+1.Do you have a link pointing out that you should count unicode chars as 3 bytes?

@belisarius The OP stated that this code golf is counted by bytes and not characters (this is also the default as stated in the tag wiki).

I never got to read thru the end of the wiki :) Thanks!

Python 2 - 150
import datetime as d,re
def f(n):
 t=d.date.today()
 while t:
    c=int(re.sub("-","",str(t)))
    if c%n<1:return c
    try:t-=d.timedelta(1)
    except:return-1

Thanks @chill0r for suggestion to remove days=, and Jason S for tip that the try block can be reduced to one line.

Yes. That is a standard operating procedure ;). The tabs get converted to spaces after pasting.

You can remove the days= in t-=d.timedelta(days=1). This works fine too (at least in python3)

@bitpwner ah I see, never mind then.

You can save more: (1) use int(t.strftime("%Y%m%d")) and drop re, (2) use a one-line try because only t-=d.timedelta(1) needs to be in it.

@JasonS Sorry for late reply... was busy with other stuff. Thx for the tip. Seems like strftime would give the following for a large n like 9000: ValueError: year=1899 is before 1900; the datetime strftime() methods require year >= 1900

@bitpwner strftime on older dates works in python3, checked and I do get an error in python2

C# 136
With the revised specs, a function that takes an unsigned int and returns an int.
int F(uint n){var d=System.DateTime.Now;int i;try{while((i=int.Parse(d.ToString("yyyMMdd")))%n>0)d=d.AddDays(-1);}catch{i=-1;}return i;}

152 characters with variable input/output
Taking advantage of the loose input/output requirements, input is to be stored in the variable n (currently counting all characters except the integer literal), and output is provided with the variable s.
class P{static void Main(){var n=4;var d=System.DateTime.Now;string s;try{while(int.Parse(s=d.ToString("yyyMMdd"))%n>0)d=d.AddDays(-1);}catch{s="-1";}}}

204 characters with STDIN/STDOUT:
using System;class P{static void Main(){int n=int.Parse(Console.ReadLine());var d=DateTime.Now;string s;try{while(int.Parse(s=d.ToString("yyyMMdd"))%n>0)d=d.AddDays(-1);}catch{s="-1";}Console.Write(s);}}

Really, a downvote? Does this not solve the problem correctly? Please explain. If anyone thinks I duplicated the other C# answer, I actually wrote this about an hour before the other one, and even looked into using C# 6.0 for the declaration expressions. Got a bit sidetracked, which resulted in posting the answer late. Even then, that's a rather flimsy reason for a downvote.

Golflua 90 86
n=I.r()d="%Y%m%d"i=O.d(d)+0j=0@i>0?i%n==0w(i)O.q()$j=j+1i=O.d(d,O.t()-j*86400)+0$w(-1)

An ungolfed Lua version would be,
n = io.read()
d = "%Y%m%d"
i = os.date(d)+0   -- implicitly casts os.date(d) to int
j = 0
while i>0 do
   if i % n == 0 then
      print(i)
      os.exit()
   end
   j = j+1
   i = os.date(d,os.time()-j*86400)+0
end
print(-1)

Tested here n = 20140699 outputs 20140699

@WilliamBarbosa: Fixed; 20140699 returns -1.

PHP (92=85+7)
Expects input to be stored in $n.
for($d=date("Ymd");!($d%$n==0&checkdate($d/100%100,$d%100,substr($d,0,4))|$d<0);$d--);echo$d

I just remembered why I do not like PHP anymore=)
EDIT: Now the -1 of the specifications is implemented too.

No, just checked it, $d will be one too low when echo-ing. What do you mean by 'you've forge'? (Sorry, no english native=)

Oh, I didn't see that spec, of course this has to be added, thanks!

T-SQL (2012) - 148
Assumes there is a free variable @n with the n value.
declare @ date=getdate()while convert(char,@,112)%@n>0 and'00010101'<@ set @=dateadd(d,-1,@)print iif(convert(char,@,112)%@n=0,convert(char,@),'-1')

MATLAB: 61
-1,s=str2num(datestr(1:now,'YYYYmmDD')),d=s(~mod(s,n)),d(end)

Assumes the divisor is stored in n. The result will be stored in a variable called ans.

Commented version:
-1                                     % Store -1 in ans in case we don't find anything
s=str2num(datestr(1:now,'YYYYmmDD'))   % Make a list of date numbers
d=s(~mod(s,n)),                        % Select only those who are dividable and prepend -1
d(end)                                 % Store last found value in ans, if anything is found

Will generate an error if no result is found, but the answer is still available in the variable despite that.

Error could be avoided at the cost of 2 extra chars:
s=str2num(datestr(1:now,'YYYYmmDD')),d=[-1;s(~mod(s,n))],d(end)

@MartinBüttner Hmm, solved that problem but now the solution is only tied for minimum chars. Can you see any improvements?

No, not off the top of my head. But my motivation to help you beat me is a bit limited. ;)

JavaScript (ES6) 115
Expects number in variable n, result stored in variable r.
Each day is checked, starting with current date and decrementing - there must be a better way.
Moreover, using standard javascript date functions, all dates are gregorian down to year 1 (with leap years accordingly wrong before gregorian reform).
for(z=new Date,t=n+1;t>n&&t%n;)
  d=z.getDate(),
  t=z.getFullYear()*1e4+(z.getMonth()+1)*100+d,
  z.setDate(d-1);
r=t>n?t:-1

C# - 144 (Or 124 in LINQPad) + 1 for each digit in n
This expects the input to be in the variable n. By the end of the execution the desired value will be in the variable r. This considers 00010101 as the first date, though, because the date 00000101 does not exist. Suggestions for improvement are always welcome.
class P{static void Main(){int n=7,r;var d=System.DateTime.Now;try{for(;(r=int.Parse(d.ToString("yyyMMdd")))%n>0;d=d.AddDays(-1));}catch{r=-1;}}}

LINQPad version:
int n=7,r;var d=System.DateTime.Now;try{for(;(r=int.Parse(d.ToString("yyyMMdd")))%n>0;d=d.AddDays(-1));}catch{r=-1;}r.Dump();

Matlab 104
function d=f(v);for d=fix(now):-1:1 d=str2num(datestr(d,'YYYYmmDD'));if~mod(d,v)return;end;end;d=-1;end

Ungolfed :
function d = f(v)
   for d=fix(now):-1:1
       d = str2num(datestr(d,'YYYYmmDD'));
       if ~mod(d,v)
          return;
       end
   end
   d = -1;
end

EDIT: I managed to optimise it a bit, but @DennisJaheruddin has the real solution here

This can still be golfed quite a bit, I will update it.

@DennisJaheruddin I have rejected your edit based on this meta post. Please suggest your improvements in a comment, so the OP can review them before modifying his answer.

Note that you can save chars in various ways: Use a script rather than a function, let things get assigned to ans, do the loop from low to high and let each result overwrite the previous one so you don't need to break the loop. -- Of course vectorization can also help, see my answer.

Here is a shorter loop based version of 67 chars: -1,for s=str2num(datestr(1:now,'YYYYmmDD'))',if~mod(s,n),+s,end,end

@MartinBüttner Thanks for the comment. There was an error as you said. Now it should be okay.

@DennisJaheruddin I saw your solution. Quite a good one. I'll leave you this one :P.

@Scott At least improve your solution a bit. Seeing you assign the number 1 to a variable really hurts. It also appears that it currently always returns d=-1.

Groovy - 301 300 chars
Very simple (and slow), with no tricks to hide the fact that it uses Joda Time.
Golfed:
@Grab(group='joda-time', module='joda-time', version='2.3')
import org.joda.time.*
import org.joda.time.format.*
f={DateTimeFormat.forPattern("yyyyMMdd").print(new LocalDate().minusDays(it)) as int}
n=args[0] as int;b=0;x=-1;c=0
while(!b){if(f(c++)%n==0){x=f(--c);b=1};if(f(0)-c<=101){b=1}}
println x

Example run (on 7/30/2014):
$ groovy D.groovy  7
20140729
$ groovy D.groovy  16
20140720
$ groovy D.groovy  90000
-1

Ungolfed:
@Grab(group='joda-time', module='joda-time', version='2.3')

import org.joda.time.*
import org.joda.time.format.*

f = { DateTimeFormat.forPattern("yyyyMMdd").print(new LocalDate().minusDays(it)) as int }

n = args[0] as int
b = 0
x = -1
c = 0

while (!b) {
    if(f(c++)%n==0) { x=f(--c); b=1}
    if(f(0)-c<=101){b=1}
}

println x

Python 3 - 151 148 bytes, generators
from datetime import*
t=date.today()
f=lambda n:next((y for y in(int((t-timedelta(o)).strftime("%Y%m%d"))for o in range(t.toordinal()))if y%n<1),-1)

Thanks @nyuszika7h for import* suggestion

R, 146 139
D=function(n){
z=as.double(gsub("-","",y<-Sys.Date()))
d=F
while(z>100&!d){
y=y-1
z=as.double(gsub("-","",y))
d=!z%%n}
ifelse(z>100,z,-1)}

Good luck with a date that doesn't work. microbenchmark reports it takes about half a second to go back 15 days. As of July 31, 2014, this will take something like 20 million seconds (~23 days) to spit out -1, at least according to the back of the envelope.
edit: some shortcuts in the comments

!d is shorter than d==F and !z%%n than z%%n==0. Also, making as.numeric(gsub("-","",...) into a function should reduce the character count as well. Still, nice job!

Oh and as.real is often a good, shorter alternative to as.numeric.

Unfortunately as.real is defunct as of R 3.0.0. But we still have as.double which is one character shorter.

Oh I didn't know that as I'm still using R 2.14

You should upgrade! Huge quality of life improvements came out in the last couple of years... paste0 comes to mind. And unfortunately making a separate function for as.numeric(gsub("-","",...) is actually longer because of the =function(x) part

I'm not working on a computer i have administration rights on, so it's not really up to me. But I already have paste0 in my .Rprofile naturally :)

Ruby 103
require'date'
f=->{d=Date.today
(s=d.strftime('%Y%m%d').to_i
return s if s%n<1
d-=1)while d.year>0
-1}

Input
Expects the divisor value to be present in variable n.
Output
The return value of the f function
Online example: http://ideone.com/LoYxG4

Bash+coreutils (8.21), 67 bytes
seq -f-%gday $[9**9]|date -f- +[pq]sp[_1pq]sq%Y%m%ddA1=qd$1%%0=p|dc

seq generates integers from 1 to 99, one per line, and formats it as -<x>day
pipe this to date -f which interprets each line and outputs the date formatted into a dc expression such as [pq] sp [_1pq] sq 20140728 d A1 =q d 7% 0=p (spaces added for readability)

[pq] define a macro to print the top of stack, then quit
sp save macro in register p
[pq] define a macro to push -1, print the top of stack, then quit
sq save macro in register q
20140728 embedded date integer
d duplicate top of stack
A1 push 101 (00000101)
=q pop top 2 stack values: compare date and 101, and call macro q if equal
7 push divider
% pop divider and dividee, the divide and push the remainder
0 push 0
=p pop top 2 stack values: compare remainder and 0, and call macro p if equal
d duplicate top of stack
macro p is called: prints date integer and quits dc entirely

dc expressions are piped to dc for evaluation.  Once dc prints the right value and quits, the rest of the pipeline is torn down

Output:
$ ./lastdivdate.sh 4
20140728
$ ./lastdivdate.sh 7
20140729
$ ./lastdivdate.sh 123456
17901120
$ ./lastdivdate.sh 77777
19910912
$ ./lastdivdate.sh 7777777
-1
$

Since this program generates integers from 1 to 99, it will be valid up to just over 1 million years into the future.  I hope this limitation is acceptable ;-)

Thanks @WumpusQ.Wumbley for shortening the return of -1.

@MartinBüttner Curses! Now it does, with a 19 byte penalty :)

Shorter ways to convert empty output to -1: add |grep .||echo -1 to the end of the pipeline, or use zsh where you can nest expansions like echo ${$(cmd):-1} (this will cost you a backslash elsewhere...)

@WumpusQ.Wumbley Why didn't I think of that?  Thanks!

By the way, this seems to be sensitive to the coreutils version. Mine (8.15) refuses to go back before 1901 with the "days ago" specification.

@WumpusQ.Wumbley I was wondering about that.  I'm using coreutils 8.21 (ubuntu 14.04).  I've noted this in the title.

Actually it seems to be a sizeof time_t issue, since the boundary where it breaks is 2**31 seconds before 1/1/1970. My older installation is also pathetically 32-bit

Java : 373 chars
This is a port of the Groovy answer, and uses Joda Time.
Golfed:
import org.joda.time.*;
import org.joda.time.format.*;
public class D {
static int f(int i){return Integer.parseInt(DateTimeFormat.forPattern("yyyyMMdd").print(new LocalDate().minusDays(i)));}
public static void main(String[] args){
int n=Integer.parseInt(args[0]);int b=0,c=0,x=-1;
while(b!=1){if(f(c++)%n==0){x=f(--c);b=1;};if(f(0)-c<=101){b=1;}}
System.out.println(x);}}

Sample runs (with joda-time-2.4.jar on classpath:
$ java D 7
20140729
$ java D 4
20140728
$ java D 16
20140720
$ java D 90000
-1

Ungolfed:
import org.joda.time.*;
import org.joda.time.format.*;

public class D {
    static int f(int i) {
        return Integer.parseInt(DateTimeFormat.forPattern("yyyyMMdd").print(new LocalDate().minusDays(i)));
    }

    public static void main(String[] args) {
        int n = Integer.parseInt(args[0]);
        int b = 0,c = 0,x = -1;

        while(b!=1) {
            if(f(c++)%n==0) { x=f(--c);b=1; }
            if(f(0)-c<=101) { b=1; }
        }

        System.out.println(x);
    }
}

There's also java.time.* in the latest version of Java.

JavaScript (ES5) - 94
It expects the input in variable x, and places the output in o.
for(i=Date.now();i>-7e13&&(o=(new Date(i)).toISOString().replace(/-|T.*/g,''))%x;i-=864e5)o=-1

PYTHON: 134 bytes
Not going to be able to beat the current leader, and it's not that much better than the best Python answer, but I decided to post my best Python solution.
from datetime import*
def y(a,n):
 s=a.strftime("%Y%m%d")
 if int(s)%n==0:yield s
 try:x=y(a-timedelta(1),n)
 except:yield -1
 yield x

Ungolfed:
from datetime import *
def y(a, n):
    s=int(a.strftime("%Y%m%d"))
    if s%n==0:
        yield s
    try:
        x=y(a-timedelta(1), n)
    except:
        yield -1
    yield x

It's actually 138 bytes. You can save 4 bytes by using from datetime import* instead of import datetime as d, timedelta(1) instead of d.timedelta(1) and yield instead of return.

I'm using a random online byte counter, is there a better option?

http://mothereff.in/byte-counter

What makes that one different from this one? http://bytecount.bluebus112.com/

That one doesn't count newlines, plus it counts characters, not bytes. For ASCII text, the two are the same, so the latter doesn't make a difference here. In [tag:code-golf], you usually count characters unless the OP says otherwise. (Also, the one I linked was the first result in Google for "byte count" here.)

I was using Bing, and the first result on Bing is the one I used.
(don't ask why I was using Bing)

In case I wasn't clear, your code at the latest revision before my comment was 138 bytes. I've now suggested an edit to correct it.

I accidentally pasted old code into the text box rather than the new code.

k4 (84) (73)
f:{f d@*|&~.q.mod[(f:{$[^x;-1;.($x)@&~"."=$x]})'d:{"d"$x+!1+"i"$y-x}[-730457;.z.D];x]}

This is just an initial cut with the first algorithm that came to mind; I'm sure better is possible in both performance and length.
This version hardcodes the "today" part (that's the .z.D); change it to a date literal (yyyy.mm.dd) or an integer in the q date system (days since January 1, 2000) to run the test cases. (q won't parse date literals earlier than the early eighteenth century, so for dates before that, you'll need to work out the value and use the appropriate integer directly. January 1, "A.D. 0", from the spec, turns out to be -730457, which is used in the function code. July 28, A.D. 5, from the last test case, turns out to be -728450.)
The given test cases:
  {f d@*|&~.q.mod[(f:{$[^x;-1;.($x)@&~"."=$x]})'d:{"d"$x+!1+"i"$y-x}[-730457;2014.07.30];x]}4
20140728
  {f d@*|&~.q.mod[(f:{$[^x;-1;.($x)@&~"."=$x]})'d:{"d"$x+!1+"i"$y-x}[-730457;2014.07.30];x]}7
20140729
  {f d@*|&~.q.mod[(f:{$[^x;-1;.($x)@&~"."=$x]})'d:{"d"$x+!1+"i"$y-x}[-730457;2014.07.28];x]}4
20140728
  {f d@*|&~.q.mod[(f:{$[^x;-1;.($x)@&~"."=$x]})'d:{"d"$x+!1+"i"$y-x}[-730457;2014.07.28];x]}7
20140722
  "d"$-728450
0005.07.28
  {f d@*|&~.q.mod[(f:{$[^x;-1;.($x)@&~"."=$x]})'d:{"d"$x+!1+"i"$y-x}[-730457;-728450];x]}90000
-1

edit:
g:.,/$`\:`$$:;f:{$[Z=r:{(z>x)&.q.mod[g z]y}[Z:-730458;y]{x-1}/x;-1;g"d"$r]}

This is a different approach which uses one of the convergence operators to decrement the date until either it finds a divisible one or it crosses the 1/1/0000 boundary. It also does the conversion from date to integer slightly differently.
The test cases, this time all at once:
  g:.,/$`\:`$$:;{$[Z=r:{(z>x)&.q.mod[g z]y}[Z:-730458;y]{x-1}/x;-1;g"d"$r]}'[2014.07.30 2014.07.30 2014.07.28 2014.07.28,"d"$-728450;4 7 4 7 90000]
20140728 20140729 20140728 20140722 -1

VBA 343 bytes (module)
Sub divD(i As Long)
a = Now()
b = Format(a, "yyyymmdd")
    Do While b / i <> Int(b / i)
    a = DateAdd("d", -1, a)
    b = Format(a, "yyyymmdd")
        If b = "01000101" Then
            MsgBox -1
            Exit Sub
        End If
    Loop
MsgBox b
End Sub

This can be heavily condensed down to Sub d(i):a=Now:b=a:Do Until b/i=Int(b/i):a=DateAdd("d",-1,a):b=Format(a,"yyyymmdd"):If b="01000101"Then:b=-1:Exit Sub:Loop:Debug.?b:End Sub for 139 Bytes

PowerShell - 76
This depends on the number being stored in the variable $n.
try{@(0..$n|%{'{0:yyyyMMdd}'-f(date).AddDays(-$_)}|?{!($_%$n)})[0]}catch{-1}

authors: Максим Каримов

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Kakuro Combinations
Kakuro Combinations
Because I can't do mental arithmetic, I often struggle with the Kakuro Puzzle, which requires the victim to repeatedly work out which distinct numbers in the range 1 to 9 (inclusive) sum to another number in range 1 to 45 when you know how many numbers there are. For example, if you may want to know how to get 23 from 3 numbers, the only answer is 6 + 8 + 9. (This is the same idea as Killer Sudoku if you are familiar with that).
Sometimes you will have other information, such as that the number 1 cannot be present, thus to achieve 8 in just 2 numbers, you can only use 2 + 6 and 3 + 5 (you can't use 4 + 4, because they are not distinct). Alternatively, it may be that you have already found a 3 in the solution, and so something like 19 in 3 numbers must be 3 + 7 + 9.
Your task is to write a program that lists all the possible solutions to a given problem, in a strict order, in a strict layout.
Input
Your solution can receive the inputs as a single ASCII string either through stdin, a command line argument, an argument to a function, a value left on the stack, or whatever madness your favourite esoteric language employs. The string is in the form
number_to_achieve number_of_numbers_required list_of_rejected_numbers list_of_required_numbers

The first 2 arguments are typical base-10 non-negative non-zero integers in the ranges 1 to 45 and 1 to 9 respectively (using a decimal point would be invalid input), the two lists are just digits strung together with no delimitation in no particular order without repetition, or '0' if they are empty lists. There can be no shared digits between the lists (except for 0). The delimiters are single spaces.
Output
Your output must start with a line that contains the number of possible solutions. Your program must print out line-break delimited solutions sorted by each increasingly significant digit, where each digit is placed at the position it would be if you listed the numbers from 1 to 9. The examples below will hopefully make this clearer.
If an invalid input is provided I do not care what your program does, though I'd rather it didn't zero my boot sector.
Examples
For this example input
19 3 0 0

The expected output would be
5
 2     89
  3   7 9
   4 6  9
   4  78
    56 8

Note the spaces in place of each "missing" number, these are required; I'm not bothered about spaces which don't have a number after them (such as the missing 9s above). You can assume that whatever you are printing to will use a mono-space font. Note also the ordering, whereby solutions with a smaller smallest digit are listed first, and then those with a smallest next smallest digit, etc.
Another example, based on that above
19 3 57 9

The expected output would be
2
 2     89
   4 6  9

Note that every result contains a 9, and no result contains a 5 or 7.
If there are no solutions, for example
20 2 0 0

Then you should just output a single line with a 0 on it.
0

I've intentionally made the parsing of the input part of the fun of this question. This is code-golf, may the shortest solution win.

+1 esp. for "... I'd rather it didn't zero my boot sector."

GolfScript, 88 characters
~[[]]10,:T{{1$+}+%}/\{\0+`-!}+,\{0`+\`&!}+,\{\,=}+,\{\{+}*=}+,.,n@{1T>''*T@-{`/' '*}/n}/

A straight-forward implementation in GolfScript. Takes input from STDIN or stack.
The code can be tested here.
Code with some comments:
### evaluate the input string
~

### build all possible combinations of 0...9
[[]]              # start with set of empty combination
10,:T             #
{                 # for 0..9
  {1$+}+%         #   copy each item of set and append current digit to this copy
}/                # end for

### only keep combination which the digits given as last argument (minus 0)
\{                # start of filter block
  \0+`            #   add zero to combination and make string out of it
  -!              #   subtract from last argument -> check argument contains any
                  #     excess characters
}+,               # end of filter block

### remove any combination which contains either 0 or any digit from 2nd last argument
\{                # start of filter block
  0`+             #   take argument and append 0
  \`              #   stringify combination
  &!              #   check if no characters are common
}+,               # end of filter block

### filter for correct length
\{                # start of filter block
  \,              #   calc length of combination
  =               #   check if equal to second argument
}+,               # end of filter block

### filter for correct sum
\{                # start of filter block
  \{+}*           #   sum all digits of combination
  =               #   compare with first argument
}+,               # end of filter block

### output
.,                # determine size of set
n                 # append newline
@{                # for each combination in set
  1T>''*          #   generate "123456789"
  T@-             #   generate anti-set of current combination
  {`/' '*}/       #   replace (in the string) each digit within the
                  #   anti-combination with a space characters
  n               #   append newline
}/                # end for

JavaScript (E6) 172 180 275 296
As a (testable) function with 1 string argument and returning the requested output.
To have a real output change return with alert(), same byte count, but beware, the alert font is not monospace.
F=i=>{
  [t,d,f,m]=i.split(' ');
  for(l=0,r='',k=512;--k;!z&!h&!o&&(++l,r+=n))
    for(z=n='\n',h=d,o=t,b=i=1;i<=9;b+=b)
      z-=~(b&k?(--h,o-=i,n+=i,f):(n+=' ',m)).search(i++);
  return l+r
}

Test In FireFox or FireBug console
console.log(['19 3 0 0','19 3 57 9','19 3 57 4','20 2 0 0'].map(x=>'\n'+x+'\n' +F(x)).join('\n'))

Test output:
19 3 0 0
5
 2     89
  3   7 9
   4 6  9
   4  78
    56 8

19 3 57 9
2
 2     89
   4 6  9

19 3 57 4
1
   4 6  9

20 2 0 0
0

Ungolfed
F=i=>{
  [target, digits, forbidden, mandatory]=i.split(' ')

  result = '', nsol=0
  for (mask = 0b1000000000; --mask > 0;)
  {
    cdigits = digits
    ctarget = target
    bit = 1
    numbers = ''
    for (digit = 9; digit > 0; bit += bit, digit--)
    {

      if (bit & mask)
      {
        if (forbidden.search(digit)>=0) break;
        cdigits--;
        ctarget -= digit;
        numbers = digit + numbers;
      }
      else
      {
        if (mandatory.search(digit)>=0) break;
        numbers = ' '+numbers;
      }
    }
    if (ctarget==0 && cdigits == 0)
    {
        result += '\n'+numbers
        nsol++
    }
  }
  return nsol + result
}

Mathematica, 239 bytes
(I admit I started working on this while it was still in the sandbox.)
{t,n,a,b}=FromDigits/@StringSplit@i;Riffle[c=Cases[Union/@IntegerPartitions[t,n,Complement[r=Range@9,(d=IntegerDigits)@a]],k_/;(l=Length)@k==n&&(b==0||l[k⋂d@b]>0)];{(s=ToString)@l@c}~Join~((m=#;If[m~MemberQ~#,s@#," "]&/@r)&/@c),"\n"]<>""

Ungolfed
{t, n, a, b} = FromDigits /@ StringSplit@i;
Riffle[
  c = Cases[
    Union /@ IntegerPartitions[
      t, n, Complement[r = Range@9, (d = IntegerDigits)@a
       ]
      ],
    k_ /; (l = Length)@k ==
       n && (b == 0 || l[k ⋂ d@b] > 0)
    ];
  {(s = ToString)@l@c}~
   Join~((m = #; If[m~MemberQ~#, s@#, " "] & /@ r) & /@ c),
  "\n"] <> ""

It expects the input string to be stored in i.
It's fairly straightforward. First, input parsing. Then I use IntegerPartitions to figure out how I can split up the first number into the allowed numbers. Then I filter out all partitions that use duplicates or don't contain required numbers. And then for each solution I create a list from 1 to 9 and convert the present numbers into their string representation and the others into spaces. And then I concatenate everything.

Groovy - 494 chars
Large, uninspired answer, but it uses Google Guava to generate the "power set".
Golfed:
@Grab(group='com.google.guava', module='guava', version='17.0')
m=(args.join(" ")=~/(\d+) (\d+) (\d+) (\d+)/)[0]
i={it as int}
n=i(m[1])
r=i(m[2])
j=[]
m[3].each{if(i(it))j<<i(it)}
q=[]
m[4].each{if(i(it))q<<i(it)}
d=1..9 as Set<Integer>
t=[]
com.google.common.collect.Sets.powerSet(d).each{x->
if(x.sum()==n&&x.size()==r&&x.disjoint(j)&&x.containsAll(q)) {
s="";for(i in 0..8){if(x.contains(i+1)){s+=(i+1) as String}else{s+=" "}};t<<s}
}
p={println it}
p t.size()
t.sort().reverse().each{p it}

Sample runs:
$ groovy K.groovy 19 3 0 0
5
 2     89
  3   7 9
   4 6  9
   4  78
    56 8
$ groovy K.groovy 19 3 5 0
4
 2     89
  3   7 9
   4 6  9
   4  78
$ groovy K.groovy 19 3 5 9
3
 2     89
  3   7 9
   4 6  9
$ groovy K.groovy 20 2 0 0
0

Ungolfed:
@Grab(group='com.google.guava', module='guava', version='17.0')

m=(args.join(" ")=~/(\d+) (\d+) (\d+) (\d+)/)[0]
i={it as int}
n=i(m[1])
r=i(m[2])

j=[]
m[3].each{if(i(it))j<<i(it)}
q=[]
m[4].each{if(i(it))q<<i(it)}

d=1..9 as Set<Integer>
t=[]

com.google.common.collect.Sets.powerSet(d).each{ x ->
    if(x.sum()==n && x.size()==r && x.disjoint(j) && x.containsAll(q)) {
        s=""
        for(i in 0..8) {
            if(x.contains(i+1)){s+=(i+1) as String}else{s+=" "}
        }
        t<<s
    }
}

p={println it}
p t.size()
t.sort().reverse().each{p it}