How many Magic Cubes? Your Task:
You all know what a magic square is!  But what about a magic cube?  A magic cube is the 3D version of a magic square, and is a set of numbers in a cube, where the sums of every straight (not diagonal) line are equal.  You must write a program or function that receives an integer, and returns the number of valid magic cubes made up of up to one of each integer between 1 and that integer (inclusive).
Input:
An integer.
Output:
The number of magic cubes you can make by using up to one of of each integer between 1 and the input.  A cube with various rotations should only be counted once.
Scoring:
This is code-golf, lowest byte count wins.
BOUNTY:
I will award a 100 rep bounty to the first user that manages to do this in &lt; 100 bytes without using built-ins designed specifically towards magic cubes or squares (looking at you Mathematica).
Ruby, 275 bytes



n=gets.to_i;p (2.upto(n**(1/3r)).map{|i|(1..n).to_a.permutation(i**3).map{|x|c=eval'x'+".each_slice(#{i}).to_a"*2;[c,c.map(&amp;:transpose),c.transpose.map(&amp;:transpose)].map{|q|q.map{|a|a.map{|b|b.inject(:+)}}.flatten.uniq.length}.inject(:+)==3?1:0}}+[0]).flatten.inject(:+)/48+n


Try it online!

In theory, this works. In practice, since it creates every permutation of the list of possible numbers, it'll take hopelessly large amounts of time and memory for any input more than 13 or so. I haven't taken the time to test it past 12, but it seems no 2×2×2 magic cubes exist for that range, so all it really does is tell you how many 1×1×1 cubes you can make.

I "golfed" it a bit (really just made it hard to read for minimal size reduction returns). I'm sure the size can be reduced quite a bit, though getting it under 100 characters is a pretty tall order.

Ruby 2.4 added .sum, but TIO doesn't support it yet, so this has a few .inject(:+)s.

I'll add a non-golfed version + explanation if requested.