Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 70894

The challenge involves mathematics. Also consider using more specific tags: [number] [number-theory] [arithmetic] [combinatorics] [graph-theory] [geometry] [abstract-algebra].

1
vote
Japt, 5 bytes Saved 1 byte thanks to @Shagy pV ìx Try it online!
answered May 3 '18 by Herman L
6
votes
Swift, 190 bytes import Foundation func f(a:[(Double,Double)]){var t=0.0,h=t,l=(t,t) a.reversed().map{n in if l.0>=n.0&&n.1>l.1{t+=max((n.1-h)/(n.1-l.1)*hypot(n.0-l.0,n.1-l.1),0) h=max(n.1,h)} l=n} …
answered Dec 22 '17 by Herman L
1
vote
Javascript (ES6), 36 bytes n=>1%n*n/2/(1-Math.cos(Math.PI/n)) Port of @JonathanAllan's Python 3 answer f=n=>1%n*n/2/(1-Math.cos(Math.PI/n)) <input id=i type=number oninput="o.innerText=f(i.va …
answered Oct 25 '17 by Herman L
1
vote
Swift, 142 bytes func f(X:[Float],Y:[Float]){print(Y.reversed().flatMap{y in X.flatMap{let s=try?b($0,y);return s==nil ?" ":s!>0 ?"/":s!<0 ?"\\":"-"}+["\n"]})} Prints as an array of characters
answered Dec 10 '17 by Herman L
0
votes
Swift, 137 bytes func f(n:Int){var l=Array(1...n).map{$0>3 ?0:$0},p=8;if n>3{for i in 3..<n{if l[i]<1{l[i]=l[i-1]+1};if l[i]<n{l[l[i]]=p};p*=2}};print(l)} Takes input as Int (integer) and prints as …
answered Dec 8 '17 by Herman L
1
vote
Javascript (ES7), 180 bytes n=>[...Array(2**n)].filter((_,m)=>![...m=m.toString(2).padStart(n,0)].some(_=>s[m=m.replace(/(.)(.*)/,"$2$1")]|s[[...m].reverse().join``])&!/^(.+)\1+$/.test(m)&(s[m]=1),s= …
answered Sep 24 '17 by Herman L
4
votes
Javascript (ES6), 51 50 bytes a=>b=>g=c=>c?([x,y]=g(c-1),[x*a-b*y,a*y+b*x]):"10" Takes input in currying form: f(a)(b)(c) Returns the result as an array: [d, e] Explanation a=>b=>g=c=> …
answered Oct 14 '17 by Herman L
1
vote
Swift, 51 bytes {9-Int("0"+$0.filter{"?" != $0})!%9}as(String)->Int Try it online!
answered Dec 22 '17 by Herman L
1
vote
Swift, 116 * 39 / 14 ≈ 323.14 114 * 39 / 14 ≈ 317.57 print(2+2+2+2+1/(1+1/(1+1/(2+2+1+1/(1+1/(2+1+1/(1+1/(2+2+1/(12+1/(2+1+1/(2+1/(1+1/(2+2+1+1/(2+1/12.2)))))))))))))) Try it online! Uses a cont …
answered Dec 16 '17 by Herman L
10
votes
Javascript (ES6), 36 bytes -1 byte thanks to @dtkaias (x,y,s=Math.hypot)=>s(x)+s(y)-s(x,y) Example code snippet: f= (x,y,s=Math.hypot)=>s(x)+s(y)-s(x,y) for(i=0;i<7;i++) a=[3,-3,-3,6 …
answered Jul 8 '17 by Herman L
3
votes
Swift, 47 42 bytes func h(_ n:Int){f(n)==n ?print(n):h(f(n))} Naive approach, assumes that the black box function is named f
answered Dec 8 '17 by Herman L
2
votes
Rust, 65 64 bytes |mut n|{while n>0{print!("{} ",n);n=if n&1>0{n>>1}else{n*3+1};}} Try it online!
answered Nov 4 '18 by Herman L
0
votes
Japt, 9 bytes Saved 1 byte thanks to @Shaggy à mx â ÊÄ Try it online! This is a slightly modified port of Dennis' Jelly answer, credits to him for the idea. Explanation: à Take all no …
answered May 10 '18 by Herman L
1
vote
Swift, 202 185 bytes Saved 17 bytes thanks to @Mr.Xcoder func p(_ n:Int,_ m:[Int]=[])->[[Int]]{return 0<n ?(1...min(m.last ?? n,n)).flatMap{p(n-$0,m+[$0])}:[m]} {n in n>1 ?p(n).filter{a in !(2...n …
answered Dec 17 '17 by Herman L
1
vote
Vim, 47 keystrokes "zy$␘a@q␛"xYoa␛"zPy$qqo␛@"0␛q@x3Gqqr1jlq@x1G2dd ␘ is CtrlX and ␛ is Esc Explanation "zy$␘ Save n for use later a@q␛"xY Create the macro `x` that repeats the m …
answered Jan 3 '18 by Herman L

15 30 50 per page