dc, 69 bytes
This takes input from top of stack, and leaves a result on top of stack. The result is the count of symmetric difference between the digit sets, so zero indicates true, and other numbers indicate false.
d[O~1r:ad0<f]dsfx+3^[O~1r:bd0<f]dsfxsaO[1-ddd;ar;b-d*la+sad0<m]dsmxla
Explanation
Expanded version as commented full program with I/O to standard streams:
#!/usr/bin/dc
# read input
?
# store 1 in a[i] for each digit i
d[O~
1r:a
d0<f]dsfx
# cube the original number
+3^
# record its digits in b[]
[O~
1r:b
d0<f]dsfx
# 0 left on stack used to initialize accumulator
sa
# for i in 9..0, add (b[i]-a[i])^2
# accumulate in register 'a'
O[1-d
dd;ar;b-d*
la+sa
d0<m]dsmx
# load result from accumulator
la
# print output
p
I hoped I could re-use the first function to store to both a[]
and b[]
but I couldn't find an easy way to do it. Arrays can't be pushed or popped, and it was too hard to add an indirection to the function.
Test results
Here's the test cases from the question, plus those suggested in comments:
0 -> 0
1 -> 0
10 -> 0
107624 -> 0
251894 -> 0
251895 -> 4
102343 -> 6
106239 -> 1
2103869 -> 0
And here's the first 50 terms of A029795, of 536 that I identified with this program by testing the numbers up to ten million:
0
1
10
100
1000
10000
100000
107624
109573
132485
138624
159406
165640
192574
205738
215806
251894
281536
318725
419375
427863
568314
642510
713960
953867
954086
963218
965760
1000000
1008529
1023479
1023674
1026258
1028537
1028565
1028756
1032284
1035743
1037689
1039725
1045573
1046783
1062851
1062854
1063279
1063724
1066254
1072399
1073824
1076240
2103869 -> True
. This (or a larger one) is necessary to test a language with along
datatype. \$\endgroup\$