text:
Play the "bzzt" game
Winner: Aditsu's CJam answer! A whopping 25 bytes! Nice!
You may continue to submit your answer, however you can no longer win. Original post kept for posterity:

The "Bzzt" game is a game where you must count to a number (in this case 500). However, if the number has a 3 in it, or is divisible by 3, you don't say the number. Instead, you say "Bzzt".
Rules:

You can't hard-code the numbers.
The number only has to satisfy at least 1 of the following requirements

Divisible by 3
Number contains a 3

Some type of separator is mandatory (12bzzt14 doesn't count)
Score is measured in bytes.
You must count exactly to 500, starting at 1 or 0 (you chose).
The numbers must be output, but it doesn't matter how (e.g., stdout, writing to a text file, etc.).
0 can be divisible by 3 or not divisible. You can choose.
You can output the numbers one at a time (ex, output 1, then 2, then bzzt, then 4, etc) or all at once (e.g., output 1 2 bzzt 4 5).
You must replace the letter 3 with the word "bzzt". This is not case sensitive (bZzt, Bzzt, bzzt are all okay).

This is a code-golf challenge, so the shortest code wins.
This contest ends June 30th 2014 (7 days from posting).

You can output the numbers one at a time (ex, output 1, then 2, then bzzt, then 4, etc) or all at once (ex, output 1 2 bzzt 4 5) Do you mean "you can output the number one on each line or all on one line - either way is fine"?

Yes, that's exactly what I mean.

For purposes of this question, is 0 divisible by 3?

Also, 3 should be printed as a number not as bzzt.. This meets both requirements, contains 3 and divisible by 3.

@Ourous either.

@TeunPronk See point two.

@Chipperyman you say 30 should be printed right? It seems to say that. if thats the case 3 should be printed too and so does 33 and so on.

@TeunPronk By that I meant that 30 would count as buzz. I edited the question to be more clear.

@Chipperyman fair enough.

There's a similar question here.

Similar but not a dupe.

Is a seperator required or is 12bzzt4 ok?

Is it "buzz" or "bzzt"? You wrote "buzz" twice so far.

General question for CG, I've got an answer in two languages, do I make two posts or combine them in 1?

@Martijn Two posts, unless they're very similar answers.

They are very similar, same logic, but language specific functions.

Please clarify. Do I have to output buzz or bzzt if both of the requirements apply? Do I have to output 12bzzt4 or bzzt for 1234?

I'd say bzzt for 1234. It's a 'common' drinking game here (only we often do it with 7)

@Martijn 3 is more drinking :)

"0 can be divisible by 3 or not divisible. You can choose." I really don't think you can choose. 0 mod 3 is 0, that's not really a matter of opinion.

Rule 2 seems to suggest that we only have to check one of the cases. Please clarify.

@nyuszika7h That is correct.

@Chipperyman Thanks, that means many of us can make our solutions shorter.

@nyuszika7h Wait I think I misunderstood you. Each number only needs to meet one requirement. You have to check both

@Chipperyman  Ah, that's what I thought.

I like this level of games. Not to easy, not to mathematical :)

@Chipperyman: I think it is clearer to say that it is sufficient to produce one 'bzzt' even if both requirements are met.

@Chipperyman Clarification required of last requirement 313 should the output be Bzzt or Bzzt1Bzzt ?

@AdamSpeight Bzzt is what all the other answers have.

@nyuszika7h  You shouldn't output either 12bzzt4 or bzzt for 1234, because you should have stopped at 500.

@ChrisCudmore That was just an example, duh.

The question has a bug too. "Some type of separator is mandatory (12bzzt14 doesn't count)" The output there should have been bzzt bzzt 14.

I thought "Can't hardcode the numbers" implied you can't use the number 3 in the code. What did I miss?

Means you can't make a table of { "3", "6", "9", "12", "13" }, etc.

Also, my code (...)*100000. Is there any problem with that? According to the logs, this doesn't work. Why?

"whopping" means "exceptionally large or great" - exactly the opposite of this intended meaning! maybe replace with "astounding" or an antonym: "diminutive", "minuscule", or perhaps "whoppingly small"

CJam - 25
501{3sI3%<Is-I"bzzt"?N}fI

Thanks Howard :)
Try it at http://cjam.aditsu.net/
Explanation:
501{…}fI is basically for(int I=0; I<501; ++I) {…}
3s converts 3 to string, i.e. "3"
I3% is I % 3
< gets the left substring - "3".substring(0, I % 3) - which is "" for I % 3 == 0 and "3" otherwise
Is converts I to string
- with 2 strings does a set difference, resulting in an empty string iff I % 3 == 0 (the first string was empty) or I has a 3 digit in it
…I"bzzt"? is like … ? I : "bzzt"; the previous string is treated as a boolean value, where "" is false and any other string is true
N adds a newline

You can use the same trick as in my golfscript solution and save the logical and: 501{3sI3%<Is-I"bzzt"?N}fI.

Ruby, 43
501.times{|a|puts"#{a}"[?3]||a%3<1?:Bzzt:a}

Pretty straightforward.
Edit: Saved one byte, thanks Howard!

You can save a single whitespace if you write "#{a}"[?3]||a%3<1.

@Howard: Indeed, thanks a lot!

Even more unreadable but unfortunately same length: "#{a}"[?3[0,a%3]].

What about replacing puts with p and saving 3 chars ?

@DavidUnric p prints the result of calling inspect on its argument (compared to puts, which calls to_s). So instead of printing Bzzt (which is :Bzzt.to_s), it would print :Bzzt, which doesn't match the output specifications.

Yep, got it. Just guessed it won't mind to display symbol instead of string.

seq and GNU sed - 42 33 31 30
Works directly in dash, some other shells might need to have history expansion disabled, e.g. with bash set +H:
seq 500|sed 0~3!{/3/!b}\;cbzzt

How does it work?

History expansion is disabled by default in shell scripts.

@nyuszika7h: true, but I expect many will try the answer in an interactive shell.

@nbubis: the updated version works by generating the sequence with seq. 0~3! runs {/3/!b} and together these expressions leave the line as is if it is not divisible by and does not contain a 3. The last bit "corrects" the line to bzzt.

x86 machine code on DOS (.com file) - 71 bytes
00000000  31 c9 68 20 24 89 e5 89  c8 bb 03 00 31 d2 f7 f3  |1.h $.......1...|
00000010  85 d2 74 1a 89 c8 b3 0a  31 d2 f7 f3 80 fa 03 74  |..t.....1......t|
00000020  0d 80 c2 30 86 d6 52 44  85 c0 75 ea eb 08 89 ec  |...0..RD..u.....|
00000030  68 7a 74 68 62 7a 89 e2  b4 09 cd 21 89 ec 41 81  |hzthbz.....!..A.|
00000040  f9 f4 01 7e c2 59 c3                              |...~.Y.|

Prints the required output to stdout with space as a delimiter; can be run without problems in DosBox.
Commented assembly:
    org 100h

start:
    ; 0 - 500 counter
    xor cx,cx
    ; we'll use the stack as scratch space to build the strings to print
    ; first of all, push ' $' on the stack (in reverse order); this will be
    ; the end of each string we'll print
    push 2420h
    ; save the stack pointer, to get back to this position after each print
    mov bp,sp
mainloop:
    ; first try to divide by three
    mov ax,cx
    mov bx,3
    xor dx,dx
    div bx
    test dx,dx
    ; no remainder => bzzt
    jz bzzt
    ; otherwise, go into the decimal-print loop
    mov ax,cx
divloop:
    ; bh is already at zero due to the mov bx,3 above
    mov bl,10
    xor dx,dx
    ; divide by 10
    div bx
    ; remainder is 3 => bzzt
    cmp dl,3
    je bzzt
    ; convert number to digit
    add dl,'0'
    ; trick: we move the digit to the upper byte of dx: this allows us to
    ; push the whole dx (you cannot do push dl) but to easily kill the
    ; undesidered byte by touching the stack pointer (it will be overwritten
    ; by the next stack operation/ignored by the print)
    xchg dl,dh
    push dx
    inc sp
    ; check is there anything left to print, rinse & repeat
    test ax,ax
    jnz divloop
    ; skip straight to print
    jmp print
bzzt:
    ; since we may be here from inside divloop, reset the stack pointer to
    ; where we left ' $'
    mov sp,bp
    ; push 'bzzt'
    push 747ah
    push 7a62h
print:
    ; print what is on the stack
    mov dx,sp
    mov ah,9h
    int 21h
    ; move us back to ' $'
    mov sp,bp

    ; increment cx and repeat while we are <=500
    inc cx
    cmp cx,500
    jle mainloop
end:
    ; fix back the stack pointer to the original value (=kill the first push)
    pop cx
    ; quit
    ret

RESPECT!!!!! Amazing!

@yossico: thank you! :) actually, it's nothing really special, I'm sure that people who actually wrote assembly for DOS could surely shave some more bytes off.

Perl - 35 40 42
print$_*!/3/%3?$_:bzzt,$/for 1..500

PHP, no separator - 62, 61,59,58,52,49 47
It doesn't say there should be a space/newline/separator between them, without:
while(++$i<501)echo$i%3*!strpbrk($i,3)?$i:bzzt;

With the separator, 68,67,65,64,58/55,53/52 51/50
while(++$i<501)echo$i%3*!strpbrk($i,3)?$i:bzzt,' '; // 51
while(++$i<501)echo$i%3*!strpbrk($i,3)?$i:bzzt,~õ; // 50

Just found a small 'cheat',  don't need a space after echo, saved me a bit.
The ~õ creates a newline
Another small 'cheat', the bzzt doesn't need quotes (tested it). Not the way to go, but it works.

Javascript - 54,51 50
Same principle, but javascript functions:
for(i=0;i++<500;)alert(i%3<1|/3/.test(i)?'bzzt':i)

Thanks@core for the brackets and for() tip. The for made me crash my browser a few times ^^

Haha. I tested it with console.log() obviously, but this is shorter.

Your Javascript solution counts to 501.

Indeed it did. The ++ is after the variable, the php one hs it in front :)

change the 501 to 500 and your JS is golden

PHP for 52: <?for(;500>$i++;)echo$i%3*!strpbrk($i,3)?$i:bzzt,~õ; The õ is char 245, a bit-inverted \n.

The for didn't make a difference lengthwise, but the strpbrk did (had to look it up). Not 100% sure how this works now, don't have the time atm to check some things. I've added the ~õ as a 'seperate' entry, did took the comma trick for adding a space, thanks :)_

strpbrk has the advantage over strpos that it can never return 0 as a 'found' value (at least, when searching for a 3). Also, the quotes around bzzt aren't strictly necessary, if E_NOTICE is disabled/ignored (for the purposes of codegolf, I think this can be assumed). However, I do feel that the opening tag <? should be counted. There is no setting or option which allows a script to be run without it - it's as manditory as a main declaration in C.

Tested the qoutes, don't need them. Not the way to go and I would never do this in a real situation, but... it saved 2 bytes. IMO the <?= should not be counted. That means javascript would need
I may not be the most prolific PHP golfer on the site, but I'm certainly one of them - I don't think there's many users who have submitted more than 56 answers in PHP. As a matter of precedent, I have never once not included the opening tag, unless the question specifically asked for a function, simply because the code will not run without it. <script> is of course HTML, and not Javascript. Including it would cause any stand-alone interpreter to choke - quite the opposite situation from PHP's opening tag.

for(i=0;i++<500;)alert(i%3<1|/3/.test(i)?'bzzt':i) for 50 characters... Bitwise Or | works just as well as a Logical Or || in this case...

Thanks, implemented it. I love joining these contest, a lot food for thinking and research :)

Please submit the JavaScript solution as a separate answer.

At this point that would be unfair because there might be upvotes for both the JS and the PHP. This was my first real answer, next time I'm gonna split it in two :)

why the <1? whats wring wit 0?

Because I want it to be 0. If I test if it is zero: ==0 which is 3 chars. If I test <1 which does the same, its 1 char shorter. In real life I would've choosen the ===0 for readability, but when golfing, you go for the shortest option :)

You can replace !strpbrk($1,3) with trim(3,$i) to save 4 bytes

Save two bytes on the delimiter version with underscore or any letter as delimiter (needs no parentheses).

Rules state that Some type of separator is mandatory.

Any separator will do; so _ instead of ~õ should be fine.

