SlideShare a Scribd company logo
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)

More Related Content

What's hot

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...
Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...
Zabbix BR
 
Node App Start Forever
Node App Start ForeverNode App Start Forever
Node App Start Forever
Gunjan patel
 
Gitosis on Mac OS X Server
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X ServerYasuhiro Asaka
 
Do .egg à web
Do .egg à webDo .egg à web
Do .egg à web
HardDiskD
 
Make the prompt great again
Make the prompt great againMake the prompt great again
Make the prompt great again
jtyr
 
Glusterfs session #18 intro to fuse and its trade offs
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
Pranith Karampuri
 
R で解く FizzBuzz 問題
R で解く FizzBuzz 問題R で解く FizzBuzz 問題
R で解く FizzBuzz 問題
Kosei ABE
 
Bab 6
Bab 6Bab 6
Bab 6
Zinoa
 

What's hot (10)

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...
Monitoramento ambiental e alertas visuais com Zabbix - 3º Zabbix Meetup do In...
 
Node App Start Forever
Node App Start ForeverNode App Start Forever
Node App Start Forever
 
Gitosis on Mac OS X Server
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X Server
 
Do .egg à web
Do .egg à webDo .egg à web
Do .egg à web
 
Make the prompt great again
Make the prompt great againMake the prompt great again
Make the prompt great again
 
Tic tac toe
Tic tac toeTic tac toe
Tic tac toe
 
Gitkata refspec
Gitkata refspecGitkata refspec
Gitkata refspec
 
Glusterfs session #18 intro to fuse and its trade offs
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 問題
R で解く FizzBuzz 問題R で解く FizzBuzz 問題
R で解く FizzBuzz 問題
 
Bab 6
Bab 6Bab 6
Bab 6
 

More from Kaoru Maeda

Emacs TypeScript
Emacs TypeScriptEmacs TypeScript
Emacs TypeScript
Kaoru Maeda
 
IETF103の話題から (HTML5 Conf 2018)
IETF103の話題から (HTML5 Conf 2018)IETF103の話題から (HTML5 Conf 2018)
IETF103の話題から (HTML5 Conf 2018)
Kaoru Maeda
 
IETF102 Report Authorization
IETF102 Report AuthorizationIETF102 Report Authorization
IETF102 Report Authorization
Kaoru Maeda
 
IETF97 Update oauth tokbind
IETF97 Update oauth tokbindIETF97 Update oauth tokbind
IETF97 Update oauth tokbind
Kaoru Maeda
 
IETF96 Update oauth tokbind
IETF96 Update oauth tokbindIETF96 Update oauth tokbind
IETF96 Update oauth tokbind
Kaoru Maeda
 
Ietf95 http2
Ietf95 http2Ietf95 http2
Ietf95 http2
Kaoru Maeda
 
http2study 20160423 IETF95 Report
http2study 20160423 IETF95 Reporthttp2study 20160423 IETF95 Report
http2study 20160423 IETF95 Report
Kaoru Maeda
 
From an Experience of Vulnerability Reporting
From an Experience of Vulnerability ReportingFrom an Experience of Vulnerability Reporting
From an Experience of Vulnerability Reporting
Kaoru Maeda
 
HTTP/2: ぼくたちのWebはどう変わるのか
HTTP/2: ぼくたちのWebはどう変わるのかHTTP/2: ぼくたちのWebはどう変わるのか
HTTP/2: ぼくたちのWebはどう変わるのか
Kaoru Maeda
 
IETF93 Prague報告Web関連+QUIC
IETF93 Prague報告Web関連+QUICIETF93 Prague報告Web関連+QUIC
IETF93 Prague報告Web関連+QUIC
Kaoru Maeda
 
IETF93プレ勉強会、ARTエリアの歩き方
IETF93プレ勉強会、ARTエリアの歩き方IETF93プレ勉強会、ARTエリアの歩き方
IETF93プレ勉強会、ARTエリアの歩き方
Kaoru Maeda
 
Tokbind-fido
Tokbind-fidoTokbind-fido
Tokbind-fido
Kaoru Maeda
 
IETF92報告IoT関連
IETF92報告IoT関連IETF92報告IoT関連
IETF92報告IoT関連
Kaoru Maeda
 
IETF91報告arcmedia-mcic
IETF91報告arcmedia-mcicIETF91報告arcmedia-mcic
IETF91報告arcmedia-mcic
Kaoru Maeda
 
