Number of rotations











up vote
3
down vote

favorite
1












Task



Write a function or a program to find the number of rotations required by a wheel to travel a given distance, given its radius.



Rules



Input can be 2 positive rational numbers and can be taken in any convenient format.



Both inputs are of same unit.



There must not be any digits 0-9 in your code.



The output will be an integer (in case of float, round to infinity)



This is code-golf so shortest code wins



Examples



distance radius  output
10 1 2
50 2 4
52.22 4 3
3.4 0.08 7
12.5663 0.9999 3









share|improve this question




















  • 1




    You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like -DP=3.14 in compiler flags, that would define P as an approximation of pi, which is probably not what you intended
    – Annyo
    10 hours ago

















up vote
3
down vote

favorite
1












Task



Write a function or a program to find the number of rotations required by a wheel to travel a given distance, given its radius.



Rules



Input can be 2 positive rational numbers and can be taken in any convenient format.



Both inputs are of same unit.



There must not be any digits 0-9 in your code.



The output will be an integer (in case of float, round to infinity)



This is code-golf so shortest code wins



Examples



distance radius  output
10 1 2
50 2 4
52.22 4 3
3.4 0.08 7
12.5663 0.9999 3









share|improve this question




















  • 1




    You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like -DP=3.14 in compiler flags, that would define P as an approximation of pi, which is probably not what you intended
    – Annyo
    10 hours ago















up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





Task



Write a function or a program to find the number of rotations required by a wheel to travel a given distance, given its radius.



Rules



Input can be 2 positive rational numbers and can be taken in any convenient format.



Both inputs are of same unit.



There must not be any digits 0-9 in your code.



The output will be an integer (in case of float, round to infinity)



This is code-golf so shortest code wins



Examples



distance radius  output
10 1 2
50 2 4
52.22 4 3
3.4 0.08 7
12.5663 0.9999 3









share|improve this question















Task



Write a function or a program to find the number of rotations required by a wheel to travel a given distance, given its radius.



Rules



Input can be 2 positive rational numbers and can be taken in any convenient format.



Both inputs are of same unit.



There must not be any digits 0-9 in your code.



The output will be an integer (in case of float, round to infinity)



This is code-golf so shortest code wins



Examples



distance radius  output
10 1 2
50 2 4
52.22 4 3
3.4 0.08 7
12.5663 0.9999 3






code-golf restricted-source






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 14 hours ago









Jo King

19.3k245102




19.3k245102










asked 14 hours ago









Vedant Kandoi

57615




57615








  • 1




    You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like -DP=3.14 in compiler flags, that would define P as an approximation of pi, which is probably not what you intended
    – Annyo
    10 hours ago
















  • 1




    You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like -DP=3.14 in compiler flags, that would define P as an approximation of pi, which is probably not what you intended
    – Annyo
    10 hours ago










1




1




You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like -DP=3.14 in compiler flags, that would define P as an approximation of pi, which is probably not what you intended
– Annyo
10 hours ago






You probably should add that digits are also forbidden in compiler options (or anywhere else): if you limit this constraint to code only, with gcc we can do something like -DP=3.14 in compiler flags, that would define P as an approximation of pi, which is probably not what you intended
– Annyo
10 hours ago












20 Answers
20






active

oldest

votes

















up vote
5
down vote














MathGolf, 5 4 bytes



τ/╠ü


Try it online!



Explanation



τ      Push tau (2*pi)
/ Divide the first argument (total distance) by tau
╠ Reverse divide (computes (distance/tau)/radius)
ü Ceiling





