g | x | w | all
Bytes Lang Time Link
030Perl 5 MMathTrig p250226T171812ZXcali
031YASEPL250225T161219Zmadeforl
019Desmos250222T215839ZDesmosEn
050Tcl181122T185503Zsergiol
018Factor + cursors220506T203626Zchunes
022Desmos220506T185026ZnaffetS
019Pari/GP181125T184134Zalephalp
031Ruby190122T112802ZAsone Tu
022Intel 8087 FPU assembly190122T034433Z640KB
028SmileBASIC190122T001654Z12Me21
051PowerShell181124T020524ZGMills
012TIBasic 83 series181125T182240ZMisha La
050Clojure181123T020202ZTheGreat
036Common Lisp181122T150737ZRenzo
049Lua181121T144956Zouflak
025Haskell181122T123218Zmemo
023JavaScript Babel Node181122T124303ZIgor Sow
046Dart181122T073128ZElcan
016min181122T115309ZPanda0nE
032R181121T202307ZSumner18
020Julia 1.0181121T184556Zgggg
012Perl 6181121T133155ZJo King
045C gcc181121T175755Zgastropn
030Java 8181121T130547ZKevin Cr
005MathGolf181121T132505ZKevin Cr
025JavaScript Babel Node181121T125229ZLuis fel
005Stax181121T172916Zrecursiv
007Japt181121T170607ZShaggy
009J181121T145936ZGalen Iv
004MathGolf181121T144109Zmaxb
008Catholicon181121T142340ZOkx
046C181121T143048Zbznein
043Python 2181121T125111ZTFeld
009APL+WIN181121T135903ZGraham
029Ruby181121T140921ZG B
006Jelly181121T140242ZErik the
047PHP181121T134746ZTitus
00605AB1E181121T131108ZKevin Cr

Perl 5 -MMath::Trig -p, 30 bytes

$_=<>/pi/($_+$_);$_=int/\./+$_

Try it online!

YASEPL, 31 bytes

=d'=r'=gπ+g*r!/g=h$=l$d%h:h+d<

input distance then radius

explanation:

=d'=r'=gπ+g*r!/g=h$=l$d%h:h+d<       packed
=d'                                  get distance (D)
   =r'                               get radius (R)
      =gπ+g*r                        calculate 2πr
      =gπ                               set G as pi
         +g                             add itself
           *r                           multiply by R
             !/g                     divide D by 2πr
                =h$=l$d%h:h+d        round up D
                =h$                     create H (replacement for 1)
                   =l$d                 set L as D
                       %h               modulo by 1
                         :h             subtract that from 1
                           +d           add D
                             <       output the final number

Desmos, 19 bytes

f(d,r)=ceil(d/τ/r)

f takes distance d, and rotations r, returning the ceiling of d/tau/r or more simply, d/(tau*r).

Try it on Demos!

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!

Factor + cursors, 18 bytes

[ / pi pi + up/i ]

Try it online!

Divide the distance by the radius, then ceiling-integer-divide that by 2pi. The ceiling-integer-division word up/i is provided by the cursors vocabulary.

Desmos, 22 bytes

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

Try it on Desmos!

Pari/GP, 23 19 bytes

(d,r)->-d/(r+r)\-Pi

Try it online!

Ruby, 31 bytes

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

Try it online!

Intel 8087 FPU assembly, 22 bytes

; input: D,R (shortreal,shortreal)
; output: O (memsixteen)
FDIST   MACRO  D, R, O
    FLD  D      ; ST[] = D
    FLDPI       ; ST[] = PI
    FDIV        ; ST = D / PI
    FLD  R      ; ST[] = R
    FLD  ST     ; ST[] = R
    FADD        ; ST = R + R
    FDIV        ; ST = D / PI / R + R
    FISTP O
        ENDM

Uses only the Intel Eighty-Eighty-Seven math-coprocessor. Inputs Distance (D) and Radius (R) as thirty-two bit IEEE Seven-Fifty-Four single-precision real. Returns O as a sixteen bit unsigned int.

SmileBASIC, 28 bytes

INPUT D,R?CEIL(D/(R+R)/PI())

PowerShell, 53 52 51 bytes

-1 byte thanks to @mazzy
-1 byte after I realized I don't need a semicolon after the param() block

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

Try it online!

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

TI-Basic (83 series), 12 bytes

-int(-Tmax⁻¹min(e^(ΔList(ln(Ans

Takes input as a list of radius and distance in Ans: for example, {0.9999:12.5663:prgmX.

e^(ΔList(ln(Ans will take the ratio of those distances, and min( turns this into a number. Then we divide by Tmax, which is a graphing parameter that's equal to 2π by default. Finally, -int(- takes the ceiling.

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{2\pi b} \rceil\$.

Common Lisp, 36 bytes

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

Try it online!

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.

Haskell, 25 bytes

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

JavaScript (Babel Node), 23 bytes

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

Try it online!

Dart, 47 46 bytes

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

Try it online!

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.

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

Julia 1.0, 20 bytes

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

Try it online!

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).

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!

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.

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)

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!

Stax, 5 bytes

Vt*/e

Run and debug it

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

Japt, 7 bytes

/MT/V c

Try it here

J, 10 9 bytes

>.@%o.@+:

Try it online!

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

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

ċ/π/Ǔ

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

Python 2, 47 45 44 43 bytes

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

Try it online!


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

Ruby, 29 bytes

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

Try it online!

Jelly, 6 bytes

÷÷ØPHĊ

Try it online!

PHP, 47 bytes

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

Try it online.

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)