A125225 Numbers n such that n-1 can be represented as a sum of a subset of divisors of n.
1, 2, 4, 6, 8, 12, 16, 18, 20, 24, 28, 30, 32, 36, 40, 42, 48, 54, 56, 60, 64, 66, 70, 72, 78, 80, 84, 88, 90, 96, 100, 104, 108, 112, 120, 126, 128, 132, 140, 144, 150, 156, 160, 162, 168, 176, 180, 192, 196, 198, 200, 204, 208, 210, 216, 220, 224, 228, 234, 240, 252
Offset: 1
Keywords
Examples
70 is in this sequence because 70-1=69=35+14+10+7+2+1 and all numbers in the sum are divisors of 70.
Links
- T. D. Noe, Table of n, a(n) for n=1..1000
- Premchand Anne, Egyptian fractions and the inheritance problem, The College Mathematics Journal 29 (4) (1998) 296-300.
Programs
-
Maple
ss:= proc(n, S) local s, Sp; option remember; if n = 0 then return true elif S = {} then return false fi; s:= max(S); if s > n then return procname(n, select(`<=`,S,n)) elif s = n then return true fi; s:= min(S); Sp:= subs(s=NULL,S); if s > n then false else procname(n-s,Sp) or procname(n,Sp) fi end proc: select(n -> ss(n-1, numtheory:-divisors(n)), [$1..1000]); # Robert Israel, Aug 05 2016
-
Mathematica
okQ[n_] := With[{dd = Divisors[n]}, AnyTrue[Range[Length[dd], 1, -1], AnyTrue[Subsets[dd, {#}], Total[#] == n-1&]&]]; okQ[1] = True; Select[Range[1000], okQ] (* Jean-François Alcover, Jul 23 2020 *)
-
PARI
padbin(n, len) = {b = binary(n); while(length(b) < len, b = concat(0, b);); b;} isok(n) = {if (n == 1, return (1)); d = divisors(n); nbd = #d; for (i = 1, 2^nbd-1, b = padbin(i, nbd); s = sum(j = 1, nbd, d[j]*b[j]); if (s == (n - 1), return (1));); return (0);} \\ Michel Marcus, Aug 30 2013
Comments