Fizzbuzz in Complex Plane

Kaoru Maeda
Kaoru MaedaSoftware Engineer in Test at DeNA Co., Ltd.
FizzBuzz in Complex Plane
Kaoru Maeda
@mad_p
Feb. 2013
FizzBuzz Code Golf in Ruby (Tokyo Ruby Kaigi 10*)
My answer (77 chars):
puts eval($*.join'..').map{|n|%W[FizzBuzz Buzz #{n} Fizz][((n%3).i-n%5).arg]}

Im

Select Fizz, Buzz, FizzBuzz, or Number by

êarg((nmod3)i - (nmod 5))ú
ë
û
14

8

2

Buzz
11

5

nmod3
4

13

7

1

10

Fizz

1,2,3 radians
9

3

12

-nmod5
* http://codeiq.hatenablog.com/entry/2013/01/16/002033

6

0

Re

FizzBuzz
(Luckily, 0.arg == 0 in Ruby)
1 of 2

Recommended

How To Build A Telegram Bot Using NodeJS, Express and MongoDB by
How To Build A Telegram Bot Using NodeJS, Express and MongoDBHow To Build A Telegram Bot Using NodeJS, Express and MongoDB
How To Build A Telegram Bot Using NodeJS, Express and MongoDBLouis Nel
1.3K views17 slides
Intel IoT webinar #1 - Tedison presentation by
Intel IoT webinar  #1 - Tedison presentation Intel IoT webinar  #1 - Tedison presentation
Intel IoT webinar #1 - Tedison presentation BeMyApp
823 views12 slides
Cli by
CliCli
CliKoetlisi Theko
11 views1 slide
Clojure + MongoDB on Heroku by
Clojure + MongoDB on HerokuClojure + MongoDB on Heroku
Clojure + MongoDB on HerokuNaoyuki Kakuda
1.8K views49 slides
関西Vim勉強会#5 vimrcの書き方 by
関西Vim勉強会#5 vimrcの書き方関西Vim勉強会#5 vimrcの書き方
関西Vim勉強会#5 vimrcの書き方tsukkee _
2.4K views27 slides
Full-Stack JavaScript with Node.js by
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsMichael Lehmann
2.5K views22 slides

More Related Content

What's hot

Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In... by
Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...
Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...Zabbix BR
3.1K views27 slides
Node App Start Forever by
Node App Start ForeverNode App Start Forever
Node App Start ForeverGunjan patel
408 views2 slides
Gitosis on Mac OS X Server by
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X ServerYasuhiro Asaka
2.4K views24 slides
Do .egg à web by
Do .egg à webDo .egg à web
Do .egg à webHardDiskD
275 views16 slides
Make the prompt great again by
Make the prompt great againMake the prompt great again
Make the prompt great againjtyr
2.3K views26 slides
Tic tac toe by
Tic tac toeTic tac toe
Tic tac toejo pakson
544 views4 slides

What's hot(10)

Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In... by Zabbix BR
Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...
Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...
Zabbix BR3.1K views
Node App Start Forever by Gunjan patel
Node App Start ForeverNode App Start Forever
Node App Start Forever
Gunjan patel408 views
Gitosis on Mac OS X Server by Yasuhiro Asaka
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X Server
Yasuhiro Asaka2.4K views
Do .egg à web by HardDiskD
Do .egg à webDo .egg à web
Do .egg à web
HardDiskD275 views
Make the prompt great again by jtyr
Make the prompt great againMake the prompt great again
Make the prompt great again
jtyr2.3K views
Tic tac toe by jo pakson
Tic tac toeTic tac toe
Tic tac toe
jo pakson544 views
Glusterfs session #18 intro to fuse and its trade offs by Pranith Karampuri
Glusterfs session #18 intro to fuse and its trade offsGlusterfs session #18 intro to fuse and its trade offs
Glusterfs session #18 intro to fuse and its trade offs
R で解く FizzBuzz 問題 by Kosei ABE
R で解く FizzBuzz 問題R で解く FizzBuzz 問題
R で解く FizzBuzz 問題
Kosei ABE2.1K views
Bab 6 by Zinoa
Bab 6Bab 6
Bab 6
Zinoa94 views

More from Kaoru Maeda

Emacs TypeScript by
Emacs TypeScriptEmacs TypeScript
Emacs TypeScriptKaoru Maeda
1.4K views24 slides
IETF103の話題から (HTML5 Conf 2018) by
IETF103の話題から (HTML5 Conf 2018)IETF103の話題から (HTML5 Conf 2018)
IETF103の話題から (HTML5 Conf 2018)Kaoru Maeda
888 views10 slides
IETF102 Report Authorization by
IETF102 Report AuthorizationIETF102 Report Authorization
IETF102 Report AuthorizationKaoru Maeda
846 views33 slides
IETF97 Update oauth tokbind by
IETF97 Update oauth tokbindIETF97 Update oauth tokbind
IETF97 Update oauth tokbindKaoru Maeda
879 views24 slides
IETF96 Update oauth tokbind by
IETF96 Update oauth tokbindIETF96 Update oauth tokbind
IETF96 Update oauth tokbindKaoru Maeda
1.7K views22 slides
Ietf95 http2 by
Ietf95 http2Ietf95 http2
Ietf95 http2Kaoru Maeda
1.1K views28 slides

More from Kaoru Maeda(20)

Emacs TypeScript by Kaoru Maeda
Emacs TypeScriptEmacs TypeScript
Emacs TypeScript
Kaoru Maeda1.4K views
IETF103の話題から (HTML5 Conf 2018) by Kaoru Maeda
IETF103の話題から (HTML5 Conf 2018)IETF103の話題から (HTML5 Conf 2018)
IETF103の話題から (HTML5 Conf 2018)
Kaoru Maeda888 views
IETF102 Report Authorization by Kaoru Maeda
IETF102 Report AuthorizationIETF102 Report Authorization
IETF102 Report Authorization
Kaoru Maeda846 views
IETF97 Update oauth tokbind by Kaoru Maeda
IETF97 Update oauth tokbindIETF97 Update oauth tokbind
IETF97 Update oauth tokbind
Kaoru Maeda879 views
IETF96 Update oauth tokbind by Kaoru Maeda
IETF96 Update oauth tokbindIETF96 Update oauth tokbind
IETF96 Update oauth tokbind
Kaoru Maeda1.7K views
http2study 20160423 IETF95 Report by Kaoru Maeda
http2study 20160423 IETF95 Reporthttp2study 20160423 IETF95 Report
http2study 20160423 IETF95 Report
Kaoru Maeda1.5K views
From an Experience of Vulnerability Reporting by Kaoru Maeda
From an Experience of Vulnerability ReportingFrom an Experience of Vulnerability Reporting
From an Experience of Vulnerability Reporting
Kaoru Maeda969 views
HTTP/2: ぼくたちのWebはどう変わるのか by Kaoru Maeda
HTTP/2: ぼくたちのWebはどう変わるのかHTTP/2: ぼくたちのWebはどう変わるのか
HTTP/2: ぼくたちのWebはどう変わるのか
Kaoru Maeda1.8K views
IETF93 Prague報告Web関連+QUIC by Kaoru Maeda
IETF93 Prague報告Web関連+QUICIETF93 Prague報告Web関連+QUIC
IETF93 Prague報告Web関連+QUIC
Kaoru Maeda1.3K views
IETF93プレ勉強会、ARTエリアの歩き方 by Kaoru Maeda
IETF93プレ勉強会、ARTエリアの歩き方IETF93プレ勉強会、ARTエリアの歩き方
IETF93プレ勉強会、ARTエリアの歩き方
Kaoru Maeda1.1K views
IETF92報告IoT関連 by Kaoru Maeda
IETF92報告IoT関連IETF92報告IoT関連
IETF92報告IoT関連
Kaoru Maeda2.9K views
IETF91報告arcmedia-mcic by Kaoru Maeda
IETF91報告arcmedia-mcicIETF91報告arcmedia-mcic
IETF91報告arcmedia-mcic
Kaoru Maeda1K views
Ietf91報告 httpbis-httpauth by Kaoru Maeda
Ietf91報告 httpbis-httpauthIetf91報告 httpbis-httpauth
Ietf91報告 httpbis-httpauth
Kaoru Maeda1.2K views
IETF91 Honolulu httpbis WG Report by Kaoru Maeda
IETF91 Honolulu httpbis WG ReportIETF91 Honolulu httpbis WG Report
IETF91 Honolulu httpbis WG Report
Kaoru Maeda1.4K views
HTTP/2 Local activities in Japan by Kaoru Maeda
HTTP/2 Local activities in JapanHTTP/2 Local activities in Japan
HTTP/2 Local activities in Japan
Kaoru Maeda1K views
IETF90 Web関連WG報告 #isocjp by Kaoru Maeda
IETF90 Web関連WG報告 #isocjpIETF90 Web関連WG報告 #isocjp
IETF90 Web関連WG報告 #isocjp
Kaoru Maeda1.7K views
IETF90 IoT関連WG報告 #isocjp by Kaoru Maeda
IETF90 IoT関連WG報告 #isocjpIETF90 IoT関連WG報告 #isocjp
IETF90 IoT関連WG報告 #isocjp
Kaoru Maeda3.1K views
HTTP/2 draft 14 preview and IETF90 httpbis WG Report by Kaoru Maeda
HTTP/2 draft 14 preview and IETF90 httpbis WG ReportHTTP/2 draft 14 preview and IETF90 httpbis WG Report
HTTP/2 draft 14 preview and IETF90 httpbis WG Report
Kaoru Maeda3.6K views

Recently uploaded

EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx by
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptxEIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptxISSIP
407 views50 slides
Class 9 lesson plans by
Class 9 lesson plansClass 9 lesson plans
Class 9 lesson plansTARIQ KHAN
53 views34 slides
Jibachha publishing Textbook.docx by
Jibachha publishing Textbook.docxJibachha publishing Textbook.docx
Jibachha publishing Textbook.docxDrJibachhaSahVetphys
53 views14 slides
Mineral nutrition and Fertilizer use of Cashew by
 Mineral nutrition and Fertilizer use of Cashew Mineral nutrition and Fertilizer use of Cashew
Mineral nutrition and Fertilizer use of CashewAruna Srikantha Jayawardana
52 views107 slides
When Sex Gets Complicated: Porn, Affairs, & Cybersex by
When Sex Gets Complicated: Porn, Affairs, & CybersexWhen Sex Gets Complicated: Porn, Affairs, & Cybersex
When Sex Gets Complicated: Porn, Affairs, & CybersexMarlene Maheu
99 views73 slides
11.28.23 Social Capital and Social Exclusion.pptx by
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptxmary850239
383 views25 slides

Recently uploaded(20)

EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx by ISSIP
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptxEIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
ISSIP407 views
Class 9 lesson plans by TARIQ KHAN
Class 9 lesson plansClass 9 lesson plans
Class 9 lesson plans
TARIQ KHAN53 views
When Sex Gets Complicated: Porn, Affairs, & Cybersex by Marlene Maheu
When Sex Gets Complicated: Porn, Affairs, & CybersexWhen Sex Gets Complicated: Porn, Affairs, & Cybersex
When Sex Gets Complicated: Porn, Affairs, & Cybersex
Marlene Maheu99 views
11.28.23 Social Capital and Social Exclusion.pptx by mary850239
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptx
mary850239383 views
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx by Ms. Pooja Bhandare
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptxPharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Ms. Pooja Bhandare120 views
Monthly Information Session for MV Asterix (November) by Esquimalt MFRC
Monthly Information Session for MV Asterix (November)Monthly Information Session for MV Asterix (November)
Monthly Information Session for MV Asterix (November)
Esquimalt MFRC91 views
BÀI TẬP BỔ TRỢ TIẾNG ANH FAMILY AND FRIENDS NATIONAL EDITION - LỚP 4 (CÓ FIL... by Nguyen Thanh Tu Collection
BÀI TẬP BỔ TRỢ TIẾNG ANH FAMILY AND FRIENDS NATIONAL EDITION - LỚP 4 (CÓ FIL...BÀI TẬP BỔ TRỢ TIẾNG ANH FAMILY AND FRIENDS NATIONAL EDITION - LỚP 4 (CÓ FIL...
BÀI TẬP BỔ TRỢ TIẾNG ANH FAMILY AND FRIENDS NATIONAL EDITION - LỚP 4 (CÓ FIL...
A-Level Art by WestHatch
A-Level ArtA-Level Art
A-Level Art
WestHatch48 views
Narration lesson plan by TARIQ KHAN
Narration lesson planNarration lesson plan
Narration lesson plan
TARIQ KHAN64 views
AUDIENCE - BANDURA.pptx by iammrhaywood
AUDIENCE - BANDURA.pptxAUDIENCE - BANDURA.pptx
AUDIENCE - BANDURA.pptx
iammrhaywood131 views
The basics - information, data, technology and systems.pdf by JonathanCovena1
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdf
JonathanCovena1156 views
GCSE Spanish by WestHatch
GCSE SpanishGCSE Spanish
GCSE Spanish
WestHatch53 views
How to empty an One2many field in Odoo by Celine George
How to empty an One2many field in OdooHow to empty an One2many field in Odoo
How to empty an One2many field in Odoo
Celine George97 views

Fizzbuzz in Complex Plane

  • 1. FizzBuzz in Complex Plane Kaoru Maeda @mad_p Feb. 2013
  • 2. FizzBuzz Code Golf in Ruby (Tokyo Ruby Kaigi 10*) My answer (77 chars): puts eval($*.join'..').map{|n|%W[FizzBuzz Buzz #{n} Fizz][((n%3).i-n%5).arg]} Im Select Fizz, Buzz, FizzBuzz, or Number by êarg((nmod3)i - (nmod 5))ú ë û 14 8 2 Buzz 11 5 nmod3 4 13 7 1 10 Fizz 1,2,3 radians 9 3 12 -nmod5 * http://codeiq.hatenablog.com/entry/2013/01/16/002033 6 0 Re FizzBuzz (Luckily, 0.arg == 0 in Ruby)