New answers tagged

3

Husk, 12 bytes !:11foṗ/11İ↔ Try it online! ! # get element at input-th index of :11 # prepend 11 to İ↔ # palindromic numbers fo # that satisfy /11 # when they're divided by 11 ṗ # the result is a prime


1

Husk, 11 9 8 bytes Edit: -1 byte thanks to Razetime uftfS=↔Q Try it online! uftfS=↔Q u # unique elements of Q # all contiguous subsets of input f # after filtering to include only those that t # are not a single digit/character f # and then filtering to include only those that S=↔ ...


0

Stax, 10 bytes îmmW┴√▄○○← Run and debug it I couldn't find an is-palindrome function. With that this'd probably be much shorter.


1

Lua, 334 bytes m=math.floor function p(a)a=tostring(a)return a:reverse()==a end s=io.read()function g(s) for i=s,1,-1 do if(p(m(i)))then t=i for j=s-i,1,-1 do if (p(m(j)))then u=j for k=t-j,0,-1 do if(p(m(k))and(k~=0)and((t+u+k)==tonumber(s)))then print(m(t))print(m(u))print(m(k))return end end end end end end end if(p(s))then print(s)else g(s)end Try it ...


0

Husk, 9 bytes L↑S≠↔¡S+↔ Try it online! Explanation L↑S≠↔¡S+↔ ¡ apply the following infinitely: S+↔ number + its reverse ↑ take the longest prefix of items where S≠↔ number ≠ its reverse L return its length


0

Jelly, 12 bytes ṚḌ+ƊŒḂ¬$пL’ Try it online! Jelly really needs an "until" builtin How it works ṚḌ+ƊŒḂ¬$пL’ - Main link. Takes n on the left п - While loop, gathering each step into a list to return: $ - Condition: ŒḂ - Is palindrome? ¬ - Not Ɗ - Body: Ṛ - Reverse Ḍ ...


1

Husk, 13 bytes mλṁoS=↔`B¹ḣ)ḣ Try it online! not sure if I can avoid using a lambda here.


0

Japt v2.0a0, 13 bytes Note the unprintable (charcode 155) at the end of the second line. u ÔøUr\l_cn# Try it


Top 50 recent answers are included