Tanj
  • Member for 4 years, 6 months
  • Last seen more than a month ago
Is the number binary-heavy?
4 votes

Julia, 22 bytes x->2*x<4^count_ones(x)

View answer
"Factorise" a quadratic
2 votes

Julia 1.0, 34 bytes (a,b)->(d=(a*a-4b)^.5;[a+d,a-d]/2) Try it online!

View answer
Cover a set with multiples
2 votes

Julia, 91 bytes x->(t=[];for i in x z=findfirst(x->x==0,i%(2:maximum(x)));z∈t?1:push!(t,z) end;length(t))

View answer
Am I a Sophie Germain prime?
2 votes

Julia 0.6, 20 bytes x->∉(0,(x-~x)%3:x)

View answer
Round away from zero
1 votes

Julia 1.0, 17 bytes Save 6 bytes thanks to the awesome comments of MarcMush! x->x+sign(x%=1)-x Try it online! An alternative with 22 bytes x->sign(x)ceil(abs(x)) Try it online!

View answer
Help me do my washing
1 votes

Julia, 26 bytes g(s)=s[s.=="L"],s[s.=="D"]

View answer
Is it a super-prime?
1 votes

Julia 0.6, 61 bytes return 1 if x is a super-prime, 0 otherwise. without using an isprime-kind function. x->a=[0,1];for i=3:x push!(a,0∉i%(2:i-1))end;a[sum(a)]&a[x]

View answer
Multiply a string by a number!
1 votes

Julia, 44 bytes (s,x)->for i in split(s,"") print(i^abs(x))end

View answer
First Last Last First
0 votes

Julia, 71 64 bytes thanks to sundar and his find(A.==x)[] instead of findfirst(A,x)). . (A,x,y)->findnext(A,y,find(A.==x)[]),findprev(A,x,findlast(A,y))

View answer
Rapunzel, Rapunzel, let down your hair!
0 votes

Julia, 101 bytes g(h,t)=h>t?string("A","a"^(h-t),"h!"):string("B","o"^round(Int,(t-h)*2/3),"h","o"^round(Int,(t-h)/3)) Arguments to the function are taken in the order length of Hair, height of ...

View answer
Is it a Chen prime?
0 votes

Julia, 59 bytes x->((0∉x%(2:x-1))&(length(find(x->x==0,(x+2)%(2:x)))<=2))

View answer
Is it a weak prime?
0 votes

Julia 0.6, 64 bytes g(x,i)=0∉x%(2:x-1)?1:1+g(x+i,i);x->g(x,1)&(g(x-1,-1)<g(x+1,1))

View answer
Raise integer x to power x, without exponentiation built-ins
0 votes

Julia 0.6, 18 bytes x->prod(x*ones(x))

View answer