Ietf91報告 httpbis-httpauth
Ietf91報告 httpbis-httpauthIetf91報告 httpbis-httpauth
Ietf91報告 httpbis-httpauth
Kaoru Maeda
 
IETF91 Honolulu httpbis WG Report
IETF91 Honolulu httpbis WG ReportIETF91 Honolulu httpbis WG Report
IETF91 Honolulu httpbis WG Report
Kaoru Maeda
 
HTTP/2 Local activities in Japan
HTTP/2 Local activities in JapanHTTP/2 Local activities in Japan
HTTP/2 Local activities in Japan
Kaoru Maeda
 
IETF90 Web関連WG報告 #isocjp
IETF90 Web関連WG報告 #isocjpIETF90 Web関連WG報告 #isocjp
IETF90 Web関連WG報告 #isocjp
Kaoru Maeda
 
IETF90 IoT関連WG報告 #isocjp
IETF90 IoT関連WG報告 #isocjpIETF90 IoT関連WG報告 #isocjp
IETF90 IoT関連WG報告 #isocjp
Kaoru Maeda
 
HTTP/2 draft 14 preview and IETF90 httpbis WG Report
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 Maeda
 

More from Kaoru Maeda (20)

Emacs TypeScript
Emacs TypeScriptEmacs TypeScript
Emacs TypeScript
 
IETF103の話題から (HTML5 Conf 2018)
IETF103の話題から (HTML5 Conf 2018)IETF103の話題から (HTML5 Conf 2018)
IETF103の話題から (HTML5 Conf 2018)
 
IETF102 Report Authorization
IETF102 Report AuthorizationIETF102 Report Authorization
IETF102 Report Authorization
 
IETF97 Update oauth tokbind
IETF97 Update oauth tokbindIETF97 Update oauth tokbind
IETF97 Update oauth tokbind
 
IETF96 Update oauth tokbind
IETF96 Update oauth tokbindIETF96 Update oauth tokbind
IETF96 Update oauth tokbind
 
Ietf95 http2
Ietf95 http2Ietf95 http2
Ietf95 http2
 
http2study 20160423 IETF95 Report
http2study 20160423 IETF95 Reporthttp2study 20160423 IETF95 Report
http2study 20160423 IETF95 Report
 
From an Experience of Vulnerability Reporting
From an Experience of Vulnerability ReportingFrom an Experience of Vulnerability Reporting
From an Experience of Vulnerability Reporting
 
HTTP/2: ぼくたちのWebはどう変わるのか
HTTP/2: ぼくたちのWebはどう変わるのかHTTP/2: ぼくたちのWebはどう変わるのか
HTTP/2: ぼくたちのWebはどう変わるのか
 
IETF93 Prague報告Web関連+QUIC
IETF93 Prague報告Web関連+QUICIETF93 Prague報告Web関連+QUIC
IETF93 Prague報告Web関連+QUIC
 
IETF93プレ勉強会、ARTエリアの歩き方
IETF93プレ勉強会、ARTエリアの歩き方IETF93プレ勉強会、ARTエリアの歩き方
IETF93プレ勉強会、ARTエリアの歩き方
 
Tokbind-fido
Tokbind-fidoTokbind-fido
Tokbind-fido
 
IETF92報告IoT関連
IETF92報告IoT関連IETF92報告IoT関連
IETF92報告IoT関連
 
IETF91報告arcmedia-mcic
IETF91報告arcmedia-mcicIETF91報告arcmedia-mcic
IETF91報告arcmedia-mcic
 
Ietf91報告 httpbis-httpauth
Ietf91報告 httpbis-httpauthIetf91報告 httpbis-httpauth
Ietf91報告 httpbis-httpauth
 
IETF91 Honolulu httpbis WG Report
IETF91 Honolulu httpbis WG ReportIETF91 Honolulu httpbis WG Report
IETF91 Honolulu httpbis WG Report
 
HTTP/2 Local activities in Japan
HTTP/2 Local activities in JapanHTTP/2 Local activities in Japan
HTTP/2 Local activities in Japan
 
IETF90 Web関連WG報告 #isocjp
IETF90 Web関連WG報告 #isocjpIETF90 Web関連WG報告 #isocjp
IETF90 Web関連WG報告 #isocjp
 
IETF90 IoT関連WG報告 #isocjp
IETF90 IoT関連WG報告 #isocjpIETF90 IoT関連WG報告 #isocjp
IETF90 IoT関連WG報告 #isocjp
 
HTTP/2 draft 14 preview and IETF90 httpbis WG Report
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
 

Recently uploaded

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 

Recently uploaded (20)

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 

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)