Javascript 50 49
-1 byte thanks to core1024
for(i=0;i++<500;)alert(i%3*!/3/.test(i)?i:'bzzt')

I knew that could be done! But didn't find how

You can imagine my face when a JavaScript solution beats my LiveScript one.

in yout second solution you could remove one & sign and it will still work

@user902383 It's not a valid result without a boolean && operator. For example: 497 % 3 = 2 => 2 & true = 0 => bzzt

for(i=0;++i<501;)alert(!/3/.test(i)*i%3?i:'bzzt') - 49 :P

@core1024 nice catch!

GolfScript, 30 29 characters
501,{:^`3`^3%<?)'bzzt'^if n}/

Not so straightforward implementation in GolfScript, can be tested here.

Perl, 36
print$_%3&&!/3/?$_:Bzzt,$/for 1..500

Edit: I'm not a Perl monk, so core1024 seems to have managed to golf another byte out of this in his answer.

Use say to save 4 bytes: say$_%3&&!/3/?$_:bzzt for 1..5e2

@Zaid why 5e2 and not 500?

@Charles: they are equivalent

@Zaid so why not be clearer?

@Charles : In the context of a code-golf challenge, should one even care?

@Zaid If one could have the same length with better legibility, why wouldn't one go for the better legibility?

C# (71)
Can be directly executed in LinqPad.
for(var i=0;++i<501;)(i%3<1|(i+"").Contains("3")?"buzz":i+"").Dump();

You can save a char by using bitwise-or (|) instead of logical-or.

@Johnbot Thanks for your suggestion.

You can remove the parentheses around the conditional too.

@Johnbot: That's not bitwise-or. It's (non-short-circuiting) logical-or, since the operands are boolean.

Dump is just LinqPad though, correct? Doing this in C# as an application would require an extension method to be added. (And it's 'bzzt' not 'buzz' =) )

And I must add - the ++i<501 in the loop is genius. I would not have thought of it.

Python (52)
Thanks grc!
for i in range(501):print[i,'Bzzt'][i%3<1or'3'in`i`]

Old version:
print['Bzzt'if'3'in`i`or i%3<1 else`i`for i in range(501)]

