|
|
A363227
|
|
Positive integers m such that every k with 1 <= k <= m is a linear combination of distinct divisors of m with coefficients +1 or -1.
|
|
1
|
|
|
1, 2, 3, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 27, 28, 30, 32, 36, 40, 42, 44, 45, 48, 50, 52, 54, 56, 60, 63, 64, 66, 70, 72, 75, 78, 80, 81, 84, 88, 90, 96, 98, 99, 100, 102, 104, 105, 108, 110, 112, 114, 117, 120, 126, 128, 130, 132, 135, 136, 138, 140, 144, 147, 150
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
All practical numbers are terms of this sequence.
Referred to as "semi-practical" numbers in the comments of the linked Numberphile video.
|
|
LINKS
|
|
|
MAPLE
|
q:= proc(n) uses numtheory, ListTools; local b, l, s;
l:= [divisors(n)[]]; s:= PartialSums(l);
b:= proc(m, i) option remember; m=0 or i>0 and m<=s[i] and
(b(m, i-1) or b(abs(m-l[i]), i-1) or b(m+l[i], i-1))
end;
andmap(x-> b(x, nops(l)), [$1..n])
end:
|
|
MATHEMATICA
|
q[n_] := Module[{b, l, s}, l = Divisors[n]; s = Accumulate[l]; b[m_, i_] := b[m, i] = m == 0 || i > 0 && m <= s[[i]] && (b[m, i-1] || b[Abs[m - l[[i]]], i-1] || b[m+l[[i]], i-1]); AllTrue[Range[n], b[#, Length[l]]&]];
|
|
PROG
|
(Python)
import math
def divisorGenerator(n):
large_divisors = []
for i in range(1, int(math.sqrt(n) + 1)):
if n % i == 0:
yield i
if i*i != n:
large_divisors.append(int(n / i))
for divisor in reversed(large_divisors):
yield divisor
from itertools import chain, combinations
def all_combinations(iterable, n):
s = list(iterable)
for sumset in chain.from_iterable(combinations(s, r) for r in range(len(s)+1)):
remaining = list(set(s).symmetric_difference(set(list(sumset))))
for subtractset in chain.from_iterable(combinations(remaining, r) for r in range(len(remaining)+1)):
value = sum(list(sumset))-sum(list(subtractset))
if value>0 and value<=n:
yield value
return len(set(all_combinations(divisorGenerator(n), n)))==n
max_n = 250
print([x for x in range(max_n+1) if is_A363227(x)])
(Python)
from itertools import count, islice
from sympy import divisors
def A363227_gen(startvalue=1): # generator of terms >= startvalue
for m in count(max(startvalue, 1)):
c = {0}
for d in divisors(m, generator=True):
c |= {a+d for a in c}|{a-d for a in c}
if all(k in c for k in range(1, m+1)):
yield m
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|