share|improve this answer






























    up vote
    3
    down vote













    APL+WIN, 9 bytes



    Prompts for radius followed by distance:



    ⌈⎕÷○r+r←⎕


    Try it online! Courtesy of Dyalog Classic



    Explanation:



    ○r+r←⎕ prompt for radius and double it and multiply by pie

    ⌈⎕÷ prompt for distance, divide by result above and take ceiling





    share|improve this answer






























      up vote
      3
      down vote














      Python 2, 47 45 44 43 bytes





      lambda l,r:l/(r+r)//math.pi+l/l
      import math


      Try it online!






      • -2 bytes, thanks to flawr

      • -1 byte, thanks to Jonathan Allan






      share|improve this answer























      • Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can do l/(r+r)//pi+l/l and save a byte.
        – Jonathan Allan
        13 hours ago










      • @JonathanAllan Thanks :)
        – TFeld
        13 hours ago


















      up vote
      3
      down vote













      Java 8, 32 30 bytes





      a->b->-~(int)(a/b/Math.PI/'')


      Contains unprintable u0002 between the single quotes.



      Port of @jOKing's Perl 6 answer.



      Try it online.






      share|improve this answer























      • Is that the digit '1' in your code? I think that might not be allowed.
        – ouflak
        13 hours ago






      • 4




        @ouflak Looks like it can be fixed like this.
        – Erik the Outgolfer
        13 hours ago










      • @ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit 2, and then just use digit 1... Luckily Erik is indeed right that a simple negative unary has the same effect as +1 (often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
        – Kevin Cruijssen
        9 hours ago




















      up vote
      3
      down vote














      Perl 6, 15 12 bytes



      -3 bytes tjanks to nwellnhof reminding me about tau





      */*/τ+|$+!$


      Try it online!



      Anonymous Whatever lambda that uses the formula (a/b/tau).floor+1. Tau is two times pi. The two anonymous variables $ are coerced to the number 0, which is used to floor the number +|0 (bitwise or 0) and add one +!$ (plus not zero).






      share|improve this answer























      • There must not be any digits 0-9 in your code.
        – Titus
        14 hours ago










      • @Titus I can't believe I forgot that. Thanks, fixed!
        – Jo King
        14 hours ago












      • Are digits in exponents also allowed?
        – ouflak
        13 hours ago


















      up vote
      2
      down vote














      05AB1E, 6 bytes



      ·/žq/î


      Port of @flawr's Python 2 comment.

      Takes the input in the order radius,distance.



      Try it online or verify all test cases.



      Explanation:





      ·         # Double the first (implicit) input
      / # Divide the second (implicit) input by it
      žq/ # Divide it by PI
      î # Ceil it (and output implicitly)





      share|improve this answer




























        up vote
        2
        down vote













        C, 46 bytes



        f(float a,float b){return ceil(a/(b+b)/M_PI);}


        I'm new to PPCG, so I'm not sure wether I have to count other parts in the byte count, such as the



        include <math.h>


        needed for the ceil function, which will rise the count to 64 bytes






        share|improve this answer








        New contributor




        bznein is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.


















        • Welcome to PPCG! This is a nice first answer. Yes, you do need to count #include and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
          – O.O.Balance
          12 hours ago










        • @O.O.Balance Digits are not allowed in the code for this challenge ;)
          – Annyo
          12 hours ago










        • @Annyo I knew I was forgetting something :(
          – O.O.Balance
          12 hours ago


















        up vote
        2
        down vote














        Catholicon, 8 bytes



        ċ//ĊǓĊ`Ė


        Explanation:



          /ĊǓĊ    divide the first input by the doubled second input
        / `Ė divide that by pi
        ċ ceil


        New version (pi builtin made one byte, division parameters swapped), 5 bytes



        ċ/π/Ǔ





        share|improve this answer






























          up vote
          2
          down vote














          MathGolf, 6 5 bytes



          ∞/π/ü


          Semi-port of @flawr's Python 2 comment.

          Takes the input in the order radius distance.



          -1 byte because ceil builtin has just been added, replacing the floor+1.



          Try it online.



          Explanation:





          ∞        # Double the first (implicit) input
          / # Divide the second (implicit) input by it
          π/ # Divide it by PI
          ü # Ceil (and output implicitly)





          share|improve this answer























          • Nice answer! I'll have to admit, it's my fault that there are no ceil operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
            – maxb
            12 hours ago






          • 4




            I would like to see a proof that "Pi is rational"...
            – Pakk
            12 hours ago






          • 1




            @Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It is ü and works both with numericals and lists
            – maxb
            12 hours ago










          • @maxb That was fast. :D
            – Kevin Cruijssen
            9 hours ago






          • 1




            @Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that the ceil function is added. ;p
            – Kevin Cruijssen
            9 hours ago


















          up vote
          1
          down vote













          PHP, 47 bytes



          <?=ceil($argv[++$i]/M_PI/(($b=end($argv))+$b));


          Try it online.






          share|improve this answer






























            up vote
            1
            down vote














            Jelly, 6 bytes



            ÷÷ØPHĊ


            Try it online!






            share|improve this answer




























              up vote
              1
              down vote














              Ruby, 29 bytes





              ->l,r{(l/Math::PI/r+=r).ceil}


              Try it online!






              share|improve this answer




























                up vote
                1
                down vote














                J, 10 9 bytes



                >.@%o.@+:


                Try it online!






                share|improve this answer






























                  up vote
                  1
                  down vote














                  JavaScript (Babel Node), 25 bytes



                  -2 bytes using @flawr comment =D. -1 from @Kevin. -7 from @Shaggy





                  a=>b=>-~(a/(b+b)/Math.PI)


                  Try it online!






                  share|improve this answer























                  • Just a=>b=>Math.ceil(a/(b+b)/Math.PI) is 32 bytes. :)
                    – Kevin Cruijssen
                    14 hours ago










                  • 25 bytes
                    – Shaggy
                    10 hours ago


















                  up vote
                  1
                  down vote














                  Julia 1.0, 20 bytes





                  f(d,r)=cld(d/π,r+r)


                  Try it online!






                  share|improve this answer























                  • fixed..........
                    – gggg
                    6 hours ago


















                  up vote
                  1
                  down vote














                  R, 39 32 bytes



                  -7 bytes Thanks to Giuseppe





                  function(d,r)ceiling(d/(r+r)/pi)


                  Try it online!



                  I feel like this could definitely be golfed, but I am a bit lazy right now to do anything about it






                  share|improve this answer






























                    up vote
                    0
                    down vote














                    Lua, 61 58 57 bytes





                    s=io.read()r=io.read()print(math.ceil((s/(r+r))/math.pi))


                    Try it online!



                    The inputs must be separated by a newline. I'm looking at how to read an array in LUA.
                    edit: Several ways, but nothing that saves bytes....






                    share|improve this answer






























                      up vote
                      0
                      down vote













                      Japt, 7 bytes



                      /MT/V c


                      Try it here






                      share|improve this answer




























                        up vote
                        0
                        down vote














                        Stax, 5 bytes



                        Vt*/e


                        Run and debug it



                        Vt*   multiply by tau (2pi)
                        / divide
                        e ceiling





                        share|improve this answer




























                          up vote
                          0
                          down vote














                          C (gcc), 45 47 45 bytes





                          f(d,r,R)float d,r;{R=ceil(d/r/'G'/'n'*'q');}


                          A reasonable approximation of pi is 355/113. Since circumference C = 2 * r * PI, we can instead of pi use tau, which is then of course ~710/113. 710 happens to have the convenient factors 2 * 5 * 71, which is compactly expressed as 'G' * 'n'. We add one (r/r) to force rounding to infinity.



                          Edit: My trick was too clever for its own good: it of course made it fail if the distance was a multiple of the circumference.



                          Try it online!






                          share|improve this answer























                            Your Answer





                            StackExchange.ifUsing("editor", function () {
                            return StackExchange.using("mathjaxEditing", function () {
                            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                            });
                            });
                            }, "mathjax-editing");

                            StackExchange.ifUsing("editor", function () {
                            StackExchange.using("externalEditor", function () {
                            StackExchange.using("snippets", function () {
                            StackExchange.snippets.init();
                            });
                            });
                            }, "code-snippets");

                            StackExchange.ready(function() {
                            var channelOptions = {
                            tags: "".split(" "),
                            id: "200"
                            };
                            initTagRenderer("".split(" "), "".split(" "), channelOptions);

                            StackExchange.using("externalEditor", function() {
                            // Have to fire editor after snippets, if snippets enabled
                            if (StackExchange.settings.snippets.snippetsEnabled) {
                            StackExchange.using("snippets", function() {
                            createEditor();
                            });
                            }
                            else {
                            createEditor();
                            }
                            });

                            function createEditor() {
                            StackExchange.prepareEditor({
                            heartbeatType: 'answer',
                            convertImagesToLinks: false,
                            noModals: true,
                            showLowRepImageUploadWarning: true,
                            reputationToPostImages: null,
                            bindNavPrevention: true,
                            postfix: "",
                            imageUploader: {
                            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                            allowUrls: true
                            },
                            onDemand: true,
                            discardSelector: ".discard-answer"
                            ,immediatelyShowMarkdownHelp:true
                            });


                            }
                            });














                             

                            draft saved


                            draft discarded


















                            StackExchange.ready(
                            function () {
                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f176328%2fnumber-of-rotations%23new-answer', 'question_page');
                            }
                            );

                            Post as a guest















                            Required, but never shown

























                            20 Answers
                            20






                            active

                            oldest

                            votes








                            20 Answers
                            20






                            active

                            oldest

                            votes









                            active

                            oldest

                            votes






                            active

                            oldest

                            votes








                            up vote
                            5
                            down vote














                            MathGolf, 5 4 bytes



                            τ/╠ü


                            Try it online!



                            Explanation



                            τ      Push tau (2*pi)
                            / Divide the first argument (total distance) by tau
                            ╠ Reverse divide (computes (distance/tau)/radius)
                            ü Ceiling





                            share|improve this answer



























                              up vote
                              5
                              down vote














                              MathGolf, 5 4 bytes



                              τ/╠ü


                              Try it online!



                              Explanation



                              τ      Push tau (2*pi)
                              / Divide the first argument (total distance) by tau
                              ╠ Reverse divide (computes (distance/tau)/radius)
                              ü Ceiling





                              share|improve this answer

























                                up vote
                                5
                                down vote










                                up vote
                                5
                                down vote










                                MathGolf, 5 4 bytes



                                τ/╠ü


                                Try it online!



                                Explanation



                                τ      Push tau (2*pi)
                                / Divide the first argument (total distance) by tau
                                ╠ Reverse divide (computes (distance/tau)/radius)
                                ü Ceiling





                                share|improve this answer















                                MathGolf, 5 4 bytes



                                τ/╠ü


                                Try it online!



                                Explanation



                                τ      Push tau (2*pi)
                                / Divide the first argument (total distance) by tau
                                ╠ Reverse divide (computes (distance/tau)/radius)
                                ü Ceiling






                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 12 hours ago

























                                answered 12 hours ago









                                maxb

                                2,1081923




                                2,1081923






















                                    up vote
                                    3
                                    down vote













                                    APL+WIN, 9 bytes



                                    Prompts for radius followed by distance:



                                    ⌈⎕÷○r+r←⎕


                                    Try it online! Courtesy of Dyalog Classic



                                    Explanation:



                                    ○r+r←⎕ prompt for radius and double it and multiply by pie

                                    ⌈⎕÷ prompt for distance, divide by result above and take ceiling





                                    share|improve this answer



























                                      up vote
                                      3
                                      down vote













                                      APL+WIN, 9 bytes



                                      Prompts for radius followed by distance:



                                      ⌈⎕÷○r+r←⎕


                                      Try it online! Courtesy of Dyalog Classic



                                      Explanation:



                                      ○r+r←⎕ prompt for radius and double it and multiply by pie

                                      ⌈⎕÷ prompt for distance, divide by result above and take ceiling





                                      share|improve this answer

























                                        up vote
                                        3
                                        down vote










                                        up vote
                                        3
                                        down vote









                                        APL+WIN, 9 bytes



                                        Prompts for radius followed by distance:



                                        ⌈⎕÷○r+r←⎕


                                        Try it online! Courtesy of Dyalog Classic



                                        Explanation:



                                        ○r+r←⎕ prompt for radius and double it and multiply by pie

                                        ⌈⎕÷ prompt for distance, divide by result above and take ceiling





                                        share|improve this answer














                                        APL+WIN, 9 bytes



                                        Prompts for radius followed by distance:



                                        ⌈⎕÷○r+r←⎕


                                        Try it online! Courtesy of Dyalog Classic



                                        Explanation:



                                        ○r+r←⎕ prompt for radius and double it and multiply by pie

                                        ⌈⎕÷ prompt for distance, divide by result above and take ceiling






                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited 13 hours ago

























                                        answered 13 hours ago









                                        Graham

                                        2,11668




                                        2,11668






















                                            up vote
                                            3
                                            down vote














                                            Python 2, 47 45 44 43 bytes





                                            lambda l,r:l/(r+r)//math.pi+l/l
                                            import math


                                            Try it online!






                                            • -2 bytes, thanks to flawr

                                            • -1 byte, thanks to Jonathan Allan






                                            share|improve this answer























                                            • Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can do l/(r+r)//pi+l/l and save a byte.
                                              – Jonathan Allan
                                              13 hours ago










                                            • @JonathanAllan Thanks :)
                                              – TFeld
                                              13 hours ago















                                            up vote
                                            3
                                            down vote














                                            Python 2, 47 45 44 43 bytes





                                            lambda l,r:l/(r+r)//math.pi+l/l
                                            import math


                                            Try it online!






                                            • -2 bytes, thanks to flawr

                                            • -1 byte, thanks to Jonathan Allan






                                            share|improve this answer























                                            • Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can do l/(r+r)//pi+l/l and save a byte.
                                              – Jonathan Allan
                                              13 hours ago










                                            • @JonathanAllan Thanks :)
                                              – TFeld
                                              13 hours ago













                                            up vote
                                            3
                                            down vote










                                            up vote
                                            3
                                            down vote










                                            Python 2, 47 45 44 43 bytes





                                            lambda l,r:l/(r+r)//math.pi+l/l
                                            import math


                                            Try it online!






                                            • -2 bytes, thanks to flawr

                                            • -1 byte, thanks to Jonathan Allan






                                            share|improve this answer















                                            Python 2, 47 45 44 43 bytes





                                            lambda l,r:l/(r+r)//math.pi+l/l
                                            import math


                                            Try it online!






                                            • -2 bytes, thanks to flawr

                                            • -1 byte, thanks to Jonathan Allan







                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited 13 hours ago

























                                            answered 14 hours ago









                                            TFeld

                                            13.6k21139




                                            13.6k21139












                                            • Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can do l/(r+r)//pi+l/l and save a byte.
                                              – Jonathan Allan
                                              13 hours ago










                                            • @JonathanAllan Thanks :)
                                              – TFeld
                                              13 hours ago


















                                            • Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can do l/(r+r)//pi+l/l and save a byte.
                                              – Jonathan Allan
                                              13 hours ago










                                            • @JonathanAllan Thanks :)
                                              – TFeld
                                              13 hours ago
















                                            Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can do l/(r+r)//pi+l/l and save a byte.
                                            – Jonathan Allan
                                            13 hours ago




                                            Since inputs have been guaranteed to be both (strictly) positive and rational we never hit the edge-case of requiring an exact number of rotations, so I think we can do l/(r+r)//pi+l/l and save a byte.
                                            – Jonathan Allan
                                            13 hours ago












                                            @JonathanAllan Thanks :)
                                            – TFeld
                                            13 hours ago




                                            @JonathanAllan Thanks :)
                                            – TFeld
                                            13 hours ago










                                            up vote
                                            3
                                            down vote













                                            Java 8, 32 30 bytes





                                            a->b->-~(int)(a/b/Math.PI/'')


                                            Contains unprintable u0002 between the single quotes.



                                            Port of @jOKing's Perl 6 answer.



                                            Try it online.






                                            share|improve this answer























                                            • Is that the digit '1' in your code? I think that might not be allowed.
                                              – ouflak
                                              13 hours ago






                                            • 4




                                              @ouflak Looks like it can be fixed like this.
                                              – Erik the Outgolfer
                                              13 hours ago










                                            • @ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit 2, and then just use digit 1... Luckily Erik is indeed right that a simple negative unary has the same effect as +1 (often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
                                              – Kevin Cruijssen
                                              9 hours ago

















                                            up vote
                                            3
                                            down vote













                                            Java 8, 32 30 bytes





                                            a->b->-~(int)(a/b/Math.PI/'')


                                            Contains unprintable u0002 between the single quotes.



                                            Port of @jOKing's Perl 6 answer.



                                            Try it online.






                                            share|improve this answer























                                            • Is that the digit '1' in your code? I think that might not be allowed.
                                              – ouflak
                                              13 hours ago






                                            • 4




                                              @ouflak Looks like it can be fixed like this.
                                              – Erik the Outgolfer
                                              13 hours ago










                                            • @ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit 2, and then just use digit 1... Luckily Erik is indeed right that a simple negative unary has the same effect as +1 (often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
                                              – Kevin Cruijssen
                                              9 hours ago















                                            up vote
                                            3
                                            down vote










                                            up vote
                                            3
                                            down vote









                                            Java 8, 32 30 bytes





                                            a->b->-~(int)(a/b/Math.PI/'')


                                            Contains unprintable u0002 between the single quotes.



                                            Port of @jOKing's Perl 6 answer.



                                            Try it online.






                                            share|improve this answer














                                            Java 8, 32 30 bytes





                                            a->b->-~(int)(a/b/Math.PI/'')


                                            Contains unprintable u0002 between the single quotes.



                                            Port of @jOKing's Perl 6 answer.



                                            Try it online.







                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited 9 hours ago

























                                            answered 14 hours ago









                                            Kevin Cruijssen

                                            34.4k554182




                                            34.4k554182












                                            • Is that the digit '1' in your code? I think that might not be allowed.
                                              – ouflak
                                              13 hours ago






                                            • 4




                                              @ouflak Looks like it can be fixed like this.
                                              – Erik the Outgolfer
                                              13 hours ago










                                            • @ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit 2, and then just use digit 1... Luckily Erik is indeed right that a simple negative unary has the same effect as +1 (often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
                                              – Kevin Cruijssen
                                              9 hours ago




















                                            • Is that the digit '1' in your code? I think that might not be allowed.
                                              – ouflak
                                              13 hours ago






                                            • 4




                                              @ouflak Looks like it can be fixed like this.
                                              – Erik the Outgolfer
                                              13 hours ago










                                            • @ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit 2, and then just use digit 1... Luckily Erik is indeed right that a simple negative unary has the same effect as +1 (often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
                                              – Kevin Cruijssen
                                              9 hours ago


















                                            Is that the digit '1' in your code? I think that might not be allowed.
                                            – ouflak
                                            13 hours ago




                                            Is that the digit '1' in your code? I think that might not be allowed.
                                            – ouflak
                                            13 hours ago




                                            4




                                            4




                                            @ouflak Looks like it can be fixed like this.
                                            – Erik the Outgolfer
                                            13 hours ago




                                            @ouflak Looks like it can be fixed like this.
                                            – Erik the Outgolfer
                                            13 hours ago












                                            @ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit 2, and then just use digit 1... Luckily Erik is indeed right that a simple negative unary has the same effect as +1 (often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
                                            – Kevin Cruijssen
                                            9 hours ago






                                            @ouflak Woops, that was a pretty stupid mistake.. Using the unprintable so I don't use the digit 2, and then just use digit 1... Luckily Erik is indeed right that a simple negative unary has the same effect as +1 (often used to get rid of parenthesis since the negative and unary have higher precedence than most other operators).
                                            – Kevin Cruijssen
                                            9 hours ago












                                            up vote
                                            3
                                            down vote














                                            Perl 6, 15 12 bytes



                                            -3 bytes tjanks to nwellnhof reminding me about tau





                                            */*/τ+|$+!$


                                            Try it online!



                                            Anonymous Whatever lambda that uses the formula (a/b/tau).floor+1. Tau is two times pi. The two anonymous variables $ are coerced to the number 0, which is used to floor the number +|0 (bitwise or 0) and add one +!$ (plus not zero).






                                            share|improve this answer























                                            • There must not be any digits 0-9 in your code.
                                              – Titus
                                              14 hours ago










                                            • @Titus I can't believe I forgot that. Thanks, fixed!
                                              – Jo King
                                              14 hours ago












                                            • Are digits in exponents also allowed?
                                              – ouflak
                                              13 hours ago















                                            up vote
                                            3
                                            down vote














                                            Perl 6, 15 12 bytes



                                            -3 bytes tjanks to nwellnhof reminding me about tau





                                            */*/τ+|$+!$


                                            Try it online!



                                            Anonymous Whatever lambda that uses the formula (a/b/tau).floor+1. Tau is two times pi. The two anonymous variables $ are coerced to the number 0, which is used to floor the number +|0 (bitwise or 0) and add one +!$ (plus not zero).






                                            share|improve this answer























                                            • There must not be any digits 0-9 in your code.
                                              – Titus
                                              14 hours ago










                                            • @Titus I can't believe I forgot that. Thanks, fixed!
                                              – Jo King
                                              14 hours ago












                                            • Are digits in exponents also allowed?
                                              – ouflak
                                              13 hours ago













                                            up vote
                                            3
                                            down vote










                                            up vote
                                            3
                                            down vote










                                            Perl 6, 15 12 bytes



                                            -3 bytes tjanks to nwellnhof reminding me about tau





                                            */*/τ+|$+!$


                                            Try it online!



                                            Anonymous Whatever lambda that uses the formula (a/b/tau).floor+1. Tau is two times pi. The two anonymous variables $ are coerced to the number 0, which is used to floor the number +|0 (bitwise or 0) and add one +!$ (plus not zero).






                                            share|improve this answer















                                            Perl 6, 15 12 bytes



                                            -3 bytes tjanks to nwellnhof reminding me about tau





                                            */*/τ+|$+!$


                                            Try it online!



                                            Anonymous Whatever lambda that uses the formula (a/b/tau).floor+1. Tau is two times pi. The two anonymous variables $ are coerced to the number 0, which is used to floor the number +|0 (bitwise or 0) and add one +!$ (plus not zero).







                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited 7 hours ago

























                                            answered 14 hours ago









                                            Jo King

                                            19.3k245102




                                            19.3k245102












                                            • There must not be any digits 0-9 in your code.
                                              – Titus
                                              14 hours ago










                                            • @Titus I can't believe I forgot that. Thanks, fixed!
                                              – Jo King
                                              14 hours ago












                                            • Are digits in exponents also allowed?
                                              – ouflak
                                              13 hours ago


















                                            • There must not be any digits 0-9 in your code.
                                              – Titus
                                              14 hours ago










                                            • @Titus I can't believe I forgot that. Thanks, fixed!
                                              – Jo King
                                              14 hours ago












                                            • Are digits in exponents also allowed?
                                              – ouflak
                                              13 hours ago
















                                            There must not be any digits 0-9 in your code.
                                            – Titus
                                            14 hours ago




                                            There must not be any digits 0-9 in your code.
                                            – Titus
                                            14 hours ago












                                            @Titus I can't believe I forgot that. Thanks, fixed!
                                            – Jo King
                                            14 hours ago






                                            @Titus I can't believe I forgot that. Thanks, fixed!
                                            – Jo King
                                            14 hours ago














                                            Are digits in exponents also allowed?
                                            – ouflak
                                            13 hours ago




                                            Are digits in exponents also allowed?
                                            – ouflak
                                            13 hours ago










                                            up vote
                                            2
                                            down vote














                                            05AB1E, 6 bytes



                                            ·/žq/î


                                            Port of @flawr's Python 2 comment.

                                            Takes the input in the order radius,distance.



                                            Try it online or verify all test cases.



                                            Explanation:





                                            ·         # Double the first (implicit) input
                                            / # Divide the second (implicit) input by it
                                            žq/ # Divide it by PI
                                            î # Ceil it (and output implicitly)





                                            share|improve this answer

























                                              up vote
                                              2
                                              down vote














                                              05AB1E, 6 bytes



                                              ·/žq/î


                                              Port of @flawr's Python 2 comment.

                                              Takes the input in the order radius,distance.



                                              Try it online or verify all test cases.



                                              Explanation:





                                              ·         # Double the first (implicit) input
                                              / # Divide the second (implicit) input by it
                                              žq/ # Divide it by PI
                                              î # Ceil it (and output implicitly)





                                              share|improve this answer























                                                up vote
                                                2
                                                down vote










                                                up vote
                                                2
                                                down vote










                                                05AB1E, 6 bytes



                                                ·/žq/î


                                                Port of @flawr's Python 2 comment.

                                                Takes the input in the order radius,distance.



                                                Try it online or verify all test cases.



                                                Explanation:





                                                ·         # Double the first (implicit) input
                                                / # Divide the second (implicit) input by it
                                                žq/ # Divide it by PI
                                                î # Ceil it (and output implicitly)





                                                share|improve this answer













                                                05AB1E, 6 bytes



                                                ·/žq/î


                                                Port of @flawr's Python 2 comment.

                                                Takes the input in the order radius,distance.



                                                Try it online or verify all test cases.



                                                Explanation:





                                                ·         # Double the first (implicit) input
                                                / # Divide the second (implicit) input by it
                                                žq/ # Divide it by PI
                                                î # Ceil it (and output implicitly)






                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered 14 hours ago









                                                Kevin Cruijssen

                                                34.4k554182




                                                34.4k554182






















                                                    up vote
                                                    2
                                                    down vote













                                                    C, 46 bytes



                                                    f(float a,float b){return ceil(a/(b+b)/M_PI);}


                                                    I'm new to PPCG, so I'm not sure wether I have to count other parts in the byte count, such as the



                                                    include <math.h>


                                                    needed for the ceil function, which will rise the count to 64 bytes






                                                    share|improve this answer








                                                    New contributor




                                                    bznein is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                    Check out our Code of Conduct.


















                                                    • Welcome to PPCG! This is a nice first answer. Yes, you do need to count #include and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
                                                      – O.O.Balance
                                                      12 hours ago










                                                    • @O.O.Balance Digits are not allowed in the code for this challenge ;)
                                                      – Annyo
                                                      12 hours ago










                                                    • @Annyo I knew I was forgetting something :(
                                                      – O.O.Balance
                                                      12 hours ago















                                                    up vote
                                                    2
                                                    down vote













                                                    C, 46 bytes



                                                    f(float a,float b){return ceil(a/(b+b)/M_PI);}


                                                    I'm new to PPCG, so I'm not sure wether I have to count other parts in the byte count, such as the



                                                    include <math.h>


                                                    needed for the ceil function, which will rise the count to 64 bytes






                                                    share|improve this answer








                                                    New contributor




                                                    bznein is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                    Check out our Code of Conduct.


















                                                    • Welcome to PPCG! This is a nice first answer. Yes, you do need to count #include and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
                                                      – O.O.Balance
                                                      12 hours ago










                                                    • @O.O.Balance Digits are not allowed in the code for this challenge ;)
                                                      – Annyo
                                                      12 hours ago










                                                    • @Annyo I knew I was forgetting something :(
                                                      – O.O.Balance
                                                      12 hours ago













                                                    up vote
                                                    2
                                                    down vote










                                                    up vote
                                                    2
                                                    down vote









                                                    C, 46 bytes



                                                    f(float a,float b){return ceil(a/(b+b)/M_PI);}


                                                    I'm new to PPCG, so I'm not sure wether I have to count other parts in the byte count, such as the



                                                    include <math.h>


                                                    needed for the ceil function, which will rise the count to 64 bytes






                                                    share|improve this answer








                                                    New contributor




                                                    bznein is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                    Check out our Code of Conduct.









                                                    C, 46 bytes



                                                    f(float a,float b){return ceil(a/(b+b)/M_PI);}


                                                    I'm new to PPCG, so I'm not sure wether I have to count other parts in the byte count, such as the



                                                    include <math.h>


                                                    needed for the ceil function, which will rise the count to 64 bytes







                                                    share|improve this answer








                                                    New contributor




                                                    bznein is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                    Check out our Code of Conduct.









                                                    share|improve this answer



                                                    share|improve this answer






                                                    New contributor




                                                    bznein is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                    Check out our Code of Conduct.









                                                    answered 13 hours ago









                                                    bznein

                                                    1212




                                                    1212




                                                    New contributor




                                                    bznein is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                    Check out our Code of Conduct.





                                                    New contributor





                                                    bznein is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                    Check out our Code of Conduct.






                                                    bznein is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                    Check out our Code of Conduct.












                                                    • Welcome to PPCG! This is a nice first answer. Yes, you do need to count #include and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
                                                      – O.O.Balance
                                                      12 hours ago










                                                    • @O.O.Balance Digits are not allowed in the code for this challenge ;)
                                                      – Annyo
                                                      12 hours ago










                                                    • @Annyo I knew I was forgetting something :(
                                                      – O.O.Balance
                                                      12 hours ago


















                                                    • Welcome to PPCG! This is a nice first answer. Yes, you do need to count #include and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
                                                      – O.O.Balance
                                                      12 hours ago










                                                    • @O.O.Balance Digits are not allowed in the code for this challenge ;)
                                                      – Annyo
                                                      12 hours ago










                                                    • @Annyo I knew I was forgetting something :(
                                                      – O.O.Balance
                                                      12 hours ago
















                                                    Welcome to PPCG! This is a nice first answer. Yes, you do need to count #include and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
                                                    – O.O.Balance
                                                    12 hours ago




                                                    Welcome to PPCG! This is a nice first answer. Yes, you do need to count #include and the like towards your byte total. A link to an online test suite is always appreciated, here's one you are free to incorporate into your post: tio.run/…
                                                    – O.O.Balance
                                                    12 hours ago












                                                    @O.O.Balance Digits are not allowed in the code for this challenge ;)
                                                    – Annyo
                                                    12 hours ago




                                                    @O.O.Balance Digits are not allowed in the code for this challenge ;)
                                                    – Annyo
                                                    12 hours ago












                                                    @Annyo I knew I was forgetting something :(
                                                    – O.O.Balance
                                                    12 hours ago




                                                    @Annyo I knew I was forgetting something :(
                                                    – O.O.Balance
                                                    12 hours ago










                                                    up vote
                                                    2
                                                    down vote














                                                    Catholicon, 8 bytes



                                                    ċ//ĊǓĊ`Ė


                                                    Explanation:



                                                      /ĊǓĊ    divide the first input by the doubled second input
                                                    / `Ė divide that by pi
                                                    ċ ceil


                                                    New version (pi builtin made one byte, division parameters swapped), 5 bytes



                                                    ċ/π/Ǔ





                                                    share|improve this answer



























                                                      up vote
                                                      2
                                                      down vote














                                                      Catholicon, 8 bytes



                                                      ċ//ĊǓĊ`Ė


                                                      Explanation:



                                                        /ĊǓĊ    divide the first input by the doubled second input
                                                      / `Ė divide that by pi
                                                      ċ ceil


                                                      New version (pi builtin made one byte, division parameters swapped), 5 bytes



                                                      ċ/π/Ǔ





                                                      share|improve this answer

























                                                        up vote
                                                        2
                                                        down vote










                                                        up vote
                                                        2
                                                        down vote










                                                        Catholicon, 8 bytes



                                                        ċ//ĊǓĊ`Ė


                                                        Explanation:



                                                          /ĊǓĊ    divide the first input by the doubled second input
                                                        / `Ė divide that by pi
                                                        ċ ceil


                                                        New version (pi builtin made one byte, division parameters swapped), 5 bytes



                                                        ċ/π/Ǔ





                                                        share|improve this answer















                                                        Catholicon, 8 bytes



                                                        ċ//ĊǓĊ`Ė


                                                        Explanation:



                                                          /ĊǓĊ    divide the first input by the doubled second input
                                                        / `Ė divide that by pi
                                                        ċ ceil


                                                        New version (pi builtin made one byte, division parameters swapped), 5 bytes



                                                        ċ/π/Ǔ






                                                        share|improve this answer














                                                        share|improve this answer



                                                        share|improve this answer








                                                        edited 13 hours ago

























                                                        answered 13 hours ago









                                                        Okx

                                                        12.4k27100




                                                        12.4k27100






















                                                            up vote
                                                            2
                                                            down vote














                                                            MathGolf, 6 5 bytes



                                                            ∞/π/ü


                                                            Semi-port of @flawr's Python 2 comment.

                                                            Takes the input in the order radius distance.



                                                            -1 byte because ceil builtin has just been added, replacing the floor+1.



                                                            Try it online.



                                                            Explanation:





                                                            ∞        # Double the first (implicit) input
                                                            / # Divide the second (implicit) input by it
                                                            π/ # Divide it by PI
                                                            ü # Ceil (and output implicitly)





                                                            share|improve this answer























                                                            • Nice answer! I'll have to admit, it's my fault that there are no ceil operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
                                                              – maxb
                                                              12 hours ago






                                                            • 4




                                                              I would like to see a proof that "Pi is rational"...
                                                              – Pakk
                                                              12 hours ago






                                                            • 1




                                                              @Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It is ü and works both with numericals and lists
                                                              – maxb
                                                              12 hours ago










                                                            • @maxb That was fast. :D
                                                              – Kevin Cruijssen
                                                              9 hours ago






                                                            • 1




                                                              @Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that the ceil function is added. ;p
                                                              – Kevin Cruijssen
                                                              9 hours ago















                                                            up vote
                                                            2
                                                            down vote














                                                            MathGolf, 6 5 bytes



                                                            ∞/π/ü


                                                            Semi-port of @flawr's Python 2 comment.

                                                            Takes the input in the order radius distance.



                                                            -1 byte because ceil builtin has just been added, replacing the floor+1.



                                                            Try it online.



                                                            Explanation:





                                                            ∞        # Double the first (implicit) input
                                                            / # Divide the second (implicit) input by it
                                                            π/ # Divide it by PI
                                                            ü # Ceil (and output implicitly)





                                                            share|improve this answer























                                                            • Nice answer! I'll have to admit, it's my fault that there are no ceil operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
                                                              – maxb
                                                              12 hours ago






                                                            • 4




                                                              I would like to see a proof that "Pi is rational"...
                                                              – Pakk
                                                              12 hours ago






                                                            • 1




                                                              @Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It is ü and works both with numericals and lists
                                                              – maxb
                                                              12 hours ago










                                                            • @maxb That was fast. :D
                                                              – Kevin Cruijssen
                                                              9 hours ago






                                                            • 1




                                                              @Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that the ceil function is added. ;p
                                                              – Kevin Cruijssen
                                                              9 hours ago













                                                            up vote
                                                            2
                                                            down vote










                                                            up vote
                                                            2
                                                            down vote










                                                            MathGolf, 6 5 bytes



                                                            ∞/π/ü


                                                            Semi-port of @flawr's Python 2 comment.

                                                            Takes the input in the order radius distance.



                                                            -1 byte because ceil builtin has just been added, replacing the floor+1.



                                                            Try it online.



                                                            Explanation:





                                                            ∞        # Double the first (implicit) input
                                                            / # Divide the second (implicit) input by it
                                                            π/ # Divide it by PI
                                                            ü # Ceil (and output implicitly)





                                                            share|improve this answer















                                                            MathGolf, 6 5 bytes



                                                            ∞/π/ü


                                                            Semi-port of @flawr's Python 2 comment.

                                                            Takes the input in the order radius distance.



                                                            -1 byte because ceil builtin has just been added, replacing the floor+1.



                                                            Try it online.



                                                            Explanation:





                                                            ∞        # Double the first (implicit) input
                                                            / # Divide the second (implicit) input by it
                                                            π/ # Divide it by PI
                                                            ü # Ceil (and output implicitly)






                                                            share|improve this answer














                                                            share|improve this answer



                                                            share|improve this answer








                                                            edited 9 hours ago

























                                                            answered 14 hours ago









                                                            Kevin Cruijssen

                                                            34.4k554182




                                                            34.4k554182












                                                            • Nice answer! I'll have to admit, it's my fault that there are no ceil operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
                                                              – maxb
                                                              12 hours ago






                                                            • 4




                                                              I would like to see a proof that "Pi is rational"...
                                                              – Pakk
                                                              12 hours ago






                                                            • 1




                                                              @Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It is ü and works both with numericals and lists
                                                              – maxb
                                                              12 hours ago










                                                            • @maxb That was fast. :D
                                                              – Kevin Cruijssen
                                                              9 hours ago






                                                            • 1




                                                              @Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that the ceil function is added. ;p
                                                              – Kevin Cruijssen
                                                              9 hours ago


















                                                            • Nice answer! I'll have to admit, it's my fault that there are no ceil operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
                                                              – maxb
                                                              12 hours ago






                                                            • 4




                                                              I would like to see a proof that "Pi is rational"...
                                                              – Pakk
                                                              12 hours ago






                                                            • 1




                                                              @Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It is ü and works both with numericals and lists
                                                              – maxb
                                                              12 hours ago










                                                            • @maxb That was fast. :D
                                                              – Kevin Cruijssen
                                                              9 hours ago






                                                            • 1




                                                              @Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that the ceil function is added. ;p
                                                              – Kevin Cruijssen
                                                              9 hours ago
















                                                            Nice answer! I'll have to admit, it's my fault that there are no ceil operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
                                                            – maxb
                                                            12 hours ago




                                                            Nice answer! I'll have to admit, it's my fault that there are no ceil operators (yet). It's still very much a work in progress, and right now I'm working on the implicit input interacting with stack manipulation. One thing which I haven't looked into is that your first division is integer division, which could lead to some strange behavior. Maybe that's what you intended.
                                                            – maxb
                                                            12 hours ago




                                                            4




                                                            4




                                                            I would like to see a proof that "Pi is rational"...
                                                            – Pakk
                                                            12 hours ago




                                                            I would like to see a proof that "Pi is rational"...
                                                            – Pakk
                                                            12 hours ago




                                                            1




                                                            1




                                                            @Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It is ü and works both with numericals and lists
                                                            – maxb
                                                            12 hours ago




                                                            @Pakk strictly speaking any floating point number is rational. Also @KevinCruijssen, I'm happy to announce that MathGolf now has a ceiling operator! It is ü and works both with numericals and lists
                                                            – maxb
                                                            12 hours ago












                                                            @maxb That was fast. :D
                                                            – Kevin Cruijssen
                                                            9 hours ago




                                                            @maxb That was fast. :D
                                                            – Kevin Cruijssen
                                                            9 hours ago




                                                            1




                                                            1




                                                            @Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that the ceil function is added. ;p
                                                            – Kevin Cruijssen
                                                            9 hours ago




                                                            @Pakk Oops.. I mean irrational, lol >.> Luckily has been removed now that the ceil function is added. ;p
                                                            – Kevin Cruijssen
                                                            9 hours ago










                                                            up vote
                                                            1
                                                            down vote













                                                            PHP, 47 bytes



                                                            <?=ceil($argv[++$i]/M_PI/(($b=end($argv))+$b));


                                                            Try it online.






                                                            share|improve this answer



























                                                              up vote
                                                              1
                                                              down vote













                                                              PHP, 47 bytes



                                                              <?=ceil($argv[++$i]/M_PI/(($b=end($argv))+$b));


                                                              Try it online.






                                                              share|improve this answer

























                                                                up vote
                                                                1
                                                                down vote










                                                                up vote
                                                                1
                                                                down vote









                                                                PHP, 47 bytes



                                                                <?=ceil($argv[++$i]/M_PI/(($b=end($argv))+$b));


                                                                Try it online.






                                                                share|improve this answer














                                                                PHP, 47 bytes



                                                                <?=ceil($argv[++$i]/M_PI/(($b=end($argv))+$b));


                                                                Try it online.







                                                                share|improve this answer














                                                                share|improve this answer



                                                                share|improve this answer








                                                                edited 13 hours ago

























                                                                answered 13 hours ago









                                                                Titus

                                                                12.9k11237




                                                                12.9k11237






















                                                                    up vote
                                                                    1
                                                                    down vote














                                                                    Jelly, 6 bytes



                                                                    ÷÷ØPHĊ


                                                                    Try it online!






                                                                    share|improve this answer

























                                                                      up vote
                                                                      1
                                                                      down vote














                                                                      Jelly, 6 bytes



                                                                      ÷÷ØPHĊ


                                                                      Try it online!






                                                                      share|improve this answer























                                                                        up vote
                                                                        1
                                                                        down vote










                                                                        up vote
                                                                        1
                                                                        down vote










                                                                        Jelly, 6 bytes



                                                                        ÷÷ØPHĊ


                                                                        Try it online!






                                                                        share|improve this answer













                                                                        Jelly, 6 bytes



                                                                        ÷÷ØPHĊ


                                                                        Try it online!







                                                                        share|improve this answer












                                                                        share|improve this answer



                                                                        share|improve this answer










                                                                        answered 13 hours ago









                                                                        Erik the Outgolfer

                                                                        30.7k429102




                                                                        30.7k429102






















                                                                            up vote
                                                                            1
                                                                            down vote














                                                                            Ruby, 29 bytes





                                                                            ->l,r{(l/Math::PI/r+=r).ceil}


                                                                            Try it online!






                                                                            share|improve this answer

























                                                                              up vote
                                                                              1
                                                                              down vote














                                                                              Ruby, 29 bytes





                                                                              ->l,r{(l/Math::PI/r+=r).ceil}


                                                                              Try it online!






                                                                              share|improve this answer























                                                                                up vote
                                                                                1
                                                                                down vote










                                                                                up vote
                                                                                1
                                                                                down vote










                                                                                Ruby, 29 bytes





                                                                                ->l,r{(l/Math::PI/r+=r).ceil}


                                                                                Try it online!






                                                                                share|improve this answer













                                                                                Ruby, 29 bytes





                                                                                ->l,r{(l/Math::PI/r+=r).ceil}


                                                                                Try it online!







                                                                                share|improve this answer












                                                                                share|improve this answer



                                                                                share|improve this answer










                                                                                answered 13 hours ago









                                                                                G B

                                                                                7,4761328




                                                                                7,4761328






















                                                                                    up vote
                                                                                    1
                                                                                    down vote














                                                                                    J, 10 9 bytes



                                                                                    >.@%o.@+:


                                                                                    Try it online!






                                                                                    share|improve this answer



























                                                                                      up vote
                                                                                      1
                                                                                      down vote














                                                                                      J, 10 9 bytes



                                                                                      >.@%o.@+:


                                                                                      Try it online!






                                                                                      share|improve this answer

























                                                                                        up vote
                                                                                        1
                                                                                        down vote










                                                                                        up vote
                                                                                        1
                                                                                        down vote










                                                                                        J, 10 9 bytes



                                                                                        >.@%o.@+:


                                                                                        Try it online!






                                                                                        share|improve this answer















                                                                                        J, 10 9 bytes



                                                                                        >.@%o.@+:


                                                                                        Try it online!







                                                                                        share|improve this answer














                                                                                        share|improve this answer



                                                                                        share|improve this answer








                                                                                        edited 12 hours ago

























                                                                                        answered 12 hours ago









                                                                                        Galen Ivanov

                                                                                        5,92711032




                                                                                        5,92711032






















                                                                                            up vote
                                                                                            1
                                                                                            down vote














                                                                                            JavaScript (Babel Node), 25 bytes



                                                                                            -2 bytes using @flawr comment =D. -1 from @Kevin. -7 from @Shaggy





                                                                                            a=>b=>-~(a/(b+b)/Math.PI)


                                                                                            Try it online!






                                                                                            share|improve this answer























                                                                                            • Just a=>b=>Math.ceil(a/(b+b)/Math.PI) is 32 bytes. :)
                                                                                              – Kevin Cruijssen
                                                                                              14 hours ago










                                                                                            • 25 bytes
                                                                                              – Shaggy
                                                                                              10 hours ago















                                                                                            up vote
                                                                                            1
                                                                                            down vote














                                                                                            JavaScript (Babel Node), 25 bytes



                                                                                            -2 bytes using @flawr comment =D. -1 from @Kevin. -7 from @Shaggy





                                                                                            a=>b=>-~(a/(b+b)/Math.PI)


                                                                                            Try it online!






                                                                                            share|improve this answer























                                                                                            • Just a=>b=>Math.ceil(a/(b+b)/Math.PI) is 32 bytes. :)
                                                                                              – Kevin Cruijssen
                                                                                              14 hours ago










                                                                                            • 25 bytes
                                                                                              – Shaggy
                                                                                              10 hours ago













                                                                                            up vote
                                                                                            1
                                                                                            down vote










                                                                                            up vote
                                                                                            1
                                                                                            down vote










                                                                                            JavaScript (Babel Node), 25 bytes



                                                                                            -2 bytes using @flawr comment =D. -1 from @Kevin. -7 from @Shaggy





                                                                                            a=>b=>-~(a/(b+b)/Math.PI)


                                                                                            Try it online!






                                                                                            share|improve this answer















                                                                                            JavaScript (Babel Node), 25 bytes



                                                                                            -2 bytes using @flawr comment =D. -1 from @Kevin. -7 from @Shaggy





                                                                                            a=>b=>-~(a/(b+b)/Math.PI)


                                                                                            Try it online!







                                                                                            share|improve this answer














                                                                                            share|improve this answer



                                                                                            share|improve this answer








                                                                                            edited 9 hours ago

























                                                                                            answered 14 hours ago









                                                                                            Luis felipe De jesus Munoz

                                                                                            4,00421253




                                                                                            4,00421253












                                                                                            • Just a=>b=>Math.ceil(a/(b+b)/Math.PI) is 32 bytes. :)
                                                                                              – Kevin Cruijssen
                                                                                              14 hours ago










                                                                                            • 25 bytes
                                                                                              – Shaggy
                                                                                              10 hours ago


















                                                                                            • Just a=>b=>Math.ceil(a/(b+b)/Math.PI) is 32 bytes. :)
                                                                                              – Kevin Cruijssen
                                                                                              14 hours ago










                                                                                            • 25 bytes
                                                                                              – Shaggy
                                                                                              10 hours ago
















                                                                                            Just a=>b=>Math.ceil(a/(b+b)/Math.PI) is 32 bytes. :)
                                                                                            – Kevin Cruijssen
                                                                                            14 hours ago




                                                                                            Just a=>b=>Math.ceil(a/(b+b)/Math.PI) is 32 bytes. :)
                                                                                            – Kevin Cruijssen
                                                                                            14 hours ago












                                                                                            25 bytes
                                                                                            – Shaggy
                                                                                            10 hours ago




                                                                                            25 bytes
                                                                                            – Shaggy
                                                                                            10 hours ago










                                                                                            up vote
                                                                                            1
                                                                                            down vote














                                                                                            Julia 1.0, 20 bytes





                                                                                            f(d,r)=cld(d/π,r+r)


                                                                                            Try it online!






                                                                                            share|improve this answer























                                                                                            • fixed..........
                                                                                              – gggg
                                                                                              6 hours ago















                                                                                            up vote
                                                                                            1
                                                                                            down vote














                                                                                            Julia 1.0, 20 bytes





                                                                                            f(d,r)=cld(d/π,r+r)


                                                                                            Try it online!






                                                                                            share|improve this answer























                                                                                            • fixed..........
                                                                                              – gggg
                                                                                              6 hours ago













                                                                                            up vote
                                                                                            1
                                                                                            down vote










                                                                                            up vote
                                                                                            1
                                                                                            down vote










                                                                                            Julia 1.0, 20 bytes





                                                                                            f(d,r)=cld(d/π,r+r)


                                                                                            Try it online!






                                                                                            share|improve this answer















                                                                                            Julia 1.0, 20 bytes





                                                                                            f(d,r)=cld(d/π,r+r)


                                                                                            Try it online!







                                                                                            share|improve this answer














                                                                                            share|improve this answer



                                                                                            share|improve this answer








                                                                                            edited 6 hours ago

























                                                                                            answered 8 hours ago









                                                                                            gggg

                                                                                            1,21656




                                                                                            1,21656












                                                                                            • fixed..........
                                                                                              – gggg
                                                                                              6 hours ago


















                                                                                            • fixed..........
                                                                                              – gggg
                                                                                              6 hours ago
















                                                                                            fixed..........
                                                                                            – gggg
                                                                                            6 hours ago




                                                                                            fixed..........
                                                                                            – gggg
                                                                                            6 hours ago










                                                                                            up vote
                                                                                            1
                                                                                            down vote














                                                                                            R, 39 32 bytes



                                                                                            -7 bytes Thanks to Giuseppe





                                                                                            function(d,r)ceiling(d/(r+r)/pi)


                                                                                            Try it online!



                                                                                            I feel like this could definitely be golfed, but I am a bit lazy right now to do anything about it






                                                                                            share|improve this answer



























                                                                                              up vote
                                                                                              1
                                                                                              down vote














                                                                                              R, 39 32 bytes



                                                                                              -7 bytes Thanks to Giuseppe





                                                                                              function(d,r)ceiling(d/(r+r)/pi)


                                                                                              Try it online!



                                                                                              I feel like this could definitely be golfed, but I am a bit lazy right now to do anything about it






                                                                                              share|improve this answer

























                                                                                                up vote
                                                                                                1
                                                                                                down vote










                                                                                                up vote
                                                                                                1
                                                                                                down vote










                                                                                                R, 39 32 bytes



                                                                                                -7 bytes Thanks to Giuseppe





                                                                                                function(d,r)ceiling(d/(r+r)/pi)


                                                                                                Try it online!



                                                                                                I feel like this could definitely be golfed, but I am a bit lazy right now to do anything about it






                                                                                                share|improve this answer















                                                                                                R, 39 32 bytes



                                                                                                -7 bytes Thanks to Giuseppe





                                                                                                function(d,r)ceiling(d/(r+r)/pi)


                                                                                                Try it online!



                                                                                                I feel like this could definitely be golfed, but I am a bit lazy right now to do anything about it







                                                                                                share|improve this answer














                                                                                                share|improve this answer



                                                                                                share|improve this answer








                                                                                                edited 5 hours ago

























                                                                                                answered 7 hours ago









                                                                                                Sumner18

                                                                                                3015




                                                                                                3015






















                                                                                                    up vote
                                                                                                    0
                                                                                                    down vote














                                                                                                    Lua, 61 58 57 bytes





                                                                                                    s=io.read()r=io.read()print(math.ceil((s/(r+r))/math.pi))


                                                                                                    Try it online!



                                                                                                    The inputs must be separated by a newline. I'm looking at how to read an array in LUA.
                                                                                                    edit: Several ways, but nothing that saves bytes....






                                                                                                    share|improve this answer



























                                                                                                      up vote
                                                                                                      0
                                                                                                      down vote














                                                                                                      Lua, 61 58 57 bytes





                                                                                                      s=io.read()r=io.read()print(math.ceil((s/(r+r))/math.pi))


                                                                                                      Try it online!



                                                                                                      The inputs must be separated by a newline. I'm looking at how to read an array in LUA.
                                                                                                      edit: Several ways, but nothing that saves bytes....






                                                                                                      share|improve this answer

























                                                                                                        up vote
                                                                                                        0
                                                                                                        down vote










                                                                                                        up vote
                                                                                                        0
                                                                                                        down vote










                                                                                                        Lua, 61 58 57 bytes





                                                                                                        s=io.read()r=io.read()print(math.ceil((s/(r+r))/math.pi))


                                                                                                        Try it online!



                                                                                                        The inputs must be separated by a newline. I'm looking at how to read an array in LUA.
                                                                                                        edit: Several ways, but nothing that saves bytes....






                                                                                                        share|improve this answer















                                                                                                        Lua, 61 58 57 bytes





                                                                                                        s=io.read()r=io.read()print(math.ceil((s/(r+r))/math.pi))


                                                                                                        Try it online!



                                                                                                        The inputs must be separated by a newline. I'm looking at how to read an array in LUA.
                                                                                                        edit: Several ways, but nothing that saves bytes....







                                                                                                        share|improve this answer














                                                                                                        share|improve this answer



                                                                                                        share|improve this answer








                                                                                                        edited 11 hours ago

























                                                                                                        answered 12 hours ago









                                                                                                        ouflak

                                                                                                        15129




                                                                                                        15129






















                                                                                                            up vote
                                                                                                            0
                                                                                                            down vote













                                                                                                            Japt, 7 bytes



                                                                                                            /MT/V c


                                                                                                            Try it here






                                                                                                            share|improve this answer

























                                                                                                              up vote
                                                                                                              0
                                                                                                              down vote













                                                                                                              Japt, 7 bytes



                                                                                                              /MT/V c


                                                                                                              Try it here






                                                                                                              share|improve this answer























                                                                                                                up vote
                                                                                                                0
                                                                                                                down vote










                                                                                                                up vote
                                                                                                                0
                                                                                                                down vote









                                                                                                                Japt, 7 bytes



                                                                                                                /MT/V c


                                                                                                                Try it here






                                                                                                                share|improve this answer












                                                                                                                Japt, 7 bytes



                                                                                                                /MT/V c


                                                                                                                Try it here







                                                                                                                share|improve this answer












                                                                                                                share|improve this answer



                                                                                                                share|improve this answer










                                                                                                                answered 10 hours ago









                                                                                                                Shaggy

                                                                                                                18.1k21663




                                                                                                                18.1k21663






















                                                                                                                    up vote
                                                                                                                    0
                                                                                                                    down vote














                                                                                                                    Stax, 5 bytes



                                                                                                                    Vt*/e


                                                                                                                    Run and debug it



                                                                                                                    Vt*   multiply by tau (2pi)
                                                                                                                    / divide
                                                                                                                    e ceiling





                                                                                                                    share|improve this answer

























                                                                                                                      up vote
                                                                                                                      0
                                                                                                                      down vote














                                                                                                                      Stax, 5 bytes



                                                                                                                      Vt*/e


                                                                                                                      Run and debug it



                                                                                                                      Vt*   multiply by tau (2pi)
                                                                                                                      / divide
                                                                                                                      e ceiling





                                                                                                                      share|improve this answer























                                                                                                                        up vote
                                                                                                                        0
                                                                                                                        down vote










                                                                                                                        up vote
                                                                                                                        0
                                                                                                                        down vote










                                                                                                                        Stax, 5 bytes



                                                                                                                        Vt*/e


                                                                                                                        Run and debug it



                                                                                                                        Vt*   multiply by tau (2pi)
                                                                                                                        / divide
                                                                                                                        e ceiling





                                                                                                                        share|improve this answer













                                                                                                                        Stax, 5 bytes



                                                                                                                        Vt*/e


                                                                                                                        Run and debug it



                                                                                                                        Vt*   multiply by tau (2pi)
                                                                                                                        / divide
                                                                                                                        e ceiling






                                                                                                                        share|improve this answer












                                                                                                                        share|improve this answer



                                                                                                                        share|improve this answer










                                                                                                                        answered 10 hours ago









                                                                                                                        recursive

                                                                                                                        4,9741221




                                                                                                                        4,9741221






















                                                                                                                            up vote
                                                                                                                            0
                                                                                                                            down vote














                                                                                                                            C (gcc), 45 47 45 bytes





                                                                                                                            f(d,r,R)float d,r;{R=ceil(d/r/'G'/'n'*'q');}


                                                                                                                            A reasonable approximation of pi is 355/113. Since circumference C = 2 * r * PI, we can instead of pi use tau, which is then of course ~710/113. 710 happens to have the convenient factors 2 * 5 * 71, which is compactly expressed as 'G' * 'n'. We add one (r/r) to force rounding to infinity.



                                                                                                                            Edit: My trick was too clever for its own good: it of course made it fail if the distance was a multiple of the circumference.



                                                                                                                            Try it online!






                                                                                                                            share|improve this answer



























                                                                                                                              up vote
                                                                                                                              0
                                                                                                                              down vote














                                                                                                                              C (gcc), 45 47 45 bytes





                                                                                                                              f(d,r,R)float d,r;{R=ceil(d/r/'G'/'n'*'q');}


                                                                                                                              A reasonable approximation of pi is 355/113. Since circumference C = 2 * r * PI, we can instead of pi use tau, which is then of course ~710/113. 710 happens to have the convenient factors 2 * 5 * 71, which is compactly expressed as 'G' * 'n'. We add one (r/r) to force rounding to infinity.



                                                                                                                              Edit: My trick was too clever for its own good: it of course made it fail if the distance was a multiple of the circumference.



                                                                                                                              Try it online!






                                                                                                                              share|improve this answer

























                                                                                                                                up vote
                                                                                                                                0
                                                                                                                                down vote










                                                                                                                                up vote
                                                                                                                                0
                                                                                                                                down vote










                                                                                                                                C (gcc), 45 47 45 bytes





                                                                                                                                f(d,r,R)float d,r;{R=ceil(d/r/'G'/'n'*'q');}


                                                                                                                                A reasonable approximation of pi is 355/113. Since circumference C = 2 * r * PI, we can instead of pi use tau, which is then of course ~710/113. 710 happens to have the convenient factors 2 * 5 * 71, which is compactly expressed as 'G' * 'n'. We add one (r/r) to force rounding to infinity.



                                                                                                                                Edit: My trick was too clever for its own good: it of course made it fail if the distance was a multiple of the circumference.



                                                                                                                                Try it online!






                                                                                                                                share|improve this answer















                                                                                                                                C (gcc), 45 47 45 bytes





                                                                                                                                f(d,r,R)float d,r;{R=ceil(d/r/'G'/'n'*'q');}


                                                                                                                                A reasonable approximation of pi is 355/113. Since circumference C = 2 * r * PI, we can instead of pi use tau, which is then of course ~710/113. 710 happens to have the convenient factors 2 * 5 * 71, which is compactly expressed as 'G' * 'n'. We add one (r/r) to force rounding to infinity.



                                                                                                                                Edit: My trick was too clever for its own good: it of course made it fail if the distance was a multiple of the circumference.



                                                                                                                                Try it online!







                                                                                                                                share|improve this answer














                                                                                                                                share|improve this answer



                                                                                                                                share|improve this answer








                                                                                                                                edited 9 hours ago

























                                                                                                                                answered 9 hours ago









                                                                                                                                gastropner

                                                                                                                                1,8201410




                                                                                                                                1,8201410






























                                                                                                                                     

                                                                                                                                    draft saved


                                                                                                                                    draft discarded



















































                                                                                                                                     


                                                                                                                                    draft saved


                                                                                                                                    draft discarded














                                                                                                                                    StackExchange.ready(
                                                                                                                                    function () {
                                                                                                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f176328%2fnumber-of-rotations%23new-answer', 'question_page');
                                                                                                                                    }
                                                                                                                                    );

                                                                                                                                    Post as a guest















                                                                                                                                    Required, but never shown





















































                                                                                                                                    Required, but never shown














                                                                                                                                    Required, but never shown












                                                                                                                                    Required, but never shown







                                                                                                                                    Required, but never shown

































                                                                                                                                    Required, but never shown














                                                                                                                                    Required, but never shown












                                                                                                                                    Required, but never shown







                                                                                                                                    Required, but never shown







                                                                                                                                    Popular posts from this blog

                                                                                                                                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                                                                                                                                    Calculate evaluation metrics using cross_val_predict sklearn

                                                                                                                                    Insert data from modal to MySQL (multiple modal on website)