Search
Ruby, 31 bytes ->a{a.map{$*[_1]=1.+$*[_1]||0}} Try this online! $* is a global variable, so calling this lambda multiple times (in a single process) would give wrong result. A 32 bytes vers...
Ruby, 36 bytes Infinite version: n=1;0while n+=p(n).digits.minmax.sum Try this online! (program is interrupted after it reaches the 128KiB limit of output)
Ruby, 48 bytes ->a{[a.split,b=a.chars-[$/],b-[' ']].map &:size} Try this online!
Ruby, 70 67 66 bytes ->c{a=0;c.bytes{|b|a,=[b<106?a+b/3-34:b<112?p(a):a*a,0]-[-1,256]}} Test this online!
Ruby, 101 79 76 72 bytes This challenge was one of the funniest I have ever solved! 72 bytes solution (I show the solution as a Ruby string - because binary data is filtered out) "->l{l.sort_...
Ruby, 23 bytes ->n,*x{eval'x<<x*1;'*n} Try this online! There is also 22 bytes version, but it uses special $* global variables (so it can be run only once in single process): ->n...
Ruby, 13 bytes According to the rules, programs should read from STDIN and output to the STDOUT. This is my solution: p gets.to_i&1 Try this online!
Ruby, 25 bytes puts"p #{gets}+gets.to_i" P1 - Try this online! P2 - Try this online!
J, 1 byte # Try it online! The copy verb. It works the exact same as APL and Jelly's replicate.
Ruby, 40 bytes f=->a,b{b.index(a)==0?b:a[/./m]+f[$',b]} Attempt This Online! If we could assume that string contains only letters and numbers (or to be more specific, no characters like \t\...
Ruby, 56 bytes ->n{require'prime';Prime.each_cons(2).find{_2-_1>=n}[0]} Attempt This Online!
J, 2 bytes p. Try it online! J likes inflections so it won't beat APL, but J is still a contender :).
Ruby, 44 bytes ->p,n{n*=I while I=p.find{_1*n%1==0};n.to_i} Attempt This Online!
dc, 9 bytes _?dvd*-^p Try it online! Comparisons are expensive in dc, so you have to get a bit creative. I came up with $0^{n-\lfloor\sqrt{n}\rfloor^2}$.
Embed ESCR, 28 characters [= [exp [rnd [sqrt n]] 2] n] The number to test is in N. There are 4 nested functions. From inner to outer: SQRT takes the square root of N. This produces a floating ...
J, 21 bytes ,&'+".1!:1(3)'1!:1(3) Try it online! STDIN is ugly in J because you have to use foreigns.
ESCR, 35 bytes show "show [+ [arg 1] " [arg 1] "]" The SHOW command writes to standard output. The parameters in quotes are just fixed strings. The ARG function returns a numbered argument. In...
J, 50 bytes {{({~[:y&(i.&1@:=)[:>+/&.>),{@(,&<)~p:i.p:^:_1 y}} Try it online! A nasty DD solution. {{({~[:y&(i.&1@:=)[:>+/&.>),{@(,&<)~p:i.p:...
Ruby, 69 bytes require'prime';->n{Prime.first(n).then{_1.product _1}.find{_1+_2==n}} Try it online!
Python 3.8, 112 bytes def f(x):y=[i for i in range(2,x)if not[j for j in range(2,i)if i%j<1]];return[(q,x-q)for q in y if x-q in y][0] Try it online!