Number of rotations











up vote
7
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




















  • 4




    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
    2 days ago

















up vote
7
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




















  • 4




    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
    2 days ago















up vote
7
down vote

favorite
1









up vote
7
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 yesterday









Dennis

184k32295731




184k32295731










asked 2 days ago









Vedant Kandoi

59617




59617








  • 4




    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
    2 days ago
















  • 4




    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
    2 days ago










4




4




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
2 days 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
2 days ago












29 Answers
29






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
    4
    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























    • ⌈⎕÷○+⍨⎕ works for 7 bytes.
      – J. Sallé
      yesterday










    • @J.Sallé Thanks but unfortunately my ancient APL+WIN interpreter does not have the ⍨ operator
      – Graham
      yesterday


















    up vote
    4
    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
      2 days ago






    • 4




      @ouflak Looks like it can be fixed like this.
      – Erik the Outgolfer
      2 days 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
      2 days ago




















    up vote
    4
    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
      2 days ago










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












    • Are digits in exponents also allowed?
      – ouflak
      2 days 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
      2 days ago










    • @JonathanAllan Thanks :)
      – TFeld
      2 days 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
        2 days ago










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










      • @Annyo I knew I was forgetting something :(
        – O.O.Balance
        2 days 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














        Stax, 5 bytes



        Vt*/e


        Run and debug it



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





        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






























            up vote
            2
            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
              2
              down vote














              Julia 1.0, 20 bytes





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


              Try it online!






              share|improve this answer






























                up vote
                2
                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













                  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













                          Japt, 7 bytes



                          /MT/V c


                          Try it here






                          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
                              2 days ago










                            • 25 bytes
                              – Shaggy
                              2 days ago


















                            up vote
                            1
                            down vote














                            min, 16 bytes



                            / tau / ceil int


                            Takes the distance and radius put on the stack in that order. Then divides by tau, rounds, and makes int.






                            share|improve this answer




























                              up vote
                              1
                              down vote














                              Dart, 47 46 bytes



                              import'dart:math';f(a,b)=>(a/(b+b)/pi).ceil();


                              Try it online!




                              • -1 byte thanks to @Shaggy






                              share|improve this answer























                              • 46 bytes
                                – Shaggy
                                yesterday


















                              up vote
                              1
                              down vote













                              JavaScript (Babel Node), 23 bytes



                              s=>r=>-~(s/2/r/Math.PI)


                              Try it online!






                              share|improve this answer

















                              • 2




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


















                              up vote
                              1
                              down vote













                              Haskell, 25 bytes



                              f d r=ceiling(d/(r+r)/pi)





                              share|improve this answer










                              New contributor




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

























                                up vote
                                1
                                down vote














                                Lua, 61 58 57 49 bytes





                                function(s,r)return math.ceil(s/(r+r)/math.pi)end


                                Try it online!



                                Thanks to KirillL. -8 bytes.






                                share|improve this answer























                                • I don't know much Lua (so maybe it's still too long), but it appears to be shorter as a function: 49 bytes
                                  – Kirill L.
                                  yesterday










                                • @KirillL., I'm still learning the rules here. The OP's challenge is pretty open on the input. So my question is, would we have to count your program call() against the byte count? If not, your's definitely shaves off a nice chunk.
                                  – ouflak
                                  yesterday










                                • A quite common style of submission here is an anonymous function (so that we don't have to count the name, unless it is recursive), which outputs by its return value. The footer section with function calls and actual printing to console is then basically used for visualizing the results and doesn't count towards your score. BTW, you may add more of the OP's test examples to the footer, so that they can be conveniently viewed all at once. Note that in some cases a full program may actually turn out to be golfier!
                                  – Kirill L.
                                  yesterday




















                                up vote
                                1
                                down vote













                                Common Lisp, 36 bytes



                                (lambda(a b)(ceiling(/ a(+ b b)pi)))


                                Try it online!






                                share|improve this answer






























                                  up vote
                                  1
                                  down vote














                                  Tcl, 50 bytes



                                  proc N d r {expr ceil($d/(($r+$r)*acos(-$r/$r)))}


                                  Try it online!








                                  Tcl, 53 bytes



                                  proc N d r {expr ceil($d/(($r+$r)*acos(-[incr i])))}


                                  Try it online!





                                  Lack of a pi constant or function makes me lose the golf competition!






                                  share|improve this answer























                                  • Do I need to remove the .0 at end of each output? It would make me consume more bytes!
                                    – sergiol
                                    yesterday








                                  • 1




                                    [incr i] is quite clever but I think you can use $d/$d or $r/$r instead.
                                    – david
                                    yesterday










                                  • Saved some bytes thanks to @david's idea!
                                    – sergiol
                                    yesterday


















                                  up vote
                                  0
                                  down vote













                                  Mathematica, 8 bytes



                                   #/(2π r)&


                                  So that



                                  r =22.9;
                                  #/(2π r)& @ 32


                                  gives



                                  (* 0.2224 *)






                                  share|improve this answer



















                                  • 1




                                    There must not be any digits 0-9 in your code. Also, could you please show how to call your function, maybe in an online interpreter like tio.run/#mathematica? I'm not sure how to supply the r.
                                    – Dennis
                                    yesterday


















                                  up vote
                                  0
                                  down vote














                                  Clojure, 50 bytes





                                  (fn[a b](int(Math/ceil(/ a Math/PI(count"  ")b))))


                                  An anonymous function that accepts two integers a and b as arguments: the distance and the wheel's radius, respectively.



                                  Try it online!



                                  (count " ") evaluates to 2, so this function implements $lceil dfrac a{2pi b} rceil$.






                                  share|improve this answer




























                                    up vote
                                    0
                                    down vote













                                    PowerShell, 53 bytes



                                    param($d,$r);$a=[math];$a::ceiling($d/($r+$r)/$a::pi)


                                    Takes input from two commandline parameters, distance -d and radius -r.






                                    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

























                                      29 Answers
                                      29






                                      active

                                      oldest

                                      votes








                                      29 Answers
                                      29






                                      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 2 days ago

























                                          answered 2 days ago









                                          maxb

                                          2,1081923




                                          2,1081923






















                                              up vote
                                              4
                                              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























                                              • ⌈⎕÷○+⍨⎕ works for 7 bytes.
                                                – J. Sallé
                                                yesterday










                                              • @J.Sallé Thanks but unfortunately my ancient APL+WIN interpreter does not have the ⍨ operator
                                                – Graham
                                                yesterday















                                              up vote
                                              4
                                              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























                                              • ⌈⎕÷○+⍨⎕ works for 7 bytes.
                                                – J. Sallé
                                                yesterday










                                              • @J.Sallé Thanks but unfortunately my ancient APL+WIN interpreter does not have the ⍨ operator
                                                – Graham
                                                yesterday













                                              up vote
                                              4
                                              down vote










                                              up vote
                                              4
                                              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 2 days ago

























                                              answered 2 days ago









                                              Graham

                                              2,12668




                                              2,12668












                                              • ⌈⎕÷○+⍨⎕ works for 7 bytes.
                                                – J. Sallé
                                                yesterday










                                              • @J.Sallé Thanks but unfortunately my ancient APL+WIN interpreter does not have the ⍨ operator
                                                – Graham
                                                yesterday


















                                              • ⌈⎕÷○+⍨⎕ works for 7 bytes.
                                                – J. Sallé
                                                yesterday










                                              • @J.Sallé Thanks but unfortunately my ancient APL+WIN interpreter does not have the ⍨ operator
                                                – Graham
                                                yesterday
















                                              ⌈⎕÷○+⍨⎕ works for 7 bytes.
                                              – J. Sallé
                                              yesterday




                                              ⌈⎕÷○+⍨⎕ works for 7 bytes.
                                              – J. Sallé
                                              yesterday












                                              @J.Sallé Thanks but unfortunately my ancient APL+WIN interpreter does not have the ⍨ operator
                                              – Graham
                                              yesterday




                                              @J.Sallé Thanks but unfortunately my ancient APL+WIN interpreter does not have the ⍨ operator
                                              – Graham
                                              yesterday










                                              up vote
                                              4
                                              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
                                                2 days ago






                                              • 4




                                                @ouflak Looks like it can be fixed like this.
                                                – Erik the Outgolfer
                                                2 days 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
                                                2 days ago

















                                              up vote
                                              4
                                              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
                                                2 days ago






                                              • 4




                                                @ouflak Looks like it can be fixed like this.
                                                – Erik the Outgolfer
                                                2 days 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
                                                2 days ago















                                              up vote
                                              4
                                              down vote










                                              up vote
                                              4
                                              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 2 days ago

























                                              answered 2 days ago









                                              Kevin Cruijssen

                                              34.4k554182




                                              34.4k554182












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






                                              • 4




                                                @ouflak Looks like it can be fixed like this.
                                                – Erik the Outgolfer
                                                2 days 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
                                                2 days ago




















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






                                              • 4




                                                @ouflak Looks like it can be fixed like this.
                                                – Erik the Outgolfer
                                                2 days 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
                                                2 days ago


















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




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




                                              4




                                              4




                                              @ouflak Looks like it can be fixed like this.
                                              – Erik the Outgolfer
                                              2 days ago




                                              @ouflak Looks like it can be fixed like this.
                                              – Erik the Outgolfer
                                              2 days 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
                                              2 days 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
                                              2 days ago












                                              up vote
                                              4
                                              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
                                                2 days ago










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












                                              • Are digits in exponents also allowed?
                                                – ouflak
                                                2 days ago















                                              up vote
                                              4
                                              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
                                                2 days ago










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












                                              • Are digits in exponents also allowed?
                                                – ouflak
                                                2 days ago













                                              up vote
                                              4
                                              down vote










                                              up vote
                                              4
                                              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 2 days ago

























                                              answered 2 days ago









                                              Jo King

                                              19.3k245102




                                              19.3k245102












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










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












                                              • Are digits in exponents also allowed?
                                                – ouflak
                                                2 days ago


















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










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












                                              • Are digits in exponents also allowed?
                                                – ouflak
                                                2 days ago
















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




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












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






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














                                              Are digits in exponents also allowed?
                                              – ouflak
                                              2 days ago




                                              Are digits in exponents also allowed?
                                              – ouflak
                                              2 days 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
                                                2 days ago










                                              • @JonathanAllan Thanks :)
                                                – TFeld
                                                2 days 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
                                                2 days ago










                                              • @JonathanAllan Thanks :)
                                                – TFeld
                                                2 days 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 2 days ago

























                                              answered 2 days ago









                                              TFeld

                                              13.7k21139




                                              13.7k21139












                                              • 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
                                                2 days ago










                                              • @JonathanAllan Thanks :)
                                                – TFeld
                                                2 days 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
                                                2 days ago










                                              • @JonathanAllan Thanks :)
                                                – TFeld
                                                2 days 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
                                              2 days 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
                                              2 days ago












                                              @JonathanAllan Thanks :)
                                              – TFeld
                                              2 days ago




                                              @JonathanAllan Thanks :)
                                              – TFeld
                                              2 days 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 2 days 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
                                                        2 days ago










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










                                                      • @Annyo I knew I was forgetting something :(
                                                        – O.O.Balance
                                                        2 days 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
                                                        2 days ago










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










                                                      • @Annyo I knew I was forgetting something :(
                                                        – O.O.Balance
                                                        2 days 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 2 days 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
                                                        2 days ago










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










                                                      • @Annyo I knew I was forgetting something :(
                                                        – O.O.Balance
                                                        2 days 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
                                                        2 days ago










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










                                                      • @Annyo I knew I was forgetting something :(
                                                        – O.O.Balance
                                                        2 days 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
                                                      2 days 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
                                                      2 days ago












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




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












                                                      @Annyo I knew I was forgetting something :(
                                                      – O.O.Balance
                                                      2 days ago




                                                      @Annyo I knew I was forgetting something :(
                                                      – O.O.Balance
                                                      2 days 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 2 days ago

























                                                          answered 2 days ago









                                                          Okx

                                                          12.4k27100




                                                          12.4k27100






















                                                              up vote
                                                              2
                                                              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
                                                                2
                                                                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
                                                                  2
                                                                  down vote










                                                                  up vote
                                                                  2
                                                                  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 2 days ago









                                                                  recursive

                                                                  4,9941221




                                                                  4,9941221






















                                                                      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



























                                                                        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

























                                                                          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 2 days ago

























                                                                          answered 2 days ago









                                                                          Kevin Cruijssen

                                                                          34.4k554182




                                                                          34.4k554182






















                                                                              up vote
                                                                              2
                                                                              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
                                                                                2
                                                                                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
                                                                                  2
                                                                                  down vote










                                                                                  up vote
                                                                                  2
                                                                                  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 2 days ago

























                                                                                  answered 2 days ago









                                                                                  gastropner

                                                                                  1,8401410




                                                                                  1,8401410






















                                                                                      up vote
                                                                                      2
                                                                                      down vote














                                                                                      Julia 1.0, 20 bytes





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


                                                                                      Try it online!






                                                                                      share|improve this answer



























                                                                                        up vote
                                                                                        2
                                                                                        down vote














                                                                                        Julia 1.0, 20 bytes





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


                                                                                        Try it online!






                                                                                        share|improve this answer

























                                                                                          up vote
                                                                                          2
                                                                                          down vote










                                                                                          up vote
                                                                                          2
                                                                                          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 2 days ago

























                                                                                          answered 2 days ago









                                                                                          gggg

                                                                                          1,22656




                                                                                          1,22656






















                                                                                              up vote
                                                                                              2
                                                                                              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
                                                                                                2
                                                                                                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
                                                                                                  2
                                                                                                  down vote










                                                                                                  up vote
                                                                                                  2
                                                                                                  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 2 days ago

























                                                                                                  answered 2 days ago









                                                                                                  Sumner18

                                                                                                  3115




                                                                                                  3115






















                                                                                                      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 2 days ago

























                                                                                                          answered 2 days 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 2 days 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 2 days ago









                                                                                                                          G B

                                                                                                                          7,5561328




                                                                                                                          7,5561328






















                                                                                                                              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 2 days ago

























                                                                                                                                  answered 2 days ago









                                                                                                                                  Galen Ivanov

                                                                                                                                  5,94711032




                                                                                                                                  5,94711032






















                                                                                                                                      up vote
                                                                                                                                      1
                                                                                                                                      down vote













                                                                                                                                      Japt, 7 bytes



                                                                                                                                      /MT/V c


                                                                                                                                      Try it here






                                                                                                                                      share|improve this answer

























                                                                                                                                        up vote
                                                                                                                                        1
                                                                                                                                        down vote













                                                                                                                                        Japt, 7 bytes



                                                                                                                                        /MT/V c


                                                                                                                                        Try it here






                                                                                                                                        share|improve this answer























                                                                                                                                          up vote
                                                                                                                                          1
                                                                                                                                          down vote










                                                                                                                                          up vote
                                                                                                                                          1
                                                                                                                                          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 2 days ago









                                                                                                                                          Shaggy

                                                                                                                                          18.2k21663




                                                                                                                                          18.2k21663






















                                                                                                                                              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
                                                                                                                                                2 days ago










                                                                                                                                              • 25 bytes
                                                                                                                                                – Shaggy
                                                                                                                                                2 days 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
                                                                                                                                                2 days ago










                                                                                                                                              • 25 bytes
                                                                                                                                                – Shaggy
                                                                                                                                                2 days 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 2 days ago

























                                                                                                                                              answered 2 days ago









                                                                                                                                              Luis felipe De jesus Munoz

                                                                                                                                              4,01421253




                                                                                                                                              4,01421253












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










                                                                                                                                              • 25 bytes
                                                                                                                                                – Shaggy
                                                                                                                                                2 days ago


















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










                                                                                                                                              • 25 bytes
                                                                                                                                                – Shaggy
                                                                                                                                                2 days ago
















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




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












                                                                                                                                              25 bytes
                                                                                                                                              – Shaggy
                                                                                                                                              2 days ago




                                                                                                                                              25 bytes
                                                                                                                                              – Shaggy
                                                                                                                                              2 days ago










                                                                                                                                              up vote
                                                                                                                                              1
                                                                                                                                              down vote














                                                                                                                                              min, 16 bytes



                                                                                                                                              / tau / ceil int


                                                                                                                                              Takes the distance and radius put on the stack in that order. Then divides by tau, rounds, and makes int.






                                                                                                                                              share|improve this answer

























                                                                                                                                                up vote
                                                                                                                                                1
                                                                                                                                                down vote














                                                                                                                                                min, 16 bytes



                                                                                                                                                / tau / ceil int


                                                                                                                                                Takes the distance and radius put on the stack in that order. Then divides by tau, rounds, and makes int.






                                                                                                                                                share|improve this answer























                                                                                                                                                  up vote
                                                                                                                                                  1
                                                                                                                                                  down vote










                                                                                                                                                  up vote
                                                                                                                                                  1
                                                                                                                                                  down vote










                                                                                                                                                  min, 16 bytes



                                                                                                                                                  / tau / ceil int


                                                                                                                                                  Takes the distance and radius put on the stack in that order. Then divides by tau, rounds, and makes int.






                                                                                                                                                  share|improve this answer













                                                                                                                                                  min, 16 bytes



                                                                                                                                                  / tau / ceil int


                                                                                                                                                  Takes the distance and radius put on the stack in that order. Then divides by tau, rounds, and makes int.







                                                                                                                                                  share|improve this answer












                                                                                                                                                  share|improve this answer



                                                                                                                                                  share|improve this answer










                                                                                                                                                  answered yesterday









                                                                                                                                                  Panda0nEarth

                                                                                                                                                  1013




                                                                                                                                                  1013






















                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote














                                                                                                                                                      Dart, 47 46 bytes



                                                                                                                                                      import'dart:math';f(a,b)=>(a/(b+b)/pi).ceil();


                                                                                                                                                      Try it online!




                                                                                                                                                      • -1 byte thanks to @Shaggy






                                                                                                                                                      share|improve this answer























                                                                                                                                                      • 46 bytes
                                                                                                                                                        – Shaggy
                                                                                                                                                        yesterday















                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote














                                                                                                                                                      Dart, 47 46 bytes



                                                                                                                                                      import'dart:math';f(a,b)=>(a/(b+b)/pi).ceil();


                                                                                                                                                      Try it online!




                                                                                                                                                      • -1 byte thanks to @Shaggy






                                                                                                                                                      share|improve this answer























                                                                                                                                                      • 46 bytes
                                                                                                                                                        – Shaggy
                                                                                                                                                        yesterday













                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote










                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote










                                                                                                                                                      Dart, 47 46 bytes



                                                                                                                                                      import'dart:math';f(a,b)=>(a/(b+b)/pi).ceil();


                                                                                                                                                      Try it online!




                                                                                                                                                      • -1 byte thanks to @Shaggy






                                                                                                                                                      share|improve this answer















                                                                                                                                                      Dart, 47 46 bytes



                                                                                                                                                      import'dart:math';f(a,b)=>(a/(b+b)/pi).ceil();


                                                                                                                                                      Try it online!




                                                                                                                                                      • -1 byte thanks to @Shaggy







                                                                                                                                                      share|improve this answer














                                                                                                                                                      share|improve this answer



                                                                                                                                                      share|improve this answer








                                                                                                                                                      edited yesterday

























                                                                                                                                                      answered yesterday









                                                                                                                                                      Elcan

                                                                                                                                                      29115




                                                                                                                                                      29115












                                                                                                                                                      • 46 bytes
                                                                                                                                                        – Shaggy
                                                                                                                                                        yesterday


















                                                                                                                                                      • 46 bytes
                                                                                                                                                        – Shaggy
                                                                                                                                                        yesterday
















                                                                                                                                                      46 bytes
                                                                                                                                                      – Shaggy
                                                                                                                                                      yesterday




                                                                                                                                                      46 bytes
                                                                                                                                                      – Shaggy
                                                                                                                                                      yesterday










                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote













                                                                                                                                                      JavaScript (Babel Node), 23 bytes



                                                                                                                                                      s=>r=>-~(s/2/r/Math.PI)


                                                                                                                                                      Try it online!






                                                                                                                                                      share|improve this answer

















                                                                                                                                                      • 2




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















                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote













                                                                                                                                                      JavaScript (Babel Node), 23 bytes



                                                                                                                                                      s=>r=>-~(s/2/r/Math.PI)


                                                                                                                                                      Try it online!






                                                                                                                                                      share|improve this answer

















                                                                                                                                                      • 2




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













                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote










                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote









                                                                                                                                                      JavaScript (Babel Node), 23 bytes



                                                                                                                                                      s=>r=>-~(s/2/r/Math.PI)


                                                                                                                                                      Try it online!






                                                                                                                                                      share|improve this answer












                                                                                                                                                      JavaScript (Babel Node), 23 bytes



                                                                                                                                                      s=>r=>-~(s/2/r/Math.PI)


                                                                                                                                                      Try it online!







                                                                                                                                                      share|improve this answer












                                                                                                                                                      share|improve this answer



                                                                                                                                                      share|improve this answer










                                                                                                                                                      answered yesterday









                                                                                                                                                      Igor Sowinski

                                                                                                                                                      211




                                                                                                                                                      211








                                                                                                                                                      • 2




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














                                                                                                                                                      • 2




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








                                                                                                                                                      2




                                                                                                                                                      2




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




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










                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote













                                                                                                                                                      Haskell, 25 bytes



                                                                                                                                                      f d r=ceiling(d/(r+r)/pi)





                                                                                                                                                      share|improve this answer










                                                                                                                                                      New contributor




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






















                                                                                                                                                        up vote
                                                                                                                                                        1
                                                                                                                                                        down vote













                                                                                                                                                        Haskell, 25 bytes



                                                                                                                                                        f d r=ceiling(d/(r+r)/pi)





                                                                                                                                                        share|improve this answer










                                                                                                                                                        New contributor




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




















                                                                                                                                                          up vote
                                                                                                                                                          1
                                                                                                                                                          down vote










                                                                                                                                                          up vote
                                                                                                                                                          1
                                                                                                                                                          down vote









                                                                                                                                                          Haskell, 25 bytes



                                                                                                                                                          f d r=ceiling(d/(r+r)/pi)





                                                                                                                                                          share|improve this answer










                                                                                                                                                          New contributor




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









                                                                                                                                                          Haskell, 25 bytes



                                                                                                                                                          f d r=ceiling(d/(r+r)/pi)






                                                                                                                                                          share|improve this answer










                                                                                                                                                          New contributor




                                                                                                                                                          memo 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








                                                                                                                                                          edited yesterday





















                                                                                                                                                          New contributor




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









                                                                                                                                                          answered yesterday









                                                                                                                                                          memo

                                                                                                                                                          1113




                                                                                                                                                          1113




                                                                                                                                                          New contributor




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





                                                                                                                                                          New contributor





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






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






















                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote














                                                                                                                                                              Lua, 61 58 57 49 bytes





                                                                                                                                                              function(s,r)return math.ceil(s/(r+r)/math.pi)end


                                                                                                                                                              Try it online!



                                                                                                                                                              Thanks to KirillL. -8 bytes.






                                                                                                                                                              share|improve this answer























                                                                                                                                                              • I don't know much Lua (so maybe it's still too long), but it appears to be shorter as a function: 49 bytes
                                                                                                                                                                – Kirill L.
                                                                                                                                                                yesterday










                                                                                                                                                              • @KirillL., I'm still learning the rules here. The OP's challenge is pretty open on the input. So my question is, would we have to count your program call() against the byte count? If not, your's definitely shaves off a nice chunk.
                                                                                                                                                                – ouflak
                                                                                                                                                                yesterday










                                                                                                                                                              • A quite common style of submission here is an anonymous function (so that we don't have to count the name, unless it is recursive), which outputs by its return value. The footer section with function calls and actual printing to console is then basically used for visualizing the results and doesn't count towards your score. BTW, you may add more of the OP's test examples to the footer, so that they can be conveniently viewed all at once. Note that in some cases a full program may actually turn out to be golfier!
                                                                                                                                                                – Kirill L.
                                                                                                                                                                yesterday

















                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote














                                                                                                                                                              Lua, 61 58 57 49 bytes





                                                                                                                                                              function(s,r)return math.ceil(s/(r+r)/math.pi)end


                                                                                                                                                              Try it online!



                                                                                                                                                              Thanks to KirillL. -8 bytes.






                                                                                                                                                              share|improve this answer























                                                                                                                                                              • I don't know much Lua (so maybe it's still too long), but it appears to be shorter as a function: 49 bytes
                                                                                                                                                                – Kirill L.
                                                                                                                                                                yesterday










                                                                                                                                                              • @KirillL., I'm still learning the rules here. The OP's challenge is pretty open on the input. So my question is, would we have to count your program call() against the byte count? If not, your's definitely shaves off a nice chunk.
                                                                                                                                                                – ouflak
                                                                                                                                                                yesterday










                                                                                                                                                              • A quite common style of submission here is an anonymous function (so that we don't have to count the name, unless it is recursive), which outputs by its return value. The footer section with function calls and actual printing to console is then basically used for visualizing the results and doesn't count towards your score. BTW, you may add more of the OP's test examples to the footer, so that they can be conveniently viewed all at once. Note that in some cases a full program may actually turn out to be golfier!
                                                                                                                                                                – Kirill L.
                                                                                                                                                                yesterday















                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote










                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote










                                                                                                                                                              Lua, 61 58 57 49 bytes





                                                                                                                                                              function(s,r)return math.ceil(s/(r+r)/math.pi)end


                                                                                                                                                              Try it online!



                                                                                                                                                              Thanks to KirillL. -8 bytes.






                                                                                                                                                              share|improve this answer















                                                                                                                                                              Lua, 61 58 57 49 bytes





                                                                                                                                                              function(s,r)return math.ceil(s/(r+r)/math.pi)end


                                                                                                                                                              Try it online!



                                                                                                                                                              Thanks to KirillL. -8 bytes.







                                                                                                                                                              share|improve this answer














                                                                                                                                                              share|improve this answer



                                                                                                                                                              share|improve this answer








                                                                                                                                                              edited yesterday

























                                                                                                                                                              answered 2 days ago









                                                                                                                                                              ouflak

                                                                                                                                                              161310




                                                                                                                                                              161310












                                                                                                                                                              • I don't know much Lua (so maybe it's still too long), but it appears to be shorter as a function: 49 bytes
                                                                                                                                                                – Kirill L.
                                                                                                                                                                yesterday










                                                                                                                                                              • @KirillL., I'm still learning the rules here. The OP's challenge is pretty open on the input. So my question is, would we have to count your program call() against the byte count? If not, your's definitely shaves off a nice chunk.
                                                                                                                                                                – ouflak
                                                                                                                                                                yesterday










                                                                                                                                                              • A quite common style of submission here is an anonymous function (so that we don't have to count the name, unless it is recursive), which outputs by its return value. The footer section with function calls and actual printing to console is then basically used for visualizing the results and doesn't count towards your score. BTW, you may add more of the OP's test examples to the footer, so that they can be conveniently viewed all at once. Note that in some cases a full program may actually turn out to be golfier!
                                                                                                                                                                – Kirill L.
                                                                                                                                                                yesterday




















                                                                                                                                                              • I don't know much Lua (so maybe it's still too long), but it appears to be shorter as a function: 49 bytes
                                                                                                                                                                – Kirill L.
                                                                                                                                                                yesterday










                                                                                                                                                              • @KirillL., I'm still learning the rules here. The OP's challenge is pretty open on the input. So my question is, would we have to count your program call() against the byte count? If not, your's definitely shaves off a nice chunk.
                                                                                                                                                                – ouflak
                                                                                                                                                                yesterday










                                                                                                                                                              • A quite common style of submission here is an anonymous function (so that we don't have to count the name, unless it is recursive), which outputs by its return value. The footer section with function calls and actual printing to console is then basically used for visualizing the results and doesn't count towards your score. BTW, you may add more of the OP's test examples to the footer, so that they can be conveniently viewed all at once. Note that in some cases a full program may actually turn out to be golfier!
                                                                                                                                                                – Kirill L.
                                                                                                                                                                yesterday


















                                                                                                                                                              I don't know much Lua (so maybe it's still too long), but it appears to be shorter as a function: 49 bytes
                                                                                                                                                              – Kirill L.
                                                                                                                                                              yesterday




                                                                                                                                                              I don't know much Lua (so maybe it's still too long), but it appears to be shorter as a function: 49 bytes
                                                                                                                                                              – Kirill L.
                                                                                                                                                              yesterday












                                                                                                                                                              @KirillL., I'm still learning the rules here. The OP's challenge is pretty open on the input. So my question is, would we have to count your program call() against the byte count? If not, your's definitely shaves off a nice chunk.
                                                                                                                                                              – ouflak
                                                                                                                                                              yesterday




                                                                                                                                                              @KirillL., I'm still learning the rules here. The OP's challenge is pretty open on the input. So my question is, would we have to count your program call() against the byte count? If not, your's definitely shaves off a nice chunk.
                                                                                                                                                              – ouflak
                                                                                                                                                              yesterday












                                                                                                                                                              A quite common style of submission here is an anonymous function (so that we don't have to count the name, unless it is recursive), which outputs by its return value. The footer section with function calls and actual printing to console is then basically used for visualizing the results and doesn't count towards your score. BTW, you may add more of the OP's test examples to the footer, so that they can be conveniently viewed all at once. Note that in some cases a full program may actually turn out to be golfier!
                                                                                                                                                              – Kirill L.
                                                                                                                                                              yesterday






                                                                                                                                                              A quite common style of submission here is an anonymous function (so that we don't have to count the name, unless it is recursive), which outputs by its return value. The footer section with function calls and actual printing to console is then basically used for visualizing the results and doesn't count towards your score. BTW, you may add more of the OP's test examples to the footer, so that they can be conveniently viewed all at once. Note that in some cases a full program may actually turn out to be golfier!
                                                                                                                                                              – Kirill L.
                                                                                                                                                              yesterday












                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote













                                                                                                                                                              Common Lisp, 36 bytes



                                                                                                                                                              (lambda(a b)(ceiling(/ a(+ b b)pi)))


                                                                                                                                                              Try it online!






                                                                                                                                                              share|improve this answer



























                                                                                                                                                                up vote
                                                                                                                                                                1
                                                                                                                                                                down vote













                                                                                                                                                                Common Lisp, 36 bytes



                                                                                                                                                                (lambda(a b)(ceiling(/ a(+ b b)pi)))


                                                                                                                                                                Try it online!






                                                                                                                                                                share|improve this answer

























                                                                                                                                                                  up vote
                                                                                                                                                                  1
                                                                                                                                                                  down vote










                                                                                                                                                                  up vote
                                                                                                                                                                  1
                                                                                                                                                                  down vote









                                                                                                                                                                  Common Lisp, 36 bytes



                                                                                                                                                                  (lambda(a b)(ceiling(/ a(+ b b)pi)))


                                                                                                                                                                  Try it online!






                                                                                                                                                                  share|improve this answer














                                                                                                                                                                  Common Lisp, 36 bytes



                                                                                                                                                                  (lambda(a b)(ceiling(/ a(+ b b)pi)))


                                                                                                                                                                  Try it online!







                                                                                                                                                                  share|improve this answer














                                                                                                                                                                  share|improve this answer



                                                                                                                                                                  share|improve this answer








                                                                                                                                                                  edited yesterday

























                                                                                                                                                                  answered yesterday









                                                                                                                                                                  Renzo

                                                                                                                                                                  1,590516




                                                                                                                                                                  1,590516






















                                                                                                                                                                      up vote
                                                                                                                                                                      1
                                                                                                                                                                      down vote














                                                                                                                                                                      Tcl, 50 bytes



                                                                                                                                                                      proc N d r {expr ceil($d/(($r+$r)*acos(-$r/$r)))}


                                                                                                                                                                      Try it online!








                                                                                                                                                                      Tcl, 53 bytes



                                                                                                                                                                      proc N d r {expr ceil($d/(($r+$r)*acos(-[incr i])))}


                                                                                                                                                                      Try it online!





                                                                                                                                                                      Lack of a pi constant or function makes me lose the golf competition!






                                                                                                                                                                      share|improve this answer























                                                                                                                                                                      • Do I need to remove the .0 at end of each output? It would make me consume more bytes!
                                                                                                                                                                        – sergiol
                                                                                                                                                                        yesterday








                                                                                                                                                                      • 1




                                                                                                                                                                        [incr i] is quite clever but I think you can use $d/$d or $r/$r instead.
                                                                                                                                                                        – david
                                                                                                                                                                        yesterday










                                                                                                                                                                      • Saved some bytes thanks to @david's idea!
                                                                                                                                                                        – sergiol
                                                                                                                                                                        yesterday















                                                                                                                                                                      up vote
                                                                                                                                                                      1
                                                                                                                                                                      down vote














                                                                                                                                                                      Tcl, 50 bytes



                                                                                                                                                                      proc N d r {expr ceil($d/(($r+$r)*acos(-$r/$r)))}


                                                                                                                                                                      Try it online!








                                                                                                                                                                      Tcl, 53 bytes



                                                                                                                                                                      proc N d r {expr ceil($d/(($r+$r)*acos(-[incr i])))}


                                                                                                                                                                      Try it online!





                                                                                                                                                                      Lack of a pi constant or function makes me lose the golf competition!






                                                                                                                                                                      share|improve this answer























                                                                                                                                                                      • Do I need to remove the .0 at end of each output? It would make me consume more bytes!
                                                                                                                                                                        – sergiol
                                                                                                                                                                        yesterday








                                                                                                                                                                      • 1




                                                                                                                                                                        [incr i] is quite clever but I think you can use $d/$d or $r/$r instead.
                                                                                                                                                                        – david
                                                                                                                                                                        yesterday










                                                                                                                                                                      • Saved some bytes thanks to @david's idea!
                                                                                                                                                                        – sergiol
                                                                                                                                                                        yesterday













                                                                                                                                                                      up vote
                                                                                                                                                                      1
                                                                                                                                                                      down vote










                                                                                                                                                                      up vote
                                                                                                                                                                      1
                                                                                                                                                                      down vote










                                                                                                                                                                      Tcl, 50 bytes



                                                                                                                                                                      proc N d r {expr ceil($d/(($r+$r)*acos(-$r/$r)))}


                                                                                                                                                                      Try it online!








                                                                                                                                                                      Tcl, 53 bytes



                                                                                                                                                                      proc N d r {expr ceil($d/(($r+$r)*acos(-[incr i])))}


                                                                                                                                                                      Try it online!





                                                                                                                                                                      Lack of a pi constant or function makes me lose the golf competition!






                                                                                                                                                                      share|improve this answer















                                                                                                                                                                      Tcl, 50 bytes



                                                                                                                                                                      proc N d r {expr ceil($d/(($r+$r)*acos(-$r/$r)))}


                                                                                                                                                                      Try it online!








                                                                                                                                                                      Tcl, 53 bytes



                                                                                                                                                                      proc N d r {expr ceil($d/(($r+$r)*acos(-[incr i])))}


                                                                                                                                                                      Try it online!





                                                                                                                                                                      Lack of a pi constant or function makes me lose the golf competition!







                                                                                                                                                                      share|improve this answer














                                                                                                                                                                      share|improve this answer



                                                                                                                                                                      share|improve this answer








                                                                                                                                                                      edited yesterday

























                                                                                                                                                                      answered yesterday









                                                                                                                                                                      sergiol

                                                                                                                                                                      2,2921825




                                                                                                                                                                      2,2921825












                                                                                                                                                                      • Do I need to remove the .0 at end of each output? It would make me consume more bytes!
                                                                                                                                                                        – sergiol
                                                                                                                                                                        yesterday








                                                                                                                                                                      • 1




                                                                                                                                                                        [incr i] is quite clever but I think you can use $d/$d or $r/$r instead.
                                                                                                                                                                        – david
                                                                                                                                                                        yesterday










                                                                                                                                                                      • Saved some bytes thanks to @david's idea!
                                                                                                                                                                        – sergiol
                                                                                                                                                                        yesterday


















                                                                                                                                                                      • Do I need to remove the .0 at end of each output? It would make me consume more bytes!
                                                                                                                                                                        – sergiol
                                                                                                                                                                        yesterday








                                                                                                                                                                      • 1




                                                                                                                                                                        [incr i] is quite clever but I think you can use $d/$d or $r/$r instead.
                                                                                                                                                                        – david
                                                                                                                                                                        yesterday










                                                                                                                                                                      • Saved some bytes thanks to @david's idea!
                                                                                                                                                                        – sergiol
                                                                                                                                                                        yesterday
















                                                                                                                                                                      Do I need to remove the .0 at end of each output? It would make me consume more bytes!
                                                                                                                                                                      – sergiol
                                                                                                                                                                      yesterday






                                                                                                                                                                      Do I need to remove the .0 at end of each output? It would make me consume more bytes!
                                                                                                                                                                      – sergiol
                                                                                                                                                                      yesterday






                                                                                                                                                                      1




                                                                                                                                                                      1




                                                                                                                                                                      [incr i] is quite clever but I think you can use $d/$d or $r/$r instead.
                                                                                                                                                                      – david
                                                                                                                                                                      yesterday




                                                                                                                                                                      [incr i] is quite clever but I think you can use $d/$d or $r/$r instead.
                                                                                                                                                                      – david
                                                                                                                                                                      yesterday












                                                                                                                                                                      Saved some bytes thanks to @david's idea!
                                                                                                                                                                      – sergiol
                                                                                                                                                                      yesterday




                                                                                                                                                                      Saved some bytes thanks to @david's idea!
                                                                                                                                                                      – sergiol
                                                                                                                                                                      yesterday










                                                                                                                                                                      up vote
                                                                                                                                                                      0
                                                                                                                                                                      down vote













                                                                                                                                                                      Mathematica, 8 bytes



                                                                                                                                                                       #/(2π r)&


                                                                                                                                                                      So that



                                                                                                                                                                      r =22.9;
                                                                                                                                                                      #/(2π r)& @ 32


                                                                                                                                                                      gives



                                                                                                                                                                      (* 0.2224 *)






                                                                                                                                                                      share|improve this answer



















                                                                                                                                                                      • 1




                                                                                                                                                                        There must not be any digits 0-9 in your code. Also, could you please show how to call your function, maybe in an online interpreter like tio.run/#mathematica? I'm not sure how to supply the r.
                                                                                                                                                                        – Dennis
                                                                                                                                                                        yesterday















                                                                                                                                                                      up vote
                                                                                                                                                                      0
                                                                                                                                                                      down vote













                                                                                                                                                                      Mathematica, 8 bytes



                                                                                                                                                                       #/(2π r)&


                                                                                                                                                                      So that



                                                                                                                                                                      r =22.9;
                                                                                                                                                                      #/(2π r)& @ 32


                                                                                                                                                                      gives



                                                                                                                                                                      (* 0.2224 *)






                                                                                                                                                                      share|improve this answer



















                                                                                                                                                                      • 1




                                                                                                                                                                        There must not be any digits 0-9 in your code. Also, could you please show how to call your function, maybe in an online interpreter like tio.run/#mathematica? I'm not sure how to supply the r.
                                                                                                                                                                        – Dennis
                                                                                                                                                                        yesterday













                                                                                                                                                                      up vote
                                                                                                                                                                      0
                                                                                                                                                                      down vote










                                                                                                                                                                      up vote
                                                                                                                                                                      0
                                                                                                                                                                      down vote









                                                                                                                                                                      Mathematica, 8 bytes



                                                                                                                                                                       #/(2π r)&


                                                                                                                                                                      So that



                                                                                                                                                                      r =22.9;
                                                                                                                                                                      #/(2π r)& @ 32


                                                                                                                                                                      gives



                                                                                                                                                                      (* 0.2224 *)






                                                                                                                                                                      share|improve this answer














                                                                                                                                                                      Mathematica, 8 bytes



                                                                                                                                                                       #/(2π r)&


                                                                                                                                                                      So that



                                                                                                                                                                      r =22.9;
                                                                                                                                                                      #/(2π r)& @ 32


                                                                                                                                                                      gives



                                                                                                                                                                      (* 0.2224 *)







                                                                                                                                                                      share|improve this answer














                                                                                                                                                                      share|improve this answer



                                                                                                                                                                      share|improve this answer








                                                                                                                                                                      edited yesterday

























                                                                                                                                                                      answered yesterday









                                                                                                                                                                      David G. Stork

                                                                                                                                                                      1857




                                                                                                                                                                      1857








                                                                                                                                                                      • 1




                                                                                                                                                                        There must not be any digits 0-9 in your code. Also, could you please show how to call your function, maybe in an online interpreter like tio.run/#mathematica? I'm not sure how to supply the r.
                                                                                                                                                                        – Dennis
                                                                                                                                                                        yesterday














                                                                                                                                                                      • 1




                                                                                                                                                                        There must not be any digits 0-9 in your code. Also, could you please show how to call your function, maybe in an online interpreter like tio.run/#mathematica? I'm not sure how to supply the r.
                                                                                                                                                                        – Dennis
                                                                                                                                                                        yesterday








                                                                                                                                                                      1




                                                                                                                                                                      1




                                                                                                                                                                      There must not be any digits 0-9 in your code. Also, could you please show how to call your function, maybe in an online interpreter like tio.run/#mathematica? I'm not sure how to supply the r.
                                                                                                                                                                      – Dennis
                                                                                                                                                                      yesterday




                                                                                                                                                                      There must not be any digits 0-9 in your code. Also, could you please show how to call your function, maybe in an online interpreter like tio.run/#mathematica? I'm not sure how to supply the r.
                                                                                                                                                                      – Dennis
                                                                                                                                                                      yesterday










                                                                                                                                                                      up vote
                                                                                                                                                                      0
                                                                                                                                                                      down vote














                                                                                                                                                                      Clojure, 50 bytes





                                                                                                                                                                      (fn[a b](int(Math/ceil(/ a Math/PI(count"  ")b))))


                                                                                                                                                                      An anonymous function that accepts two integers a and b as arguments: the distance and the wheel's radius, respectively.



                                                                                                                                                                      Try it online!



                                                                                                                                                                      (count " ") evaluates to 2, so this function implements $lceil dfrac a{2pi b} rceil$.






                                                                                                                                                                      share|improve this answer

























                                                                                                                                                                        up vote
                                                                                                                                                                        0
                                                                                                                                                                        down vote














                                                                                                                                                                        Clojure, 50 bytes





                                                                                                                                                                        (fn[a b](int(Math/ceil(/ a Math/PI(count"  ")b))))


                                                                                                                                                                        An anonymous function that accepts two integers a and b as arguments: the distance and the wheel's radius, respectively.



                                                                                                                                                                        Try it online!



                                                                                                                                                                        (count " ") evaluates to 2, so this function implements $lceil dfrac a{2pi b} rceil$.






                                                                                                                                                                        share|improve this answer























                                                                                                                                                                          up vote
                                                                                                                                                                          0
                                                                                                                                                                          down vote










                                                                                                                                                                          up vote
                                                                                                                                                                          0
                                                                                                                                                                          down vote










                                                                                                                                                                          Clojure, 50 bytes





                                                                                                                                                                          (fn[a b](int(Math/ceil(/ a Math/PI(count"  ")b))))


                                                                                                                                                                          An anonymous function that accepts two integers a and b as arguments: the distance and the wheel's radius, respectively.



                                                                                                                                                                          Try it online!



                                                                                                                                                                          (count " ") evaluates to 2, so this function implements $lceil dfrac a{2pi b} rceil$.






                                                                                                                                                                          share|improve this answer













                                                                                                                                                                          Clojure, 50 bytes





                                                                                                                                                                          (fn[a b](int(Math/ceil(/ a Math/PI(count"  ")b))))


                                                                                                                                                                          An anonymous function that accepts two integers a and b as arguments: the distance and the wheel's radius, respectively.



                                                                                                                                                                          Try it online!



                                                                                                                                                                          (count " ") evaluates to 2, so this function implements $lceil dfrac a{2pi b} rceil$.







                                                                                                                                                                          share|improve this answer












                                                                                                                                                                          share|improve this answer



                                                                                                                                                                          share|improve this answer










                                                                                                                                                                          answered yesterday









                                                                                                                                                                          TheGreatGeek

                                                                                                                                                                          614




                                                                                                                                                                          614






















                                                                                                                                                                              up vote
                                                                                                                                                                              0
                                                                                                                                                                              down vote













                                                                                                                                                                              PowerShell, 53 bytes



                                                                                                                                                                              param($d,$r);$a=[math];$a::ceiling($d/($r+$r)/$a::pi)


                                                                                                                                                                              Takes input from two commandline parameters, distance -d and radius -r.






                                                                                                                                                                              share|improve this answer

























                                                                                                                                                                                up vote
                                                                                                                                                                                0
                                                                                                                                                                                down vote













                                                                                                                                                                                PowerShell, 53 bytes



                                                                                                                                                                                param($d,$r);$a=[math];$a::ceiling($d/($r+$r)/$a::pi)


                                                                                                                                                                                Takes input from two commandline parameters, distance -d and radius -r.






                                                                                                                                                                                share|improve this answer























                                                                                                                                                                                  up vote
                                                                                                                                                                                  0
                                                                                                                                                                                  down vote










                                                                                                                                                                                  up vote
                                                                                                                                                                                  0
                                                                                                                                                                                  down vote









                                                                                                                                                                                  PowerShell, 53 bytes



                                                                                                                                                                                  param($d,$r);$a=[math];$a::ceiling($d/($r+$r)/$a::pi)


                                                                                                                                                                                  Takes input from two commandline parameters, distance -d and radius -r.






                                                                                                                                                                                  share|improve this answer












                                                                                                                                                                                  PowerShell, 53 bytes



                                                                                                                                                                                  param($d,$r);$a=[math];$a::ceiling($d/($r+$r)/$a::pi)


                                                                                                                                                                                  Takes input from two commandline parameters, distance -d and radius -r.







                                                                                                                                                                                  share|improve this answer












                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                  share|improve this answer










                                                                                                                                                                                  answered 3 hours ago









                                                                                                                                                                                  Gabriel Mills

                                                                                                                                                                                  815




                                                                                                                                                                                  815






























                                                                                                                                                                                       

                                                                                                                                                                                      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

                                                                                                                                                                                      If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                                                                                                                                                                                      Alcedinidae

                                                                                                                                                                                      Can an atomic nucleus contain both particles and antiparticles? [duplicate]