Search Results

Results tagged with Search options user 75681
106 results

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

│┌─┬─┬──┐│┌─┬─┬───┐││ │ ││ ││*│&│<.│││%│&│100│││ │ ││ │└─┴─┴──┘│└─┴─┴───┘││ │ │└──┴────────┴─────────┘│ └─┴───────────────────────┘ %&100 - divides the number by 100 *&<. - finds the floor of the left argument …
answered Nov 11 '17 by Galen Ivanov
Red, 108 bytes func[n][i: s: 0 until[t: form i if(t > u: sort copy t)and(t < reverse u)[s: s + i n: n - 1]i: i + 1 0 = n]s] Try it online! More readable: f: func [ n ] [ i: s: 0 until [ …
answered Jul 7 '18 by Galen Ivanov
J, 26 24 22 bytes >:@]^:(>:4&p:-])^:_ 2: Try it online! 0-based Explanation: 2: start with the first prime number and ^:( )^:_ while … >: the argument is greater or equal to the - difference of 4&p: the next prime number and ] the current prime number >:@] go to the next number
answered Jan 23 by Galen Ivanov
Icon, 78 75 bytes procedure f(n);s:="";s||:=":)=((:)=:():=)(=:||:"[!n*2+1+:2]&/n;return s;end Try it online!
answered May 5 by Galen Ivanov
Expand a number Your task is to expand an integer greater than 0 in the following manner: Split the number into decimal digits and for each digit generate a list according to these rules: if the … of the number. Here's an example of the above rules applied to 34607: 9 8 79 68 57 346 7 -> 399 7 -> 3997 -> 9418 2 6 288 6 2886 1 5 …
asked Nov 8 '17 by Galen Ivanov
Red, 105 bytes func[s][b: to-block s l: length? b repeat n l / 2[print b/(n) + b/(l - n + 1)]if odd? l[print b/(n + 1)]] Try it online! Red, 91 bytes (Relaxed IO - a list ot integers) func[b][l: …
answered Mar 20 '18 by Galen Ivanov
Red, 335 330 bytes func[s][b: copy[]foreach c split s" "[append b either c >"+"and(c <"U")[do c][c]]r: copy[]until[t: 0 until[not parse b[to copy c[2 integer!"+"](insert/only r reduce[c/1 c/2]replace …
answered May 14 '18 by Galen Ivanov
J, 4 bytes -/:~ Try it online! Explanation: From the argument subtract - the sorted /:~ argument
answered Jun 5 '18 by Galen Ivanov
J, 43 bytes 3#.((3 3\$t 6883){~<@,~"0)&(_10{.t=.3&#.inv) It can certainly be golfed further. Explanation: &( ) - for both arguments …
answered Jul 2 '18 by Galen Ivanov
J, 39 bytes 1#.'?@CFILOSVZ'&I.+11|1+'1234567890'i.] Try it online! A port of Adám's APL solution
answered May 23 by Galen Ivanov
K (ngn/k), 13 bytes {y(10/x\)/11} Try it online!
answered May 20 by Galen Ivanov
the second 2 fraction digits. I encoded each number with a printable character. For decoding I simpy extract the ingerer and fraction parts of a number from the associated character lists and assemble … length 1-9 (I tweaked the first fraction, wich is 13 digits long). Then I encoded this list as a base 94 number, presented it as a list of characters. About 20 bytes can be saved if the verb is rewriten as tacit one. …
answered Feb 8 '18 by Galen Ivanov
Red, 82 bytes func[a b][s: 0 until[n: a until[if n % 2 = 1[s: s + 1]1 > n: n / 2]b < a: a + 1]s] Try it online!
answered Jun 5 '18 by Galen Ivanov
Red, 21 bytes func[b][b = unique b] Try it online!
answered Sep 5 '18 by Galen Ivanov
J, 7 6 bytes -1 byte thanks to Adám 1#.^&4 Try it online! Works for lists with arbitrary length ^&4 - each item of the list to the 4-th power 1#. - sum of all 4-th powers by base-1 conversion …
answered Feb 19 '18 by Galen Ivanov

15 30 50 per page