A little shorter: for i in range(501):print[i,'Bzzt'][i%3<1or'3'in\i`]`

One char shorter: ['3'[:i%3]in\i`]`

Haskell: 88 82 80 79
main=mapM_ f[1..500]
f n|n`mod`3<1||'3'`elem`show n=putStrLn"bzzt"
f n=print n

If i were writing an answer i would ditch IO and return a string value.

You should also switch==0 with <1

Also, try making elem prefix. I think you should be able to write elem'3'$show n, which is a char shorter. Or not. I didn't check.

@proudhaskeller: The spec states that the "numbers must be output", so IO has to be involved. And using elem in prefix notation doesn't save any characters because there has to be a space before the apostrophe; otherwise you'll get Not in scope: elem'3'. Good eye with <1, though!

Cobra - 70
class P
    def main
        for i in 501,print if('3'in'[i]'or i%3<1,'Bzzt',i)

Batch - 222
Because I genuinely love this language... for some reason...
SETLOCAL ENABLEDELAYEDEXPANSION
for /l %%n in (1,1,500) do (
    set a=%%n&set /ai=!a!%%3
    if "!a:~0,1!"=="3" set a=Bzzt
    if "!a:~1,2!"=="3" set a=Bzzt
    if "!a:~2,3!"=="3" set a=Bzzt
    if !i!==0 set a=Bzzt
    echo !a!>>x)

You should be able to drop the quotation marks around the operands in the first if because you know that there is at least one digit. Also concatenating the complete block within the for with & might work to save the parentheses.

Furthermore, you can use == instead of EQU and probably drop a few spaces here and there.

@Joey Thanks for the suggestions!

JavaScript 66 63 60
for(a=i=[];i<500;)a[i++]=i%3&&!/3/.test(i)?i:'bzzt';alert(a)

Thanks to edc65 for the suggestion to use array. The output will now be comma-separated.

Old versions
Version 1a - 66
Print from 1 to 500 in an alert box according to the rule. The output is space-separated.
a="";for(i=1;i<501;i++)a+=i%3&&!/3/.test(i)?i+" ":"bzzt ";alert(a)

Version 1b - 65
If we consider 0 to be not divisible by 3, we can shorten the solution to 65 character:
a=0;for(i=1;i<501;i++)a+=i%3&&!/3/.test(i)?" "+i:" bzzt";alert(a)

Version 2 - 63
for(a=i="";i<501;)a+=++i%3&&!/3/.test(i)?i+" ":"bzzt ";alert(a)

Thanks to grc for the suggestion to reduce the length.

I think you could start with for(a=i="";i<500;)a+=++i ...

I comma separeted output is OK, an array will be shorter:
for(o=i=[];i<500;)o[i++]=i%3&&!/3/.test(i)?i:'bzzt';alert(o)

PowerShell, 42
1..500|%{($_,'bzzt')[$_-match3-or!($_%3)]}

Mostly Ventero's work, with a little help on syntax by me ;-)

R, 49 characters
a=1:500;b='bzzt';a[!a%%3]=b;a[grep(3,a)]=b;cat(a)

Explained:
a=1:500 #Creates a vector with all integers from 1 to 500
b='bzzt'
a[!a%%3]=b #Replace all multiples of 3 by 'bzzt', thus coercing all other integers to character strings
a[grep(3,a)]=b #Replaces the character strings containing 3 by 'bzzt'
cat(a) #Print to stdout

Usage:
> a=1:500;b='bzzt';a[!a%%3]=b;a[grep(3,a)]=b;cat(a)
1 2 bzzt 4 5 bzzt 7 8 bzzt 10 11 bzzt bzzt 14 bzzt 16 17 bzzt 19 20 bzzt 22 bzzt bzzt 25 26 bzzt 28 29 bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt 40 41 bzzt bzzt 44 bzzt 46 47 bzzt 49 50 bzzt 52 bzzt bzzt 55 56 bzzt 58 59 bzzt 61 62 bzzt 64 65 bzzt 67 68 bzzt 70 71 bzzt bzzt 74 bzzt 76 77 bzzt 79 80 bzzt 82 bzzt bzzt 85 86 bzzt 88 89 bzzt 91 92 bzzt 94 95 bzzt 97 98 bzzt 100 101 bzzt bzzt 104 bzzt 106 107 bzzt 109 110 bzzt 112 bzzt bzzt 115 116 bzzt 118 119 bzzt 121 122 bzzt 124 125 bzzt 127 128 bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt 140 bzzt 142 bzzt bzzt 145 146 bzzt 148 149 bzzt 151 152 bzzt 154 155 bzzt 157 158 bzzt 160 161 bzzt bzzt 164 bzzt 166 167 bzzt 169 170 bzzt 172 bzzt bzzt 175 176 bzzt 178 179 bzzt 181 182 bzzt 184 185 bzzt 187 188 bzzt 190 191 bzzt bzzt 194 bzzt 196 197 bzzt 199 200 bzzt 202 bzzt bzzt 205 206 bzzt 208 209 bzzt 211 212 bzzt 214 215 bzzt 217 218 bzzt 220 221 bzzt bzzt 224 bzzt 226 227 bzzt 229 bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt 241 242 bzzt 244 245 bzzt 247 248 bzzt 250 251 bzzt bzzt 254 bzzt 256 257 bzzt 259 260 bzzt 262 bzzt bzzt 265 266 bzzt 268 269 bzzt 271 272 bzzt 274 275 bzzt 277 278 bzzt 280 281 bzzt bzzt 284 bzzt 286 287 bzzt 289 290 bzzt 292 bzzt bzzt 295 296 bzzt 298 299 bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt 400 401 bzzt bzzt 404 bzzt 406 407 bzzt 409 410 bzzt 412 bzzt bzzt 415 416 bzzt 418 419 bzzt 421 422 bzzt 424 425 bzzt 427 428 bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt bzzt 440 bzzt 442 bzzt bzzt 445 446 bzzt 448 449 bzzt 451 452 bzzt 454 455 bzzt 457 458 bzzt 460 461 bzzt bzzt 464 bzzt 466 467 bzzt 469 470 bzzt 472 bzzt bzzt 475 476 bzzt 478 479 bzzt 481 482 bzzt 484 485 bzzt 487 488 bzzt 490 491 bzzt bzzt 494 bzzt 496 497 bzzt 499 500

TI-BASIC - 31 (32)(34)(35)(36)(43)
:While X<500
:X+1→X
:If not(fPart(X/3
:"bzzt
:Disp Ans
:End

Total: 25 + 6 lines = 31

Note that most commands on TI-BASIC are represented as single-byte entities.
The code requires X to be initialized to 0 beforehand (otherwise, it's an extra 3 bytes).
I've made several attempts to shave several bytes, so I'm not detailing everything I've done here, as to not clutter the post. They have mostly been directed at shortening the loop, which I've done in this version by a While loop and by shortening the If condition with the help of the Ans variable.

Correct me if I am wrong, but this does not seem to bzzt numbers containing 3's, e.g. 13.

@Thor You are correct, but I'm within the rules, as they state that I may print bzzt for only the numbers that are divisible by 3. Adding the other way could be possible, but would need more instructions.

The rules say: if the number has a 3 in it, or is divisible by 3, you don't say the number. Instead, you say "Bzzt", so I would say both should be replaced.

@Thor What bothers me now most is that teeny tiny comma in the middle of the sentence. The way I've interpreted it, both ways of doing are equally valid, which also explains the 2nd rule: The number only has to satisfy 1 of the requirements... (either have a 3 or be divisible by 3)

You miscounted the bytes here because lowercase letters are two-byte tokens. I agree with Thor's interpretation of the rules as it is the one that every answer above this uses.

groovy - 51
500.times{println"$it".find('3')||it%3<1?'bzzt':it}

edit: using times the printing version is now as short as the "displaying". thanks @will-p

+1. You can swap (1..500).each for 500.times

C, 93
Just for the hell of it...
main(i){char s[9]="bzzt";while(i<498+sprintf(s+5,"%d",i))puts(s+5*(i++%3&&!strchr(s+5,51)));}

This has a small glitch - it skips the output for i = 0

@anatolyg "You must count exactly to 500, starting at 1 or 0 (you chose)." — I chose to start from 1.

Missed that bit. Sorry!

Skips a lot more if you pass it arguments, lol.  But, it is well golfed, I'll give you that!  Right down to using the return value of sprintf as you trend towards the three digit numbers to control the while, lol.  So bad....haha!

Julia 64 bytes
map(x->x%3==0||contains(string(x),"3")?"Bzzt":string(x),[1:500])

[println(a%3==0||3 in digits(a)?"bzzt":a) for a=1:500] is 54 bytes.  Also returning an array doesn't print the entire array, so I'm not sure if it counts as being "output".  If returning an array counts then [a%3==0||3 in digits(a)?"bzzt":a for a=1:500] might count and score 45.

k4 (37) (35)
{$(x;`bzzt)(|/51=$x)|~"."in$x%3}'!501

k4 lacks a built-in modulo command, and using the q one would take an extra character; this version (ab)uses the built-in output format to check if the string of the result of dividing x by 3 has a decimal point in it.
EDIT:
{$(x;`bzzt)(|/51=$x)|x=3*_x%3}'!501

Clever as matching the decimal point may be, I can shave two bytes by checking that 3*floor x%3 is still x.

Upvoted for cleverly matching the decimal point!

Please don't update all of your answers at ones. That will push all the active challenges off the front page. It would be nice if you only did one or two a time. (Although I don't even think changing between h1 and h2 is important enough to warrant an edit in the first place.)

cmd.exe - 91
for /l %x in (1,1,500)do @set/a %x%3|find "0">nul&&echo bzzt||echo %x|find/v"3"||echo bzzt

...because why use a batch file when a perfectly straightforward one-liner exists...:-)

Mathematica, 54 Characters
This feels too straightforward. Shorter solutions must be possible.
If[DigitCount[#][[3]] > 0 || #~Mod~3 < 1, Bzzt, #] & /@ Range@500

You don't need the apostrophes :)

@belisarius indeed. Thanks.

T-SQL 2008 - 80
Not going to win or anything but fun none the less:
Tweaked thanks to @domager:
declare @ int=0t:if(@)like'%3%'or @%3=0print'bzzt'print @;set @+=1if @<501goto t

A little known fact, @ is a valid name for a variable. It feels weird as the set based code is the more SQL variant, but shorter is shorter! This version works on any database.
Edit:
I was able to remove two of the semis as they were not needed. I'm pretty sure this is as optimal as it gets.
Edit2:
Never say never. Here it's now even grosser using goto, but it allows us to avoid the block. We can Replace while,begin,end with the shorter if,t:,goto saving 6 characters. We also rearrange statement by rewriting the loop as a pseudo do-while,semantically equivalent.
Edit3:
Yeah, somehow if is now shorter.
Original:
select top 501iif(number like'%3%'or number%3=0,'bzzt',str(number))from spt_values where'p'=type

Must be run on the master database.
I love T-SQL despite its noisy and ugly ways. There might be a way to make this simpler, but unfortunately, the iif built-in requires both sides agree on types. Sql servers precedence rules give int higher precedence than strings. Number is also really long, but aliasing is more characters than it is worth. There might be a better way to turn number in to a string.
Edit: str works too. 2 less characters than ltrim

At first I thought your code is 2012.96 bytes long.

slightly longer in @ 101, but doesn't rely on a table declare @i int=1;while(@i<501)begin;if(@i)like'%3%'or @i%3=0 print'bzzt'else print @i;set @i=@i+1 end

@domager, totally right, plus we can save quite a few characters by switching the variable to @. Then using iif() is still shorter than an if(...)print else print so we gain quite a bit by using the iif expression. Also we can use the shorter @+=1 to save a char

I didn't know T-SQL supported +=. I don't have it handy to test, but I'm pretty sure it supports ''+@ for string conversion using the invariant locale.

+= was added in 2008. It does support ''+@, but it doesn't do what you want. As I said, precedence rules cast to int first so it casts '' to int, resulting in zero so ''+@ is @ still typed as an int.str works and it isn't that much more expensive than anything else (2 extra chars for the parens). I chose t-sql 2012 here because of the IIF operator, who knows maybe 2016's release sql will get rid of some of the noise and start being competitive (unlikely).

Hi, your script returns values with 3 regardless. Seems you are missing an else or need to use IIF. This can be golfed to 82 bytes.

C, 80
Using spaces as separators instead of line breaks.
n;main(){for(;n++<500;)printf(n%10^3&&n/10%10^3&&n/100^3&&n%3?"%d ":"bzzt ",n);}

1 bzzt 3 4 bzzt 6 7 bzzt 9 10 bzzt bzzt 13 bzzt ... There's something wrong here.

It seems I was too greedy, and stumbled into Undefined Behavior (variable modified and read between sequence points). Now fixed.

Working now :-)

VBA: 54
for x=0to 500:?iif(x/3=x\3=instr(1,x,3),x,"Bzzt"):next

Open up your favorite Office program, hit alt+F11 to open the VBA IDE and paste the code into the immediate pane and press enter.
In VBA, : is the line separator, ? is shorthand for print, iif means inline if (think x?"Y":"N"), x/3 does floating point division and x\3 does integer division, instr returns the position of a char in a string, or 0 otherwise, true=-1 and false=0.
The code basically increments x and outputs x if x/3=x\3=instr(1,x,3) is true and "Bzzt" otherwise.  x/3=x\3 compares (float)(x/3) to (int)(x/3) and returns a boolean (0 is false and -1 is true).  instr(1,x,3) returns 0 if "3" is not in the number, and a positive integer otherwise.  The only time the expression returns true is when (x/3=x\3) is false (0) and instr(1,x,3) is 0, or in other words, when x is not divisible by 3 and does not contain the digit "3", which is exactly what we are looking for.

Fortran - 118 114 111
A hopelessly unlikely candidate, though originally developed to fit on punch cards. Using all the obscure constructs from the past, some short code may still be written:
do3 i=1,500
j=i
if(mod(i,3))2,1,2
1 print*,'bzzt'
cycle
2 goto(1)mod(j,10)-2
j=j/10
if(j>0)goto2
3 print*,i
end

The "computed goto" goto(L1,L2,...,Ln) x branches to one of the labels L if and only if 1 <= x <= n.
Edit: Managed to shave off 4 bytes by rearranging the loop that checks for the digit 3. As a bonus, the code now also contains the arithmetic if-statement if(x) a,b,c, which always branches to one of three labels: a if x < 0, b if x == 0 or c if x > 0.
Unfortunately, the first two versions did not produce the correct output. The digit-3 loop now works correctly, and the code now also includes a modern logical if-statement. Three more bytes are gone, because who needs an enddo statement? The output may be verified here.

Scala, 70
Code
1 to 500 map(x=>if(x%3<1||(""+x).contains(51))"bzzt"else x)map println

Usage
scala -e '1 to 500 map(x=>if(x%3<1||(""+x).contains(51))"bzzt"else x)map println'

Demo
http://ideone.com/KfcO1M
Explanations

1 to 500: produces values from 0 to 500
map: function which takes iterable argument at the left, and applies the function given at the right
x=>...: lambda expression
if(condition) value_if_condition_is_true else value_if_condition_is_false: returns a value (functional behavior) which can be either a java.lang.String or a scala.Int. The expression type is scala.Any in this case, because this is the lower type the two types can coerce to (see the Scala Class Hierarchy)
map println: takes each object (java.lang.String or scala.Int) and prints it with line feeds

Swift - 74
for i in 0..501 {println(i%3<1||"\(i)".rangeOfString("3") ?"bzzt":"\(i)")}

Bash, 53 52 48 46
seq 500|factor|sed '/3.*:\| 3 */cBzzt
s/:.*//'

Requires GNU sed (uses the c extension).

Java,  142 131
thank to WozzeC suggestion
public class a{public static void main(String[]a){for(int i=1;i<501;i++)System.out.println(i%3>0&(""+i).indexOf(51)<0?i:"bzzt");}}

My Java is a bit rusty. But wont it be shorter with an and operand? i%3>0&&(""+i).indexOf(51)<0?i:"bzzt" . It might also be possible to skip the { } for the forloop.

this is 122 bytes, 9 less: class A{public static void main(String[]a){for(int i=0;++i<501;System.out.println(i%3>0&(""+i).indexOf(51)<0?i:"bzzt"));}}

R (40) (36)
This is basically plannapus answer a little bit shortened, but I can not comment yet
Update: -4 characters (see plannapus's comment)
a=1:500;a[grepl(3,a)|!a%%3]='bzzt';a

Output:
  [1] "1"    "2"    "bzzt" "4"    "5"    "bzzt" "7"    "8"    "bzzt" "10"   "11"   "bzzt" "bzzt" "14"   "bzzt" "16"   "17"   "bzzt" "19"   "20"   "bzzt" "22"   "bzzt" "bzzt" "25"   "26"   "bzzt" "28"   "29"   "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "40"   "41"   "bzzt" "bzzt" "44"   "bzzt" "46"   "47"   "bzzt" "49"   "50"   "bzzt" "52"   "bzzt" "bzzt" "55"   "56"   "bzzt" "58"   "59"   "bzzt" "61"   "62"   "bzzt" "64"   "65"   "bzzt" "67"   "68"   "bzzt" "70"   "71"   "bzzt" "bzzt" "74"   "bzzt" "76"   "77"   "bzzt" "79"   "80"   "bzzt" "82"   "bzzt" "bzzt" "85"   "86"   "bzzt" "88"   "89"   "bzzt" "91"   "92"   "bzzt" "94"   "95"   "bzzt" "97"   "98"   "bzzt" "100"  "101"  "bzzt" "bzzt" "104"  "bzzt" "106"  "107"  "bzzt" "109"  "110"  "bzzt" "112"  "bzzt" "bzzt" "115"  "116"  "bzzt" "118"  "119"  "bzzt" "121"  "122"  "bzzt" "124"  "125"  "bzzt" "127"  "128"  "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "140"  "bzzt" "142"  "bzzt" "bzzt" "145"  "146"  "bzzt" "148"  "149"  "bzzt" "151"  "152"  "bzzt" "154"  "155"  "bzzt" "157"  "158"  "bzzt" "160"  "161"  "bzzt" "bzzt" "164"  "bzzt" "166"  "167"  "bzzt" "169"  "170"  "bzzt" "172"  "bzzt" "bzzt" "175"  "176"  "bzzt" "178"  "179"  "bzzt" "181"  "182"  "bzzt" "184"  "185"  "bzzt" "187"  "188"  "bzzt" "190"  "191"  "bzzt" "bzzt" "194"  "bzzt" "196"  "197"  "bzzt" "199"  "200"  "bzzt" "202"  "bzzt" "bzzt" "205"  "206"  "bzzt" "208"  "209"  "bzzt" "211"  "212"  "bzzt" "214"  "215"  "bzzt" "217"  "218"  "bzzt" "220"  "221"  "bzzt" "bzzt" "224"  "bzzt" "226"  "227"  "bzzt" "229"  "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "241"  "242"  "bzzt" "244"  "245"  "bzzt" "247"  "248"  "bzzt" "250"  "251"  "bzzt" "bzzt" "254"  "bzzt" "256"  "257"  "bzzt" "259"  "260"  "bzzt" "262"  "bzzt" "bzzt" "265"  "266"  "bzzt" "268"  "269"  "bzzt" "271"  "272"  "bzzt" "274"  "275"  "bzzt" "277"  "278"  "bzzt" "280"  "281"  "bzzt" "bzzt" "284"  "bzzt" "286"  "287"  "bzzt" "289"  "290"  "bzzt" "292"  "bzzt" "bzzt" "295"  "296"  "bzzt" "298"  "299"  "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "400"  "401"  "bzzt" "bzzt" "404"  "bzzt" "406"  "407"  "bzzt" "409"  "410"  "bzzt" "412"  "bzzt" "bzzt" "415"  "416"  "bzzt" "418"  "419"  "bzzt" "421"  "422"  "bzzt" "424"  "425"  "bzzt" "427"  "428"  "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "bzzt" "440"  "bzzt" "442"  "bzzt" "bzzt" "445"  "446"  "bzzt" "448"  "449"  "bzzt" "451"  "452"  "bzzt" "454"  "455"  "bzzt" "457"  "458"  "bzzt" "460"  "461"  "bzzt" "bzzt" "464"  "bzzt" "466"  "467"  "bzzt" "469"  "470"  "bzzt" "472"  "bzzt" "bzzt" "475"  "476"  "bzzt" "478"  "479"  "bzzt" "481"  "482"  "bzzt" "484"  "485"  "bzzt" "487"  "488"  "bzzt" "490"  "491"  "bzzt" "bzzt" "494"  "bzzt" "496"  "497"  "bzzt" "499"  "500"

Since many string operation functions (such as strsplit) throw error when fed with non-characters I assumed grepl did as well. Nice catch! +1

By the way since you reduced it to one expression you don't need to define b prior to that: a=1:500;a[grepl(3,a)|!a%%3]='bzzt';a

05AB1E, 26 23 21 bytes (non-competing)
501FND3ÖN3å~i"bzzt"},

Try it online!

k®› could be replaced with å.

I know it's been a while, but it can be 19 bytes now with ₄;END3ÖN3å~i.•è‰•}, or ₄;LεD3Öy3å~i.•è‰•]».

Haskell 78
main=mapM(putStrLn.f)[0..500];f x|x`mod`3<1||'3'`elem`show x="bzzt";f x=show x

Python - 53
for i in range(1,501):print[i,'Bzzt']['3'[:i%3]in`i`]

Can't add comments to above answer so posting down here. Starting range at 0 produces Bzzt at 0, need to start at 1.

JavaScript - 57
Another JavaScript example:
for(i=0;i<500;)alert((++i+'').indexOf(3)<0&&i%3?i:'bzzt')

Microsoft Small Basic (115 chars, 127 bytes)

For i = 1 To 500
j=i
If(Math.Remainder(i,3)=0 Or Text.IsSubText(i,"3"))then
j="bzzt"
EndIf
TextWindow.Write(j+" ")
EndFor

PROLOG (144)
b:-b(R,1),print([0|R]).
b([500],500).
b([bzzt|R],N):-((0is N mod 3);(name(N,C),member(51,C))),N1 is N+1,b(R,N1).
b([N|R],N):-N1 is N+1,b(R,N1).

Usage:
b.

Ruby, 57
Not a competitive Ruby answer, but I like it because it's weird.
i=-1;([b=:bzzt,p,p]*167).map{|a|puts"#{i+=1}"[?3]?b:a||i}

Python2 (59)
Simple case of list comprehension
print[n if n%3or '3'in str(n)else"bzzt"for n in range(501)]

With some tips you can get to 52 bytes at least.

Mouse-2002, 34 bytes
I'm proud that lil' ol' Mouse, first implemented in 1979 and the most recent iteration updated Aug '07 (excluding the one by me), can do so well! :')
(x.501<^x.d\[x.!J!'|"bzzt!"]x.1+x:)

Explained:
(             ~ while true
  x. 501 < ^  ~ push x; push 1 if less than 501 and break if 0
  x. d \      ~ push x mod 3
  [           ~ if 0; then
    x. ! J!'  ~ push x and print, push the ascii code 9 and print
  |           ~ else
    "bzzt!"   ~ print this string
  ]           ~ endif
  x. b+ x:    ~ push x, increment by 1
)             ~ endwhile
$             ~ (implicit for scripts) end prog

Sample run:
$ mouse bzzt.mou | head
bzzt
1       2       bzzt
4       5       bzzt
7       8       bzzt
10      11      bzzt
13      14      bzzt
16      17      bzzt
19      20      bzzt
22      23      bzzt
25      26      bzzt

Tab chars because I say so.
My reboot of this language's legacy can do this exact thing in 27 bytes:
(x501<^xd\[x.|"bzzt".]1!x+)

And I'm not even aiming for it to be a golfing lang, just a small syntax! No interpreter yet.

MathGolf, 19 18 bytes
♪½{î3╧î3÷+î╕▄┴_ß§p

Try it online!
Explanation
♪                     push 1000
 ½                    divide by 2, making 500
  {                   start for loop
   î                  index of current loop (1-based)
    3                 push 3
     ╧                pop a, b, a.contains(b)
      î               index of current loop (1-based)
       3              push 3
        ÷             is divisible
         +            pop a, b : push(a+b)
          î           index of current loop (1-based)
           ╕▄┴        decompress "bzzt"
              _       duplicate TOS
               ß      wrap last three elements in array (makes [<index>, "bzzt", "bzzt"])
                §     get from array
                 p    print with newline

How does the string compression work, and is there some kind of generator program I could use for other strings? Just posted an answer with two strings, but not sure how to do string compression in MathGolf.

The way I do it is that I check the reference page and Code page 437, and I match the column and the row of the character within the code page with the indices of the string I want. So, ╕ means indexing in the string etaoinsrdluczbfp. In that string, b has index 13, z has index 12, and t has index 1. Thus, I look at row 13 and column 12 for bz, which is character ▄. Then I look at row 12 and column 1 for zt, which is character ┴.

Be wary though that it is not strictly Code page 437, since I swapped two characters (the null byte and the non-breaking space). Both of these characters should be replaced with their new counterparts (× and Þ). It should be fairly straight-forward to make a generator program for short strings, I just haven't made one. The compression is nothing fancy, but in cases like this challenge it can save you 2 bytes over the standard ÿbzzt.

Ah ok. And compressed strings of mixed characters? So partially from etaoinsrdluczbfp and partially from gwymvkxjqh ?*#.,? Or that isn't possible (yet)? To be more concrete, what would the compressed strings for ÿduck and "goose be? (Here a link to my current answer.)

I've been able to figure out how to compress "goose to 'g╕3` . As for ÿduck, I guess I could use a 3-char compression for "duc" and a loose 'k, but how does that work when they are in pairs of row-column? EDIT: Never mind, for 3-char it doesn't matter what the column is, but now I have the problem that the strings aren't joined to print. Maybe a different question: how to do a ranged loop without pushing the indexes of the loop? I now have this.

There's no support for mixing compression and non-compression right now. One thing that's high on my list is to fix better support for fetching words from the dictionary. That way you could define a string, and have it implicitly converted to a list of 16-bit numbers, and used as indices for dictionary fetching. That could probably help a challenge like this. For your answer, the best I could come up with was ƒú╒{;╖è╗'kn}'g╕3`` (you can save 1 byte by replacing {}` with the appropriate 7-byte block character. This is 1 byte longer than what you sent unfortunately.

Ok clear. I now have ƒú╒ôÿduckp╘'g╕3` , so your ƒú╒ö;╖è╗'kn'g╕3`  would be the same byte-count. Thanks for the explanation, though. Will keep this in mind in the future.

Also to answer your previous question, it is not possible to mix the two strings etaoinsrdluczbfp and gwymvkxjqh ?*#.,. This method of decompression was implemented very early during development, and wasn't actually intended to be a permanent feature. But it has turned out to be very helpful for a few challenges.

Vyxal Hj, 21 16 14 bytes
5*ƛ:3₌cḊ∨ß«⊍β«

Try it Online!
Explained
5*ƛ:3₌cḊ∨ß«⊍β«

5*             # The H flag pushes 100 to stack so 5*100=500
  ƛ:3₌cḊ∨ß     # check divisibility by 3 or if it has a 3
          «⊍β« # compressed string of "bzzt"
               # j flag joins with newlines

16 bytes using string compression, a flag, and some other golfs

14 bytes by mapping instead of looping and then using the j flag

12 bytes by removing redundant elements

Delpi - 128
procedure x;var I: integer;begin for I:=0to 500do writeln(iif((IntToStr(i).Contains('3')or(i mod 3=0)),'bzzt',inttostr(i)));end;

That won't compile. You never declared i. Also there's no iif in Delphi. You must use IfThen().

I don't understand why I didnt declare I, maybe I made it a global variable which shouldnt work either.. I'll correct it. But there is an iif in delphi, its in the unit IdGlobal.

seq and awk 48 38
seq 500|awk '!($1%3)||/3/{$1="bzzt"}1'

The awk code part could be $1%3&&!/3/||$1="bzzt".

Python2 (63)
Corrected version of @idiot.py's code (I don't have enough reputation to comment on his post).
print[n if n%3and'3'not in str(n)else"bzzt"for n in range(501)]

or, equivalently,
print["bzzt"if not n%3or'3'in str(n)else n for n in range(501)]

You have to negate the second condition, otherwise it gives incorrect output.
output:
['bzzt', 1, 2, 'bzzt', 4, 5, 'bzzt', 7, 8, 'bzzt', 10, 11, 'bzzt', 'bzzt', 14, 'bzzt', 16, 17, 'bzzt', 19, 20, 'bzzt', 22, 'bzzt', 'bzzt', 25, 26, 'bzzt', 28, 29, 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 40, 41, 'bzzt', 'bzzt', 44, 'bzzt', 46, 47, 'bzzt', 49, 50, 'bzzt', 52, 'bzzt', 'bzzt', 55, 56, 'bzzt', 58, 59, 'bzzt', 61, 62, 'bzzt', 64, 65, 'bzzt', 67, 68, 'bzzt', 70, 71, 'bzzt', 'bzzt', 74, 'bzzt', 76, 77, 'bzzt', 79, 80, 'bzzt', 82, 'bzzt', 'bzzt', 85, 86, 'bzzt', 88, 89, 'bzzt', 91, 92, 'bzzt', 94, 95, 'bzzt', 97, 98, 'bzzt', 100, 101, 'bzzt', 'bzzt', 104, 'bzzt', 106, 107, 'bzzt', 109, 110, 'bzzt', 112, 'bzzt', 'bzzt', 115, 116, 'bzzt', 118, 119, 'bzzt', 121, 122, 'bzzt', 124, 125, 'bzzt', 127, 128, 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 140, 'bzzt', 142, 'bzzt', 'bzzt', 145, 146, 'bzzt', 148, 149, 'bzzt', 151, 152, 'bzzt', 154, 155, 'bzzt', 157, 158, 'bzzt', 160, 161, 'bzzt', 'bzzt', 164, 'bzzt', 166, 167, 'bzzt', 169, 170, 'bzzt', 172, 'bzzt', 'bzzt', 175, 176, 'bzzt', 178, 179, 'bzzt', 181, 182, 'bzzt', 184, 185, 'bzzt', 187, 188, 'bzzt', 190, 191, 'bzzt', 'bzzt', 194, 'bzzt', 196, 197, 'bzzt', 199, 200, 'bzzt', 202, 'bzzt', 'bzzt', 205, 206, 'bzzt', 208, 209, 'bzzt', 211, 212, 'bzzt', 214, 215, 'bzzt', 217, 218, 'bzzt', 220, 221, 'bzzt', 'bzzt', 224, 'bzzt', 226, 227, 'bzzt', 229, 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 241, 242, 'bzzt', 244, 245, 'bzzt', 247, 248, 'bzzt', 250, 251, 'bzzt', 'bzzt', 254, 'bzzt', 256, 257, 'bzzt', 259, 260, 'bzzt', 262, 'bzzt', 'bzzt', 265, 266, 'bzzt', 268, 269, 'bzzt', 271, 272, 'bzzt', 274, 275, 'bzzt', 277, 278, 'bzzt', 280, 281, 'bzzt', 'bzzt', 284, 'bzzt', 286, 287, 'bzzt', 289, 290, 'bzzt', 292, 'bzzt', 'bzzt', 295, 296, 'bzzt', 298, 299, 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 400, 401, 'bzzt', 'bzzt', 404, 'bzzt', 406, 407, 'bzzt', 409, 410, 'bzzt', 412, 'bzzt', 'bzzt', 415, 416, 'bzzt', 418, 419, 'bzzt', 421, 422, 'bzzt', 424, 425, 'bzzt', 427, 428, 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 'bzzt', 440, 'bzzt', 442, 'bzzt', 'bzzt', 445, 446, 'bzzt', 448, 449, 'bzzt', 451, 452, 'bzzt', 454, 455, 'bzzt', 457, 458, 'bzzt', 460, 461, 'bzzt', 'bzzt', 464, 'bzzt', 466, 467, 'bzzt', 469, 470, 'bzzt', 472, 'bzzt', 'bzzt', 475, 476, 'bzzt', 478, 479, 'bzzt', 481, 482, 'bzzt', 484, 485, 'bzzt', 487, 488, 'bzzt', 490, 491, 'bzzt', 'bzzt', 494, 'bzzt', 496, 497, 'bzzt', 499, 500]

C, 90 86 81
i,s;main(){while(++i<501)sprintf(&s,"%d",i),puts(i%3&&!strchr(&s,51)?&s:"bzzt");}

Not a serious contender.  This is essentially bacchusbeale's answer golfed better, as I suggested in comments to his answer.  As well as those changes, I used strchr as a shorter test than a for loop to see if the string version of the integer contains the character 3 (character 51 in ASCII).
Edit: down to 81 characters incorporating edc65's sick trick from the comments (assumes int is at least 32 bits). Thanks!

81: i,s;main(){while(++i<501)sprintf(&s,"%d",i),puts(i%3&&!strchr(&s,51)?&s:"bzzt"); (need a 32 bits int or longer)

Tcl 90
set i 0;while {$i < 501} {if {[regexp 3 $i]||($i %3)<1} {puts "bzzt"} {puts "$i"};incr i}

I'm sure other tclers could make this more terse, but the interpreter is funny about whitespaces.

C, 79
i;main(s){while(++i<498+sprintf(&s,"%d",i))puts(i%3*!strchr(&s,51)?&s:"bzzt");}

Improved version of squeamish ossifrage's solution. Now it's the shortest C solution.

JavaScript, 70
First entry into a code golf
i=0;while(i<501)console.log(((""+i).match(/3/g)||i%3==0)?'bzzt':i),i++

Can probably be made shorter, but this one doesn't do alert and make you want to kill the developer.

Count up to 500, for better than while as you use i=0;i++;,alert(once!) better than console.log, test better than match,invert condition to avoid ==0, then you have [http://codegolf.stackexchange.com/questions/32267/play-the-bzzt-game#32270]

C#
Code can be executed directly in LinQPad.
Number is divisible by 3 (49)
var i=0;while(i++<501)(i%3<1?"bzzt":i+"").Dump();

This one should count as the question stated:

The number only has to satisfy at least 1 of the following requirements.

Number contains 3 (64)
var i=0;while(i++<501)((i+"").Contains("3")?"bzzt":i+"").Dump();

Both conditions apply (70)
var i=0;while(i++<501)(i%3<1|(i+"").Contains("3")?"buzz":i+"").Dump();

LiveScript (54)
for n to 500=>alert if n%3==0||/3/test n=>\bzzt else n

bash – 74
I know it won't win anything, not even within bash, but thought I'd submit one where 500 or 501 is not in the solution.
seq 0 166|awk '{print"bzzt\n"($1)*3+1"\n"($1)*3+2;}'|sed 's/.*3.*/bzzt/g'

Java, 127 124 95 bytes
class B{static{for(int i=0;i++<500;System.out.println(i%3<1||(i+"").contains("3")?"Bzzt":i));}}

It throws an exception at the beginning but it works, at least for me (Java version 1.7.0_60-b19 on Mac OS X 10.8.5).

That trick doesn't work in Java 7 or later. It looks for a main method before executing static initializers.

@tbodt I have Java 7 and it works

Is there any way you can get a modern toolset to compile and run this, please add it to the answer? (I use 1.7.0_55 on linux) If you need a specific version you need to mention it in your answer.

I tested it on Java 6 (works then throws exception) and Java 8 (doesn't work).

C# (110)
Enumerable.Range(1,500).All(x =>{Console.Write((x%3==0)||(x + "").Contains("3")?"Bzzt ":x+" ");return true;});

You can get a lower byte count by removing unnecessary whitespace. Actually, you don't need any whitespace here.

What version of C# has an IEnumerable<T>.ForEach method?

I get an error on Mono's C# compiler: Unexpected symbol: \Enumerable'`

(x+"").Contains("3") should work instead of the ToString() to shorten it.

Made the changes, removed ForEach which was a extension method from a 3rd party library.

Can you return 1 instead of true? Also, there are whitespaces in (x + "")

F# - 86
for i in 0..500 do if(string i).Contains"3"||i%3=0 then printfn"Bzzt"else printfn"%i"i

PHP, no seperator - 53
while(++$i<501)echo$i%3<1||strpos(-$i,'3')?'bzzt':$i;

It's a improved version of @Martijn's code. I would like to add comment to his answer, but I haven't enough reputation to do that...

Delphi - 119
repeat ShowMessage(IfThen((Tag mod 3=0) or (pos('3',IntToStr(Tag))>0),'bzzt',IntToStr(Tag))); Tag:=Tag+1 until Tag=500

Uses the fact that "self" is assumed so the form's Tag property can be accessed directly without actually declaring a variable. I had critiqued another Delphi answer here a few minutes ago so I thought it was only fair I posted one too.

JAGL V1.0 - 35
1 501r{ddg@3%nSg51e|"bzzt"SnI32+p}/

Probably could have done better. May try to revise it.
Explaination:
1 501r                                     Make a range of 1 to 500 inclusive
      {ddg                                 Duplicate twice and convert top to string
          @3%n                             Rotate top 3 on stack, and push not(top mod 3)
              Sg                           Swap top two values, and convert top to string
                51e                        Check if 51 (3) is in the string rep
                   |"bzzt"                 Take the logical "or", and push "bzzt"
                          SnI              Swap, reverse, and if not divisible, drop "bzzt"
                             32+p          Add a space, and print
                                 }/        End block, and map over range

Java, 139 132 128 127 bytes
class A{public static void main(String[] a){for(int i=0;i++<500;)System.out.print(i%3==0|(i+"").contains("3")?"bzzt ":i+" ");}}

You can shave off a couple of characters by removing the {} braces  on your for loop and doing a i++<501;) check.

Sure @NathanMerrill....shortened 'args' variable name as well

Too many parenthesis: both % and == have higher precedence than || and all of them have higher precendece than ?:: System.out.print(i%3==0||(i+"").contains("3")?"bzzt ":i+" ").

well said @manatwork I never cared/thought about using precedence before. Will keep in mind for code-golf

As now it became too similar to Jop V.'s Java answer, here is another trick: use bitwise | instead of logical ||. In this case gives the same result.

@manatwork Just a matter of chance. And can't think of a MUCH different Java answer

jq: 59 bytes
(56 characters code + 3 characters command line option.)
range(501)|select(.%3<1or("\(.)"|test("3"))|not)//"bzzt"

Sample run:
bash-4.3$ jq -n -r 'range(501)|select(.%3<1or("\(.)"|test("3"))|not)//"bzzt"' | head
bzzt
1
2
bzzt
4
5
bzzt
7
8
bzzt

On-line test (Passing -r through URL is not supported – check Raw Output yourself.)

beeswax, 148 bytes
beeswax was created after the challenge, but why shouldn’t I give the challenge a try anyway? ;)
Not golfed to death yet, but it satisfies both requirements:
 ;pK~gFP{?gp'           <      <
>F B~6-!P~2 .Pfz1~h#>@-"d~9P~:Fd
4 N     >@f>F9P~%~3Kd`bzzt`g?Pp
*0>F3~%'d`bzzt`@Pp
  dN             <            <

Output:
julia> beeswax("bzzt.bswx")
bzzt
1
2
bzzt
4
5
bzzt
7
8
bzzt
10
11
bzzt
bzzt
14
bzzt
16
...
29
bzzt
bzzt
bzzt
bzzt
bzzt
bzzt
bzzt
bzzt
bzzt
bzzt
40
41
...
296
bzzt
298
299
bzzt
bzzt
bzzt
bzzt
bzzt
bzzt
bzzt
bzzt
bzzt
...
bzzt
bzzt
bzzt
bzzt
400
401
bzzt
bzzt
404
...
494
bzzt
496
497
bzzt
499
500
Program finished!

You can clone my beeswax interpreter (written in Julia) from my GitHub repository.

Groovy, 46 45 bytes
{(0..500).collect{x->x%3<1||x=~/3/?'bzzt':x}}

This is an unnamed closure. Try it Online!

I never programmed in Groovy, but if I read it correctly you can save one by byte changing x%3==0 to x%3<1 (this trick can only be used if the result cannot be negative, which is the case in your 0 to 500 loop).

@KevinCruijssen Ah ha, thanks for that.

Japt, 21 bytes
501Ç%3«/3/tZ ?Z:"bzzt

Try it online!
Almost direct translation of nderscore's JS submission.
Unpacked & How it works
501oZ{Z%3&&!/3/tZ ?Z:"bzzt

501oZ{                      Map range(501) to a function...
      Z%3&&!/3/tZ             If Z is not a multiple of 3 and Z doesn't have digit 3
                  ?Z          Return Z
                    :"bzzt    Otherwise, return "bzzt"

20 bytes

Brachylog, 23 bytes (posted way after the end of the challenge)
500⟦{{f|}∋3∧"bzzt"|}ᵐẉᵐ

Try it online!
    {              }ᵐ      For every
500⟦                       number from 0 to 500,
            "bzzt"         the string "bzzt"
         ∋3∧               if 3 is an element of
     {f }                  the input's factors
       |                   or the input itself,
                  |        the input if neither condition is satisfied.
                     ẉᵐ    Write that all with one line per item.

Python 3, 56 bytes (Non-Competing)
for x in range(501):print([x,'bzzt']['3'[:x%3]in'%s'%x])

Try it online!
Shortest I could get it in Python 3. Can't yet comment on the existing Python 3 solution so posting as a separate answer.

Why is this marked non-competing?

APL (Dyalog Unicode), 30 bytes
{(0=3|⍵)∨'3'∊⍕⍵:'bzzt'⋄⍵}¨⍳500

Try it online!

05AB1E, 19 bytes
₄;END3ÖN3å~i.•è‰•},

Try it online!
₄;                   # push 500
  E                  # for N in [0, 1, 2, ..., 500]...
   ND3ÖN3å~          # push N and 1 if either 3 is in N or N is divisible by 3, else 0
           i         # if top of stack is truthy:
            .•è‰•}   # push "bzzt"
                  ,  # output top of stack to STDOUT

Vyxal 3 j, 14 bytes
500ƛ3∦cḊa["ġ/„

Try it Online!
-9 bytes thanks to @lyxal
-1 byte thanks to @Aaroneous Miller
Explanation (outdated):
500ɾ(nD3c$K3c∨["bzzt",|,
500ɾ                      ## push [1..500]
    (                     ## loop every number
     nD                   ## push the loop variable three times
       3c                 ## Contains 3?
         $   ∨            ## or
          K3c             ## it's divisible by 3?
              ["bzzt",    ## If so, print "bzzt"
                      |,  ## else print the loop variable

Created with the help of Luminespire.

Try it Online! for 15 bytes

Try it Online! for 14 bytes

@AaroneousMiller done

Javascript - 109 97
Compressed:
function b(m,c,z){for(i=1;i<=m;i++){if((i+'').indexOf(c)>-1||i%c==0){alert(z);continue}alert(i)}}

Replaced console.log with alert
Uncompressed:
function bzzt(max, contains, z) {
    for(i=1;i<=max;i++) {
        if((i+'').indexOf(contains)>-1||i%contains==0) {
            console.log(z);
            continue;
        }
        console.log(i); // console.log instead of alert for testing purposes
    }
}

max is the number to count to, contains is the number it contains and is divisible by, z is the message, so 'bzzt'

b(500, 3, 'bzzt');

You know this is about shortest right? The function only makes it longer, and console.log can be replaced with alert.

@Martijn Honestly didn't think about alert. And I thought I saw function in the rules.

@Martijn Also, no one would want to run it if it were alerts haha

Haha. You could add comment in the uncompressed //console instead of alert for testingpurposes so people'll get it :)

JavaScript, 65
OK, longer than others so far, but I've never tried this before and felt compelled to post...
a='';for(i=0;i-->-500;)a+=(i%3?i:-3);a.replace(/\d*3\d*/g,'bzzt')

Usage:
From a node repl paste the code. Output is by returned value
Output:
'-1-2-bzzt-4-5-bzzt-7-8-bzzt-10-11-bzzt-bzzt-14-bzzt-16-17-bzzt-19-20-bzzt-22-bzzt-bzzt-25-26-bzzt-28-29-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-40-41-bzzt-bzzt-44-bzzt-46-47-bzzt-49-50-bzzt-52-bzzt-bzzt-55-56-bzzt-58-59-bzzt-61-62-bzzt-64-65-bzzt-67-68-bzzt-70-71-bzzt-bzzt-74-bzzt-76-77-bzzt-79-80-bzzt-82-bzzt-bzzt-85-86-bzzt-88-89-bzzt-91-92-bzzt-94-95-bzzt-97-98-bzzt-100-101-bzzt-bzzt-104-bzzt-106-107-bzzt-109-110-bzzt-112-bzzt-bzzt-115-116-bzzt-118-119-bzzt-121-122-bzzt-124-125-bzzt-127-128-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-140-bzzt-142-bzzt-bzzt-145-146-bzzt-148-149-bzzt-151-152-bzzt-154-155-bzzt-157-158-bzzt-160-161-bzzt-bzzt-164-bzzt-166-167-bzzt-169-170-bzzt-172-bzzt-bzzt-175-176-bzzt-178-179-bzzt-181-182-bzzt-184-185-bzzt-187-188-bzzt-190-191-bzzt-bzzt-194-bzzt-196-197-bzzt-199-200-bzzt-202-bzzt-bzzt-205-206-bzzt-208-209-bzzt-211-212-bzzt-214-215-bzzt-217-218-bzzt-220-221-bzzt-bzzt-224-bzzt-226-227-bzzt-229-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-241-242-bzzt-244-245-bzzt-247-248-bzzt-250-251-bzzt-bzzt-254-bzzt-256-257-bzzt-259-260-bzzt-262-bzzt-bzzt-265-266-bzzt-268-269-bzzt-271-272-bzzt-274-275-bzzt-277-278-bzzt-280-281-bzzt-bzzt-284-bzzt-286-287-bzzt-289-290-bzzt-292-bzzt-bzzt-295-296-bzzt-298-299-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-400-401-bzzt-bzzt-404-bzzt-406-407-bzzt-409-410-bzzt-412-bzzt-bzzt-415-416-bzzt-418-419-bzzt-421-422-bzzt-424-425-bzzt-427-428-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-bzzt-440-bzzt-442-bzzt-bzzt-445-446-bzzt-448-449-bzzt-451-452-bzzt-454-455-bzzt-457-458-bzzt-460-461-bzzt-bzzt-464-bzzt-466-467-bzzt-469-470-bzzt-472-bzzt-bzzt-475-476-bzzt-478-479-bzzt-481-482-bzzt-484-485-bzzt-487-488-bzzt-490-491-bzzt-bzzt-494-bzzt-496-497-bzzt-499-500'

Python3, 62
for i in range(501):print('bzzt'if'3'in str(i) or i%3<1 else i)

VB.net (~100c)
1)
Function t()
For c=0 To 500:t+=If(CStr(c).Contains("3")Or(c Mod 3)=0,"Bzzt",c)+" ":Next
End Function
Function t()

2) I'd forgotten about Like operator in vb.
Function t()
For c = 0To 500:t &=If(CStr(c)Like"*3*"Or(c Mod 3)=0,"Bzzt",c)&" ":Next
End Function

The result is output as the return value of the function.

The numbers must be output, but it doesn't matter how (e.g., stdout, writing to a text file, etc.).

C 174
int i,j,k;char n[3];
int main(){
while(i++<501){k=0;sprintf(n,"%d",i);
for(j=0;j<3;j++){if(n[j]=='3'){k=1;break;}}
(i%3==0||k)?puts("Bzzt"):printf("%d\n",i);}
return 0;}

You can save a whole bunch of characters by not returning; not declaring the return type of main; setting k=0 to mean "there's a 3" and writing (i%3&&k):printf(...):puts(...) etc. By the way, you need a newline after "Bzzt".

@David puts put a newline by itself.

@edc65 Thanks. That being the case, we can save even more: declare n to have length 4 (necessary anyway to avoid a potential buffer overrun from the sprintf), make the other changes I suggested in my first comment and replace the fifth line of the source with puts((i%3&&k)?n:"Bzzt");}

I implemented my suggestions as a new answer. Also, it's much shorter to use strchr to test for the digit 3 in the string. (Another improvement to the for loop: the break is redundant, because it doesn't matter if the number has more than 3 in it and you set k=1 more than once.)

Scala – 62
for(x<-1 to 501)println(if(x%3<1||(x+""toSet 51))"Bzzt"else x)

toSet is a nice shorthand for contains.

Haskell - 73
b n|mod n 3<1||'3'`elem`show n="bzzt"|1<2=show n
main=print$map b[0..500]

Racket 80
(for/list([i 501])(if(or(=(modulo i 3)0)(memv #\3(string->list(~a i))))'bzzt i))

Pyth, 20
V501?N&%N3-`3`N"bzzt

Explanation:
V501            for N in range(501):
?               _ if _ else _
 N              print(N)
 &              _ and _
  %N3           N mod 3
  -`3`N         Assymetric difference of str(3) and str(N)
 "bzzt          "bzzt" (Final " is implicit)

Essentially, the test is the logical and of N%3, which is only 0, and thus interpreted as false iff N is divisible by 3, with
-`3`N

which is the empty list iff 3 is present in str(N). Setwise minus removes all appearances of characters in the second string from the first string.
If this and returns true, we print N, otherwise we print "bzzt". Having "bzzt" in the else clause saves a character, because there is no need to end-quote the string.

Clojure - 82 chars
Newbie solution: plain and simple. Golfed:
(dotimes[n 501](if(or(.contains(str n)"3")(= 0(mod n 3)))(println "bzzt")(prn n)))

Ungolfed:
(dotimes [n 501] (if (or (.contains (str n) "3") (= 0 (mod n 3)))
                  (println "bzzt")
                  (prn n)))

Note: This answer is invalid, because Pyth is too new a language.
Pyth, 20
V501?N&%N3-\3`N"bzzt

Explanation:
V501              for N in range(501):
    ?N                                print(N if
      &%N3                                       N % 3 and
      -\3`N                                      "3" - repr(N)
     "bzzt                                    else "bzzt")

Try it here.

Swift 2.0, 71
(0...500).map{print($0%3<1||"\($0)".utf8.contains(51) ?"bzzt":"\($0)")}

Swift 3, 62
(0...500).map{print($0%3<1||"\($0)".contains("3") ?"bzzt":$0)}
or
for n in 0...500{print(n%3<1||"\(n)".contains("3") ?"bzzt":n)}

Are all the spaces required? Or is Swift just weird with them?

I believe at least I eliminated all unnecessary ones.

authors: n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

authors: Дмитрий Михайлов


text:
Find the fastest swim relay (shortest path of unique nodes and types)
fastest relay time = lowest possible total integer value of
(a freestyle swimmers time) + (1 breastroke swimmers time) + (another backstroke swimmers time) + (another butterfly swimmers time)

Each swimmer must be unique to the relay (no duplicates)
Each stroke must be used once

Input Data: array of dictionaries, where each single dictionary represents a swimmer's swim times for each stroke. Each dictionary has the named properties of 'fly','back','breast','free':
Example Input:
[
{'Fly': 10, 'Breast': 48.26, 'Free': 28.43, 'Back': 34},
{'Fly': 47.51, 'Breast': 24, 'Free': 28.47, 'Back': 10},
{'Fly': 26, 'Breast': 46.44, 'Free': 10, 'Back': 30},
{'Fly': 37.81, 'Breast': 10, 'Free': 24, 'Back': 49},
{'Fly': 38.31, 'Breast': 29, 'Free': 20, 'Back': 10}
]

Example Output:
40

(this is an easy case where the best relay is simply the fastest person in each stroke; other times you might need to have the 3rd fastest breastroker swim breastroke in order to get the lowest overall time!)
Example Measurement of a relay using the first 4 swimmers in the data set above:
swimmer 1 swims fly and his time is 10
total += 10
swimmer 2 swims back and his time is 10
total += 10
swimmer 3 swims fly and his time is 10
total += 10
swimmer 4 swims breast and his time is 10
best relay total for these 4 people = 40

Output Data: should be a single float or integer value representing the total time of the best relay. (a legal relay includes a fly swimmer, a back swimmer, a breast swimmer, and a free swimmer, each leg of the relay swam by a unique swimmer)
EDIT: brute force vs dynamic parameter removed.

Could you please provide more information? For example, input format and some test cases.

How do you measure "fastest"?

The problem statement reads like it requires a brute force solution in order to find an optimal combination - although I do not have a ready proof.

@justhalf lowest total time

@StrikePricer: Yes, my question is exactly "How do you measure which one has the lowest total time?" Is it run on your computer? On some online compiler? On what kind of input? How big is the biggest input?

its a function in a python script i run on my terminal to score a swim meet. this function is run with about 30 swimmers for a single call. this function takes an array of swimmer objects and returns an integer representing the lowest time relay that could be formed

@Howard if no dynamic method is logically possible, then I apologize. :/ . I just assumed there had to be a better way than brute force (I guess I was wrong!). if one were to cull away most of the swimmers except the 4 best ones per each stroke, ___^4 would only be _____, which i guess would be more time acceptable for brute force...

@StrikePricer You can cut all swimmers which have 5th or worse time in all strokes. Unfortunately there is the case of ties and thus the "4" best ones can be more than 4 swimmers.

Python 2.7 or 3?

Meh, I'm no Python programmer by any stretch of the imagination. Hell, some would even hesitate to call me a programmer. But as nobody else has answerred this, why not post my solution? If anything else, it was fun just to brush up on the very Python basics:
swimmers = [{'Fly': 10, 'Breast': 48.26, 'Free': 28.43, 'Back': 34},
{'Fly': 47.51, 'Breast': 24, 'Free': 28.47, 'Back': 10},
{'Fly': 26, 'Breast': 46.44, 'Free': 10, 'Back': 30},
{'Fly': 37.81, 'Breast': 10, 'Free': 24, 'Back': 49},
{'Fly': 38.31, 'Breast': 29, 'Free': 20, 'Back': 10}]

bestTime = float('inf')

for fly in range(len(swimmers)):
    for breast in range(len(swimmers)):
        for free in range(len(swimmers)):
            for back in range(len(swimmers)):
                if len(set([fly,breast,free,back])) > 3:
                    current = swimmers[fly]['Fly'] + swimmers[breast]['Breast'] + swimmers[free]['Free'] + swimmers[back]['Back']
                    if current < bestTime:
                        bestTime = current

print bestTime

does this line: if len(set([fly,breast,free,back])) > 3: help you check for uniqueness? your solution is almost exactly what I did, except I used a function to check a "relay" array for uniqueness (ie each swimmers being unique): `def unique_values(g):
s = set()
for x in g:
if x in s: return False
s.add(x)
return True'

Yeah, a set has no duplicate values, so the length of a set created from a list L, gives us the number of unique elements in L. It was the first idea I had, but I guess it can be done in a great deal of ways. But I have no hopes of my solution being faster than other brute force attempts. I sort of gave up on improving asymptotical performance and just went for legibility.

it takes a little more code, but one way I found to speed it up was to create a fly list, a back list, a breast list, and a free list and then sorting each stroke to only the fastest 5. I guess it would cut way down on the amount of brute forcing needed. You still then loop 4 times as you've done here.

source: Stack Exchange

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

sort: votes


text:
Hide your hash function
So you are tasked with creating an open source password authentication system but you want to reveal as little about the implementation of the hash function as possible. Can you write a function that takes in a password string and a salt string and outputs a salted hash string without revealing the hashing function?
End date: 6th of July
Popularity contest: So whoever is voted as hardest to figure out the hashing method.
Restriction: Must use an accepted as secure hashing function

What do you mean "without revealing the salt"? So you mean that the salt should be static and hard-coded, or that it should be dynamic - in which case you'd get a different response every time you called the function

This question makes no sense. The salt should be an input.

@PeterTaylor Didn't think about that correctly. Yeah the salt string is an input

"without revealing" is this a [tag:obfuscation] (make code as unreadable as possible) or [tag:underhanded] (make code look as if it does something else)?

@professorfish obfuscation (for security)... I thought this would be an interesting question. I am new to golfing

@inquisitiveIdiot Security through obscurity? I'm sure that'll work out just great...

@ɐɔıʇǝɥʇuʎs if you're gonna open source an authentication then your security is limited either way

Because the salt is an input, it is not hidden. I suggest to delete the requirements about hiding the salt. Delete "either the salt or". Then in "figure out the hashing method and salt", delete "and salt".

@kernigh fair point

@inquisitiveIdiot I disagree on your open source standpoint; making something like RSA public only makes it more secure as the public can scrutinize it

None of the functions mentioned in answers so far are secure password hashing functions. Secure password hashing functions must be slow.

The assertions that “if you're gonna open source an authentication then your security is limited either way” and “obfuscation (for security)” are utterly ludicrous. All you'd be hiding is your incompetence, and it's easily revealed (and so are your users' passwords).

Python 3
Uninspired solution - hide your hash function with hash-looking code
import base64

a = b'66726F6D20686173686C696220696D706F72742A3B7072696E74287368613235'
b = b'3628627974657328696E70757428292B696E70757428292C277574662D382729'
c = b'292E686578646967657374282929232048656C6C6F2074686572652021402324'

exec(base64.b16decode(a+b+c))

That's not a hash function - that's just base 16.

@sdamashek it must be hidden too well... that's actually sha256.

@primo oops, I didn't actually check the decoded result. :P

SHA-256 is a secure hash function, but not a secure password hash function.

Ruby
Need a way to obfuscate your choice of hashing function? Why not use a hashing function?
require 'digest'

three_card_monte = %w[SHA1 MD5 RMD160]

part1, part2 = three_card_monte.repeated_permutation(2).find{|x,y|Digest(x).base64digest(y)[/tada!?/i]}

part2.send( ('mode'..$&).find{|x|Digest(part1).base64digest(x)[/\d\dSXQ/]}<<$&.to_i.chr)

puts Digest(part2).base64digest(gets+gets)

None of SHA-1, MD5 or MD-160 are secure password hash functions.

Python
This one is not a hashing function, takes no salt, and is completely insecure, but can you tell what it is?
def f(x):
    a,b=ord(x),ord(x)+13
    if not (97<=a<=122 or 65<=a<=90):return x
    if (65<=a<=90 and b>90) or b>122: b-=26
    return chr(b)
print(''.join(f(i) for i in input()))

 It's rot13

Here is an actual hashing function.
import hashlib
salt = b'cHJpbnQoaGFzaGxpYi5zaGEyNTYoYnl0ZXMoaW5wdXQoKStpbnB1dCgpLCd1dGYtOCcpKS5oZXhkaWdlc3QoKSkKZXhpdCgp';import base64;exec(base64.b64decode(salt))
print(hashlib.md5(bytes(input(), 'utf-8') + salt).hexdigest())

Note that it is not md5 and it does not use a hard coded salt. Based on qwr's solution.

SHA-256 is a secure hash function, but not a secure password hash function.

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


text:
9 Digit Problem
Write a program to find a number consisting of 9 digits in which each of the digits from 1 to 9 appears only once. This number must also satisfy these divisibility requirements:

The number should be divisible by 9.
If the rightmost digit is
removed, the remaining number should be divisible by 8.
If the
rightmost digit of the new number is removed, the remaining number
should be divisible by 7.
And so on, until there’s only one digit
(which will necessarily be divisible by 1).

Credit Dávid Németh

The first rule seems unnecessary. Any number that consists of digits 1-9 once each will always be divisible by 9.

What's the code-aspect here? This sounds like it could be posted on Puzzling

This would be way better as a code-golf

Even if we’re going to call it a “standard loophole”, code golf challenges that produce a fixed output generally shorter than any code that could build it are usually not particularly interesting.

The problem I have with challenges like this is that the border between hardcoding and applying mathematical properties is vague. For example, the divisibility rule for 5 is that the number has to end in 0 or 5. Is restricting the choices for that digit to 0 and 5 hardcoding part of the output? It'd get even worse if we were dealing with 10-digit numbers.

@user2357112 Not to mention, a bunch of mathematical operations on constants can very well get optimized out in compilers. Meaning the only difference between hard-coded and not hard-coded is optimization. So what level of optimization is allowed? I had this problem when I was writing code to convince someone of the monty hall problem. I wrote out the logic rigorously, then started optimizing redundancies. The logic ended up with literally just checking if rand(1, 3)==1

@Cruncher Since the program doesn't take input the whole thing might just be constant folded to a print statement, but that is obviously not allowed to do.

@Sylwester The question is essentially: "print 381654729 without printing it directly". So is "print 381654728+1" allowed? How much math must be involved before you can say you calculated it, vs. hard coding it. Hard coding the math for a constant is STILL hard coding it. Meaning that this question is literally unanswerable.

@Cruncher 381654728+1 is not finding the value that correspond to the requirements, but I guess a solution can start off with 381654728 and apply the tests 0..4 (0 being all digits are unique) and then you'll find it after 2 iterations instead of 381654729 at a cost of 8 extra points.

@Sylwester What you've done is assume there's only 1 way to solve the problem, because you're afraid of breaking the loophole. "Loop through numbers checking requirements". This completely excludes any interesting examples. And the question is: "Which language can check these things and loop in the fewest characters".

@Cruncher It's like finding digits of pi. Yes, you can make a program that prints a constant but that isn't calculation is it? This is a trivial question compared to finding digits of pi but I think OP thought the number was going to be found by a golfed program and not 381654728+1 since that would only work if you knew the answer was 381654729.

@Sylwester Like-wise I find the pi-finding questions to be bad as well.

@Sylwester If the question asked to input the number of digits, and then apply the same logic that this question asks to print the number that satisfies it (or impossible if that's the case) that would be more interesting. Questions that cannot be hardcoded are much better than ones that have to restrict you from it.

@Cruncher I agree. Questions that require input makes the challenge better.

CJam - 26
1{;9,:)_mrs0@{_3$<i\%+}/}g

It's randomized but works pretty fast with the java interpreter. It can take a couple of minutes with the online interpreter.
Explanation:
1 pushes 1 (to be explained later)
{…}g is a do-while loop
; removes a value from the stack (initially the 1 we started with)
9, makes the array [0 ... 8]
:) increments the array elements, resulting in [1 ... 9]
_ duplicates the array
mr shuffles the array
s converts to string
0@ pushes 0 then brings the other copy of the array on top
{…}/ is a for-each loop (over the numbers 1 ... 9)
_ duplicates the current number (let's call it "k")
3$ copies the numeric string from the stack
<i gets the substring with the first k characters then converts to integer
\% swaps with the other copy of k then gets the remainder (%k)
+ adds the remainder to the previous value on the stack (initially 0 from above)
At this point, we have the numeric string on the stack, followed by a 0 if the number matches all the requirements (i.e. all the remainders were 0) or a non-0 value otherwise.
The top of the stack becomes the do-while loop condition. It is popped and the loop continues if the condition was true.
If we found the solution, the condition is 0 (false), the loop ends and the rest of the stack (the numeric string) is printed.
If it's not the solution, the condition is the non-0 value (true) and the loop continues with the string on the stack. The string gets popped at the start of the next iteration (so the loop expects a value on the stack, and that's the reason for the initial 1).
Thanks Dennis for making the code shorter and more convoluted :p

Nice! You can save one more byte by using a dummy value: 0{;9,:)_mrsT@{_3$<i\%+}/}g

Javascript (E6) 105 125 134
Recursive building of the number, each step check the divisibility.
Runtime near 0 sec
No I/O this time, as the OP asked for a program to find the number, and the number is found and automatically logged to console
Golfed more Courtesy of MT0
(Q=(n,d,b)=>([(m=n+(s=[...b]).splice(i,1))%d||Q(m,d+1,s)for(i in b)],d>9&&(Q.z=n),Q.z))('',1,'123456789')

Golfed
(Q=(n='',d=1,b=[...'123456789'],i)=>{
for(i=0;s=[...b],m=n+s.splice(i,1),b[i];i++)m%d||Q(m,d+1,s);d>9&&(Q.z=n);return Q.z;
})()

Ugly
(Q=(n='', d=1, b=[...'123456789'], i) => {
   for(i=0; s=[...b], m=n+s.splice(i,1), b[i]; i++)
     m % d || Q(m,d+1,s);
   d > 9 && (Q.z=n);
   return Q.z;
})()

Bonus
With 3 little changes, you can use the same function to find longer numbers using base > 10. For instance in base 14 ...
(Q=(n='',d=1,b=[...'123456789ABCD'],i)=>{
  for(i=0; s=[...b], m = n+s.splice(i,1), b[i]; i++)
    parseInt(m,14)%d || Q(m,d+1,s);
  d>13 && (Q.z=n);
  return Q.z;
})()

9C3A5476B812D

Ungolfed
Q=(n,d,b,i,c,z)=>{ // i,c,z fake parameters instead of vars.
  for (i=0; b[i]; i++)
  {
    s=[...b];
    m = n + s.splice(i,1);
    if (m % d == 0)
      if (z = d<9 ? Q(m, d+1, s) : m) return z;
  }
}
Q('',1,[...'123456789'])

105 Characters: (Q=(n,d,b)=>([(m=n+(s=[...b]).splice(i,1))%d||Q(m,d+1,s)for(i in b)],d>9&&(Q.z=n),Q.z))('',1,'123456789')

101 Characters: (Q=(n,d,b)=>Math.max(...[(m=n+(s=[...b]).splice(i,1))%d||Q(m,d+1,s)for(i in b)],n))('',1,'123456789')

@MT0 wow! Array comprehension strikes back. I'll take the 1st one, becouse the other one can find a wrong number if there is not one correct (IE counting up to 7 instead of 9).

Python3, 214, 199, 184, 176, 174, 171, 165, 150, 146
from itertools import*
g=lambda i,d:d==1!=print(i)or int(i[9:])%d==0!=g(i[:-1],d-1)
for x in permutations("123456789"):g("".join(map(str,x))*2,9)

output:
381654729

This is my first golf script. Hope you like it :)

Perl, 56
Usage: perl -E '...'
{$s++;redo if grep{$s!~$_||substr($s,0,$_)%$_}1..9}say$s

Output: 381654729
This program is really slow.  As in more than 3.5 hours.
As a more fun exercise, I decided to develop an extremely fast algorithm:
my $set = [1..9];
for my $divisor (2..9) {
    my $newset = [];
    for my $element (@$set) {
        my $num = $element * 10;
        for (my $digit = $divisor - ($num % $divisor); $digit < 10; $digit += $divisor) {
            if (index($element, $digit) == -1) {
                push @$newset, $num + $digit;
            }
        }
    }
    $set = $newset;
}

print "@$set\n";

The above runs in .00095 seconds, and confirms that there is only one solution to this problem.

Ruby, 66 78 chars
[*r=1..9].permutation{|i|r.all?{|x|eval(i[0,x]*"")%x<1}&&$><<i*""}

Runtime is ~8 seconds (output printed after 3 s).
This doesn't stop after finding the first number, so technically it prints all numbers that fulfill the criteria - but since there's only one such number, it doesn't make a difference.
Ruby 1.8, 63
[*r=1..9].permutation{|i|r.all?{|x|eval(i[0,x]*"")%x<1}&&$><<i}

Essentially the same solution as above. In Ruby 1.8, arrays are converted to strings by implicitly calling Array#join on them, so we can save the call to that. Interestingly, the code also runs much faster in Ruby 1.8 than 2.0 (4.5 seconds total runtime, output printed after 1.6 s).

Pyth, 33 characters
=Y]kFkY~Yf>ql{TlT%vTlTm+k`dr1T)pk

To test it, put the above code as standard input in the link in the title.
After compiling into Python 3.4:
k=''
T=10
Y=[k]
for k in Y:
 Y+=list(filter(lambda T:(len(set(T))==len(T))>(eval(T)%len(T)),
                map(lambda d:k+repr(d),range(1,T))))
print(k)

Explanation:
=Y]k:Y=['']
FkY: for k in F:
~Y: Add to Y
f: Filter by
>ql{TlT: All unique elements and
%vTlT: eval(element)%len(element)=0
m+k` d
On the list of k + repr(d)
r1T: for d from 1 to 9.
): End for loop
pk: print k

Haskell 129 121
Here is my amateurish Haskell attempt (suggestions/improvements would be greatly appreciated). It might not be the shortest, but it does execute in only .19 .65 seconds after Flonk's changes on my system.
import Data.List;f=foldl1$(+).(*10);main=print$[f x|x<-permutations[1..9],f[mod(read.take y.show$f x)y|y<-[9,8..1]]<1]!!0

Welcome to PPCG.SE! Try adding <!-- language: lang-haskell --> two lines before your code for syntax highlighting!

And I did indeed find a way to save 8 more characters! Instead of checking if each remainder==0, you could sum over all of them and check if that==0, which is just as long. By seperating out the foldl1 into a function however, you can use that instead of sum or any. import Data.List;f=foldl1$(+).(*10);main=print$[f x|x<-permutations[1..9],f[mod(read.take y.show$f x)y|y<-[9,8..1]]<1]!!0

It seems that you counted your characters including the trailing newline: there are only 128 characters in your code.

@Flonk I absolutely love the use of the f function on the mod predicate to avoid writing foldl1, although the extra cycles do hamper performance severely.

@DrJPepper 0.65 seconds? Meh. Lets make that worse!
You can also replace !!0 with a call to f, which works out since there's only one item in the list. The list [9,8..1] can also be replaced by x, because the order doesn't matter. Talk about code reuse!

GolfScript (35 chars)
1,{{10*){.)}8*}%{`..&=},{.`,%!},}9*

Online demo
This builds prefixes which satisfy the condition.
# Initial prefixes: [0]
1,
# Loop 9 times
{
    # Extend each prefix by digits 1 to 9
    {10*){.)}8*}%
    # Filter out ones which repeat a digit
    {`..&=},
    # Filter down to ones which are divisible by their length
    {.`,%!},
}9*

Python, 142, 139, 125, 124
Essentially same as @Ventero's solution if I understood his code correctly, but in Python.(Much of the credit goes to @Greg Hewgill.)
from itertools import*;print[s for s in map(''.join,permutations('123456789'))if all(t(s[:i])%i==0 for i in range(1,9))][0]

You should be able to replace r(9,1,-1) with r(9), as the order of iteration doesn't really matter.

You'd have to use r(1,9) because %0 is an error.

@GregHewgill Ah, of course you're right, didn't realize it starts with 0. Guess it's obvious I'm not a Python expert. :)

@Ventero Thanks for the tip, Greg is right I'll have to use r(1, 9) in Python.

Golfing tips: Use from itertools import*; avoid t=int when you only use int once; consider using a list comprehension to replace the for loop

Using permutations("123456789") and ''.join(s[:i]) is probably shorter than what you have (and then you can eliminate r=range)

@GregHewgill I was using int twice in a different version(not posted here), totally forgot to remove it here. Thanks for the tips, update coming soon.

@GregHewgill Solution updated.

@200OK Using int twice (intint) is still shorter than t=int and using t twice (t=int;tt)

Javascript 75 (terminating)
Bruteforce solution (super slow)
for(a=c=1;b=c&&++a;)for(c=9;~(a+'').search(c)&&b%c<1;)--c?b=b/10|0:alert(a)

If you want to see the result in this lifetime, update the initial value to something like a=c=38e7
Javascript 70 (non-terminating)
for(a=1;b=++a;)for(c=9;~(a+'').search(c)&&b%c<1;)--c?b=b/10|0:alert(a)

And just for fun, a random bruteforce that runs much faster: (ES6 only)
for(a=i=[..."123456789"];b=c=i&&a.sort(x=>Math.random()*9-5|0).join('');)for(i=9;c%i<1;)--i?c=c/10|0:alert(b)

Perl, 72
Usage: perl -M5.010 find-9-digits.pl
{$s=join'',sort{4-rand 8}1..9;redo if grep{substr($s,0,$_)%$_}2..9}say$s

Output: 381654729
This program is slow. It might take more than 10 seconds, because it shuffles the digits "123456789", but the shuffle has a flaw.
Ungolfed:
# Enter a block.
{
     # Shuffle the characters "123456789".
     $s = join('', sort({2 - rand(4)} 1..9));

     # Redo block if any divisiblity test fails; grep returns the
     # number of failing tests.
     redo if grep({
        # For each divisor $_ in 2..9, test if the first $_ digits of
        # of $s are divisible by $_.  The test fails if the remainder
        # is a true value (not zero).
        substr($s, 0, $_) % $_
     } 2..9);
}
say $s;

I golfed the code that shuffles the array of digits 1..9:

use List'Util shuffle;shuffle 1..9 (34 characters)
sort{(-1,1)[rand 2]}1..9 (24 characters)
sort{.5<=>rand}1..9 (19 characters)
sort(2-rand 4}1..9 (18 characters)
sort{4-rand 8}1..9 (18 characters)

Perl expects the sort block to compare $a and $b in a consistent way. My sort blocks never look at $a and $b. They return a random ordering so the sort becomes a shuffle.
If I would use sort{.5<=>rand}1..9, my program would run faster. That one compares 0.5 with a random float from 0.0 to 1.0, excluding 1.0, for a 1/2 chance that $a < $b, and an almost 1/2 chance that $a > $b. (Beware: This is a "Microsoft shuffle", which is not a fair shuffle. This has bias because .5<=>rand does not provide a consistent ordering.)
Suppose that I golf away one character and use the much worse sort(2-rand 4}1..9. Perl expects the sort block to return an integer, but 2-rand 4 is a float. It is a random float from -2.0 to 2.0, excluding -2.0. Perl truncates this float toward zero, with these results:

1/4 chance that $a < $b, integer -1 from -2.0 < float <= -1.0
near 1/2 chance that $a == $b, integer 0 from -1.0 < float < 1.0
near 1/4 chance that $a > $b, integer 1 or 2 from 1.0 <= float <= 2.0

When $a == $b, Perl does not shuffle well. So, my program would do more shuffles, until it gets enough shuffles where 2-rand 4 did not return 0 too often. My program would run so slow, it might take more than one minute.
I use sort{4-rand 8}1..9, so there is only a 1/4 chance that $a == $b, and my program uses fewer shuffles.

Nice hand-rolled shuffle

Python 2 (78)
x=1
while len(set(`10*x`))<=9+sum(x/10**i%(9-i)for i in range(9)):x+=1
print x

No need to generate permutations, just try each number and check if its digits plus 0 are distinct. Takes a while to run.

Scala (128 chars)
My stab at this...
Seq(1,2,3,4,5,6,7,8,9).permutations.filter(p=>(2 to 8)forall{n=>(p.take(n).mkString.toLong%n==0)}).map(_.mkString.toLong).toList

You can save a character by removing the space between (2 to 8) and forall.

@ProgramFOX I had no idea. I've always thought a dot or a space was required there. Thanks, I've edited down to 128 chars.

Jelly, 13 11 bytes
9Œ!JḍḌƤPƲƇḌ

Try it online!
How it works
9Œ!JḍḌƤPƲƇḌ - Main link. No arguments
9           - Yield 9
 Œ!         - Yield all permutations of [1, 2, ..., 9]
        ƲƇ  - Keep those for which the following is true:
      Ƥ     -   Over each prefix:
     Ḍ      -     Convert into an integer
   J        -   Yield [1, 2, ..., 9]
    ḍ       -   Pair each [1, 2, ..., 9] with the prefixes,
                then return 1 if they divide each other else 0
       P    -   All return 1
          Ḍ - Convert back to an integer

Of course, there's the obvious 9 byter:
381654729

Try it online!

CJam, 35 bytes
0{)_`$A,1>s=!1$9,{9\m1$\%@+\A/}/;}g

After roughly 27 minutes, this produces the following output:
381654729

How it works
0         " Push 0 (“n”).                                                      ";
{         "                                                                    ";
  )_`$    " Increment “N”, duplicate, stringify and sort the resulting string. ";
  A,1>s   " Push '123456789'.                                                  ";
  =!      " Push 0 if the strings are equal and 1 otherwise (“a”).             ";
  1$      " Copy “n”.                                                          ";
  9,{     " For each i in [ 0 1 2 3 4 5 6 7 8 ].                               ";
    9\m   " Calculate “9 - i”.                                                 ";
    1$\%  " Calculate “n % (9 - i)”.                                           ";
    @+    " Add the result to “a”.                                             ";
    \A/   " Swap “a” with “n” and calculate “n / 10”.                          ";
  }/      "                                                                    ";
  ;       " Discard “n”.                                                       ";
}g        " If “a > 0”, repeat the loop.                                       ";

