Answer by Neil for Number of ways to partition n into n = K +ꓘ
Charcoal, 16 bytesNθIΣE…·⊘θθ⁼θ⁺ι⮌ιTry it online! Link is to verbose version of code. Explanation: Another port of @JonathanAllan's Jelly answer.Nθ First input as a number…· Inclusive range fromθ Input...
View ArticleAnswer by CursorCoercer for Number of ways to partition n into n = K +ꓘ
Pyth, 9 bytes/ec2m+s_`Try it online!Explanation # implicitly assign Q = eval(input())/ec2m+s_`ddQQ # implicitly add ddQQ m Q # map lambda d over range(Q) _`d # reverse string(d) s # convert back to...
View ArticleAnswer by Fmbalbuena for Number of ways to partition n into n = K +ꓘ
Vyxal 3, 9 bytes½⌊z-:V+=∑Try it Online!Port of Jelly...
View ArticleAnswer by nyxbird for Number of ways to partition n into n = K +ꓘ
APL (Dyalog Unicode), 40 35 bytes (SBCS){+/⍵=10⊥¨(⌽+⊢)¨10⊥⍣¯1¨¯1+(⌊⍵÷2)+⍳⍵}Try it online!3732 with ⎕IO←0:{+/⍵=10⊥¨(⌽+⊢)¨10⊥⍣¯1¨(⌊⍵÷2)+⍳⍵}Try it online!
View ArticleAnswer by Jonathan Allan for Number of ways to partition n into n = K +ꓘ
Jelly, 9 bytesrHDṚḌ+Ʋ€ċA monadic Link that accepts a positive integer and yields the number of valid pairs distinct up to reversingTry it online!How?rHDṚḌ+Ʋ€ċ - Link: positive integer, N H - halve {N}...
View ArticleAnswer by l4m2 for Number of ways to partition n into n = K +ꓘ
Python 3, 56 byteslambda x:sum(i>=x-i==int(str(i)[::-1])for i in range(x))Try it online!or 53 bytes Python2 by FmbalbuenaJavaScript (Node.js), 59...
View ArticleNumber of ways to partition n into n = K +ꓘ
In this challenge you are asked to find in how many ways we can express a positive integer n as the sum of two positive integers k and the reverse of k.Here is an example using n = 1069 :188 + 881 =...
View ArticleAnswer by chunes for Number of ways to partition n into n = K +ꓘ
UiuaSBCS, 19 bytes/+=+⋕∵⇌°⋕.-+1⇡⌊÷2..Try it!/+=+⋕∵⇌°⋕.-+1⇡⌊÷2.. .. # duplicate input twice⌊÷2 # halve and floor⇡ # range+1 # increment - # subtract from input . # duplicate°⋕ # unparse (convert to...
View ArticleAnswer by Nick Kennedy for Number of ways to partition n into n = K +ꓘ
R, 70 bytes\(x)sum(sapply(x:(x/2),\(z)z%/%(b=10^(0:log10(z)))%%10%*%rev(b)+z)==x)Attempt This Online!More or less an R translation of @JonathanAllan’s Jelly answer, so be sure to upvote that one too!
View ArticleAnswer by pxeger for Number of ways to partition n into n = K +ꓘ
Zsh, 48 bytesfor ((i=$1;i-->$1/2;c+=`rev<<<$i`+i==$1)):<<<$cAttempt This Online!Terribly slow, because to reverse a string in Zsh you have to spawn a process!
View ArticleAnswer by Kirill L. for Number of ways to partition n into n = K +ꓘ
Ruby, 46 bytes->x{(x/2..x).count{x==_1+_1.digits.join.to_i}}Attempt This Online!
View ArticleAnswer by 138 Aspen for Number of ways to partition n into n = K +ꓘ
Scala 3, 53 bytesx=>(x/2 to x).count{i=>i+i.toString.reverse.toInt==x}Attempt This Online!
View ArticleAnswer by Aiden Chow for Number of ways to partition n into n = K +ꓘ
Desmos, 80 bytesf(k)=∑_{n=.5k}^k0^{(k-n-∑_{d=0}^n10^{floor(logn)-d}mod(floor(n/10^d),10))^2}Try It On Desmos!Try It On Desmos! - Prettified
View ArticleAnswer by Kevin Cruijssen for Number of ways to partition n into n = K +ꓘ
05AB1E, 7 bytes;ŸDí+QOTry it online or verify all test cases.Explanation:; # Halve the (implicit) input-integerŸ # Pop and push a list in the range [(implicit) input, floor(input/2)] D # Duplicate this...
View ArticleAnswer by Noureddin for Number of ways to partition n into n = K +ꓘ
Perl 5, 48 bytes (30 bytes w/o args or return)($x,$n)=(0,@_);$x+=$_+reverse==$n for$n/2..$n;$xTry it online!
View Article
More Pages to Explore .....