Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Timeline for 1, 2, Fizz, 4, Buzz

Current License: CC BY-SA 4.0

14 events
when toggle format what by license comment
May 1, 2024 at 11:33 comment added JohnLBevan A few people now (9 years later) have a 42 byte solution (github.com/vpcf/fizzbuzz_in_42bytes/blob/master/… / code.golf/fizz-buzz#powershell): 1..100|%{"$_``r"+{fizz}[$_%3]+{buzz}[$_%5]}
Oct 16, 2022 at 21:50 history edited AdmBorkBork CC BY-SA 4.0
-1 byte thanks to Twitter dude; Minus another two thanks to a further golf
Apr 13, 2017 at 12:39 history edited Community Bot
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Sep 26, 2015 at 0:34 comment added AdmBorkBork @TessellatingHeckler PowerShell is nothing if not flexible.
S Sep 26, 2015 at 0:32 history suggested TessellatingHeckler CC BY-SA 3.0
Another 54 byte alternative
Sep 25, 2015 at 22:27 review Suggested edits
S Sep 26, 2015 at 0:32
Sep 25, 2015 at 12:49 history edited AdmBorkBork CC BY-SA 3.0
Saved 7 bytes by swapping the if-else block for instead indexing into a collection
Sep 25, 2015 at 8:01 comment added Danko Durbić ... so you get 1..100|%{(($t="Fizz"*!($_%3)+"Buzz"*!($_%5)),$_)[!$t]} which is also 54 like @TessellatingHeckler's suggestion
Sep 25, 2015 at 7:03 comment added Danko Durbić You can replace if($t){$t}else{$_} with something like ($t,$_)[!$t]
Sep 25, 2015 at 6:18 comment added TessellatingHeckler How about 1..100|%{'Fizz'*!($_%3)+'Buzz'*!($_%5)-replace'^$',$_} for 54?
Sep 24, 2015 at 20:51 comment added AdmBorkBork As an aside, if PowerShell ever implemented the || operator, like in C#, we could likely get down to 43 bytes with something similar to 1..100|%{"Fizz"*!($_%3)+"Buzz"*!($_%5)||$_} ... doubtful, since the | is such an important special operator in PowerShell, but I can dream ...
Sep 24, 2015 at 20:35 history edited AdmBorkBork CC BY-SA 3.0
Shaved another 7 bytes by removing the string-of-code-blocks
Sep 24, 2015 at 20:14 history edited AdmBorkBork CC BY-SA 3.0
Saved 10 bytes thanks to feersum
Sep 24, 2015 at 19:44 history answered AdmBorkBork CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /