Skip to main content
changed title formatting
Source Link

Python 3.10, 72 bytes

Python 3.10 - 72 bytes

lambda x:sum(([w:=2**n]*(w<x)*str(x).count(str(w))for n in range(x)),[])

Can probably be golfed further - I initially misunderstood the question as wanting no duplicates (i.e. 322 -> [32, 2]), but I think the structure that lead me to is fine. Also, in principle this will work for any input, but it takes several seconds to run on 13248 and will probably take longer than I care to wait on 655365536.

Python 3.10, 72 bytes

lambda x:sum(([w:=2**n]*(w<x)*str(x).count(str(w))for n in range(x)),[])

Can probably be golfed further - I initially misunderstood the question as wanting no duplicates (i.e. 322 -> [32, 2]), but I think the structure that lead me to is fine. Also, in principle this will work for any input, but it takes several seconds to run on 13248 and will probably take longer than I care to wait on 655365536.

Python 3.10 - 72 bytes

lambda x:sum(([w:=2**n]*(w<x)*str(x).count(str(w))for n in range(x)),[])

Can probably be golfed further - I initially misunderstood the question as wanting no duplicates (i.e. 322 -> [32, 2]), but I think the structure that lead me to is fine. Also, in principle this will work for any input, but it takes several seconds to run on 13248 and will probably take longer than I care to wait on 655365536.

Source Link

Python 3.10, 72 bytes

lambda x:sum(([w:=2**n]*(w<x)*str(x).count(str(w))for n in range(x)),[])

Can probably be golfed further - I initially misunderstood the question as wanting no duplicates (i.e. 322 -> [32, 2]), but I think the structure that lead me to is fine. Also, in principle this will work for any input, but it takes several seconds to run on 13248 and will probably take longer than I care to wait on 655365536.