Impressive size, but it seems even slower than mine, and I suspect it's not correct

I don't fully understand it, but it seems to accept 0 as a digit? Also, when does it stop?

SWI-Prolog 84
g([],O,_,O).
g(L,N,I,O):-nth1(_,L,D,R),M is N*10+D,J is I+1,0 is M mod J,g(R,M,J,O).

It is a bit cheating, because the list of digits needs to be supplied in the query:
?- g([1,2,3,4,5,6,7,8,9],0,0,O).
O = 381654729 ;
false.

However, it is what makes this code interesting: you can solve the problem for any list of digits. For example:
?- g([1,2,3,4,5,6,7,8,9,0],0,0,O).
O = 3816547290 ;
false.

?- g([1,2,3,4,5,6,7,8],0,0,O).
O = 38165472 ;
false.

?- g([1,2,3,4,5,6,7],0,0,O).
false.

?- g([1,2,3,4,5,6],0,0,O).
O = 123654 ;
O = 321654 ;
false.

?- g([2,2,3,3,5,6,7,8,9],0,0,O).
O = 363258729 ;
O = 363258729 ;
O = 363258729 ;
O = 363258729 ;
O = 723258963 ;
O = 723258963 ;
O = 723258963 ;
O = 723258963 ;
false.

Python 2 – 114
Not even the shortest Python solution, but I am sharing it anyway:
e=""
f=lambda s,n:[[n,e.join(f(s.replace(j,e),n+j)for j in s)][s>e],e][n>e>0<int(n)%len(n)]
print f("123456789",e)

