# Search Results

Results tagged with Search options user 31347
52 results

This challenge is intended to be solved by using, manipulating, accepting as input, or outputting numeric values.

R, 113 101 bytes Not quite as elegant as @plannapus's answer. Go the All Blacks :) n=scan();for(C in 0:n)for(T in 0:n)for(P in 0:n)if(C*7+T*5+P*3==n)cat(P,'K,',C+T,'T,',C,'C\n',sep='') Test run …
answered Sep 19 '15 by MickyT
converted to an odd number sequence. y is incremented on each recursion until it exceeds x. The first sequence which sums to the target will be returned. …
answered Jul 6 '17 by MickyT
and outputs a vector of integers. Essentially this uses integer division to round the number down, adds 1 and multiples it by five. Anything divisible by 10 has 1 taken away. If n = 1 then it …
answered Sep 21 '15 by MickyT
Cubix, 18 32 bytes I think I'll have to spend sometime on this later and see if I can compress it a bit. But for the moment here it is. Turns out I was thinking about this totally the wrong way. Now …
answered Feb 21 '17 by MickyT
R, 33 bytes Implemented as an unnamed function function(x)rle(x%%10^(0:99))$v This applies a mod of 10^0 through 10^99. rle is used to reduce the results down so that the second item is always … answered Feb 23 '17 by MickyT Cubix, 19 bytes ;ww.1I!@s%Ow;)Sow.$ Try it online! ; w w . 1 I ! @ s % O w ; ) S o w . \$ . . . . . Watch It Run A fairly straight forward implementation. 1 push 1 to the stack …
answered Jun 14 '17 by MickyT
R, 77 72 bytes F=gmp::fibnum;i=0;d=n=scan();while(n)if(grepl(F(d),F(i<-i+1)))n=n-1;F(i) This makes use of the gmp library for the Fibonacci number. Fairly straight foward implementation of the …
answered Jun 15 '17 by MickyT
R, 85 80 76 Uses the Hare Quota method. Removed a couple after seeing the spec that W will sum to 1 function(a,b){s=floor(d<-b*a);s[o]=s[o<-rev(order(d%%1))[0:(a-sum(s))]]+1;s} Test run > (funct …
answered Feb 16 '15 by MickyT
Cubix, 22 bytes This will output the sequence indefinitely. The general idea is that it has a base number which 6 - 1 is added to. For each add the result is output multiplied by 10, which is …
R, 86 bytes I thought there was already an answer (or two) in R for this question, but I must have been mistaken or they had the same issues that I had with R not doing signed ints. That issue too …
answered Nov 28 '17 by MickyT
R, 28 bytes -((n=scan())%%3-1)*(n%/%3+1) Looks like this is a variation of most of the answers here. Zero based. n=scan() # get input from STDIN ( )%%3-1 # …
answered Jun 2 '16 by MickyT
Cubix, 30 bytes 1..-.w>?^I3%?;,)O@...o-'.<u;;; Try it here. You will need to replace the current code with the above and enter an input number. This wraps onto a cube with an edge length of 3 … % ? ; , ) O @ . . . o - ' . < u ; ; ; . . . . . . . . . . . . . . . . . . . . . . . . Explanation: I 3 % ? Take a number from input, push a literal 3, mod on TOS and do a check. The …
answered Jun 2 '16 by MickyT
Cubix, 23 24 25 bytes I1Wq/)s.;0..s;p-?\.+O@u 0 for truthy and nothing 0 for falsey. Brutes forces by incrementing counter, adding to cumulative sum and comparing to input. Now to try and fit it …
answered May 22 '17 by MickyT
R, 86 83 Was working through this and then realised that I had essentially come up with the same solution as Optimizer and others I suspect. Anyway here it is as a function that takes a vector f=fu …
answered Jan 15 '15 by MickyT
COUNT, thanks @nutki SELECT COUNT(R)FROM(SELECT ROW_NUMBER()OVER(ORDER BY V DESC)R,V FROM I)A WHERE R<=V SQLFiddle example Essentially it numbers the rows on a descending sort of the values. Then it returns the maximum row number where the row number is greater than equal to the value. …
answered Dec 22 '14 by MickyT

15 30 50 per page