Finished my 6-second game trailer for my Asteroids (1979)-clone in virtual reality:
Boring Math (11.0)
Boring Math (11.0)
Table[(2*n)*Boole[Max[Ratios[Divisors[(2*n)]]] > 2 and not isprime(n)]], n=1 to 200
Which leads me to
Boring Math (11.0)
This references https://arxiv.org/abs/1405.2585
Which seems to have a mention of the maximal ratio (and it may be unbounded?)
Boring Math (11.0)
Aww yee:
https://en.m.wikipedia.org/wiki/Complete_sequence#Conditions_for_completeness
Which leads to an interesting sequence:
I still want to figure out a sequence containing 78 specifically.
Boring Math (11.0)
This helped me realize a useful property / algorithm optimization of practical numbers:
Divisors of practical numbers seem to increase by at most a factor of 2. I think this is necessary, but I'm not sure if it is sufficient.
Boring Math (11.0)
I was trying to consider practical numbers where the negative sign could be used e.g.:
1
3-1
3
3+1
9-3-1
9-3
9-3+1
9-1
9
Notably, there is a common math question related to base-3 and a balance scale.
Which likely results in the sequence:
Although it's still possible there are exceptions.
Boring Math (11.0)
I'm wayyy off lol:
e**(log(sigma(52307529120))/(log(52307529120)*log(log(52307529120)))) ~= 1.39127
Boring Math (11.0)
Using e**(log(sigma(v, 1))/(log(v)*log(log(v)))):
The values seem to approach ~7/4 and 1/2. think the 1/2 is exact based on https://en.wikipedia.org/wiki/Divisor_function#Growth_rate
But I'm not sure about the other one.
Boring Math (11.0)
Essentially this means I'm looking for a modified definition of practical numbers that excludes powers of 2 and the most composite practical numbers. I'm wondering what the density of this set of numbers is compared to the primes, and also wondering if I can e.g. construct a 1:1 relationship between primes and "modified practical numbers".
Boring Math (11.0)
I forgot to paste some modifications from yesterday (mostly after midnight):
Looking at records over time. I think I'm interested in the narrow band starting at the perfect numbers and going up to a factor of 2 of the upper limit: https://en.wikipedia.org/wiki/Divisor_function#Growth_rate
Boring Math (11.0)
Oh, right, the output is:
1 ( 1.0 ) - 2520 ( 3.7142857142857144 )
2999 ( 1.0003334444814937 ) - 1608 ( 2.537313432835821 )
Basically, the lower values (both near 1) are uninteresting.
The upper values seem to increase without bound, but maybe the ratio between them is predictable. highest_nonpractical_value may have a strict bound, but I need to get a more efficient algorithm set to figure that out.
Boring Math (11.0)
...
elif normalized_sigma_value > highest_nonpractical_value:
highest_nonpractical = x
highest_nonpractical_value = normalized_sigma_value
print(lowest_practical, " (", float(lowest_practical_value), ") - ", highest_practical, " (", float(highest_practical_value), ")")
print(lowest_nonpractical, " (", float(lowest_nonpractical_value), ") - ", highest_nonpractical, " (", float(highest_nonpractical_value), ")")
Boring Math (11.0)
...
elif normalized_sigma_value > highest_practical_value:
highest_practical = x
highest_practical_value = normalized_sigma_value
else:
normalized_sigma_value = sigma(x, 1)/x
if normalized_sigma_value < lowest_nonpractical_value:
lowest_nonpractical = x
lowest_nonpractical_value = normalized_sigma_value
...
Boring Math (11.0)
...
max = 3000
for x in range(1, max + 1):
normalized_sigma_value = sigma(x, 1)/x
if is_practical(x):
if normalized_sigma_value < lowest_practical_value:
lowest_practical = x
lowest_practical_value = normalized_sigma_value
...
Boring Math (11.0)
...
if __name__ == '__main__':
highest_practical = 1
lowest_practical = 1
highest_nonpractical = 1
lowest_nonpractical = 1
highest_practical_value = 0
lowest_practical_value = 1e10
highest_nonpractical_value = 0
lowest_nonpractical_value = 1e10
...
Boring Math (11.0)
...
f = sorted(factors5(x), reverse=True)
if sum(f) < x - 1:
return False # Never get x-1
ps = powerset(f)
found = set()
for nps in ps:
if len(found) < x - 1:
y = sum(nps)
if 1 <= y < x:
found.add(y)
else:
break # Short-circuiting the loop.
return len(found) == x - 1
...
Boring Math (11.0)
...
# %% Practical number
def is_practical(x: int) -> bool:
"""Practical number test with factor reverse sort and short-circuiting."""
if x == 1:
return True
if x % 2:
return False # No Odd number more than 1
mult_4_or_6 = (x % 4 == 0) or (x % 6 == 0)
if x > 2 and not mult_4_or_6:
return False # If > 2 then must be a divisor of 4 or 6
...
Boring Math (11.0)
...
while not n%c:
n,p,d = n//c, p*c, d + (p,)
yield(d)
if n > 1: yield((n,))
r = [1]
for e in prime_powers(n):
r += [a*b for a in r for b in e]
return r[:-1]
# %% Powerset
def powerset(s: List[int]) -> List[Tuple[int, ...]]:
"""powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3) ."""
return chain.from_iterable(combinations(s, r) for r in range(1, len(s)+1))
...
Programming a *2D virtual reality* game (Invertigo):