Bash+coreutils, 159 bytes
l=`echo {1..8}`
for d in {2..8};{
l=$(printf "a=%s;if(!a%%$d)a\n" $(eval echo {${l// /,}}{1..8}|tr \  '
'|grep -Pv '(\d).*\1')|bc|paste -d\  -s -)
}
echo ${l}9

This is kind of long, but I think the algorithm is perhaps one of the fastest, considering this is a (usually slow) shell script that runs in less than 0.1 second.
The algorithm goes something like this:

Start with the leftmost digit (1-8)
append the next digit to the right (1-8)
remove any numbers with repeated digits (grep)
check for divisibility by $d (the digit number) using bc, with an expression generated by printf
Repeat the above until an 8 digit number is obtained

Note we take a couple of shortcuts, but I think these are mathematically sound:

The leftmost digit must be divisible by 1, which is all digits, so we don't explicitly check for the first set of leftmost digits
The rightmost digit must be 9 (actually I'm not sure if this is a valid assumption - I'll have to think about it a bit)

C++, 187
I just had to try this in C++. Obviously, it's not going to be the shortest solution but here it is:
#include <algorithm>
using namespace std;bool c(int n,int d=9){return d<2||n%d==0&c(n/10,d-1);}int main(){for(char n[]="123456789";next_permutation(n,n+9);)if(c(atoi(n)))return atoi(n);}

returns the number instead of printing it to save some characters (damn include). Under POSIX-systems this will of course be converted to an 8-bit unsigned and thus not correct - but the program will calculate a correct number.
Ungolfed (requires C++11):
#include <iostream>
#include <algorithm>
using namespace std;

bool check(int n, int digit = 9)
{
  return (n % digit==0) && (digit == 1 || check(n/10,digit-1));
}

int main()
{
  string num {"123456789"};
  while (next_permutation(begin(num), end(num)))
    if (check(stoi(num))){
      cout << num << endl;
      break;
    }
}

T-SQL 2005+ - 203
T-sql is not a very competitive golf language...
with A(n)as(select top 10 number from spt_values where'p'=type),R as(select \r,1l union all select r*10+n,l+1from R,A where n not in(select substring(str(r),n,1)from A)and(r*10+n)%l=0)select max(r)FROM R

Must be run on the master database. You can replace the first CTE with this to make it database agnostic but then it uses a few more characters (and requires 2008)
with A as(select*from(VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9))f(n))

Readable formation:
 with A(n)as(select top 10 number from spt_values where'p'=type),
    R as(select \ r,1 l
        union all
        select r*10+n,l+1
        from R,A
        where n not in (
            select substring(str(r),n,1)
            from A
        )
        and(r*10+n)%l=0)
select max(r) FROM R

Basically we keep adding digits to the back of the r number that we haven't seen in the string yet, and making sure that the new string is still modulo 0 of the current level. We initialize R to \, This is really the only trick in this code. Which is a crazy way to set it to 0 in money datatype. It's I'm guessing a way to let you type \ instead of currency.  $ also does the same thing in T-SQL, but $l would try to interpret a pseudo column that doesn't exist and throw an error. This lets us avoid the worry about using int which would cause an overflow normally at the 10th concatenation, forcing us to actually check the level.
Edit:
Fun fact T-sql even in 2014 doesn't have a built in way to turn a string into a table of values (e.g. no split func), so we actually also get to reuse our A table twice to iterate the characters in the stringified R.
T-Sql precedence rules are annoying so we have to use numeric concatenation (*10+n), rather than string concat.

You can save 5 bytes and allow it to run on all kinds of databases by replacing the first row with:
with A as(select 1n union all select n+1 from A where n<9),

Good point. In real code, I would never use a rCTE to count so it didn't even dawn on me to try it!

PHP, 89 bytes
random version, 89 bytes:
for($n=123456789;$n=str_shuffle($n);$d||die("$n"))for($d=10;--$d&&substr($n,0,$d)%$d<1;);

shuffles a string containing the digits, then tests divisibility in a loop.
Run with -nr.

brute force loop, 90 bytes, very slow:
for(;++$i<1e9;$d||die("$i"))for($d=10;--$d&&max(count_chars($i))<2&substr($i,0,$d)%$d<1;);

loops from 100000001, tests divisibility in inner loop, and exits when it finds a solution.

recursive function, 94 bytes, very fast:
function f($n="",$e=1){while($d++<9)strpos(_.$n,"$d")|($x=$n.$d)%$e||print$e>8?$x:f($x,$e+1);}

appends one digit that´s not yet in the number, if divisibility by length is given, recurse (or print).
This exploits that there is only one solution. without that, print$e>8?$x:f($x,$e+1) had to be print$e>8?"$x\n":f($x,$e+1) (+3 bytes, print all solutions) or ($e>8?die("$x"):f($x,$e+1)) (+4 bytes, exit at first solution) or the solutions would be printed without a delimiter.
Call with f();
--
TiO
The brute force version has no TiO for obvious reasons,
but you can try the other two.
The function call´s runtime is measured inline (somewhere between 2 and 4 milliseconds);
total runtime is measured by the website (usually between 50 and 500 ms).

05AB1E, 9 bytes
9LœJʒηāÖP

Try it online!
The same as my answer on the newer challenge, but with fixed input of 9. Hardcoding is shorter:
•N4₃s

Try it online!

Husk, 15 bytes
dḟöΛIz¦ḣ9mdḣPḣ9

Try it online!

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