cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A109883 Start subtracting from n its divisors beginning from 1 until one reaches a number smaller than the last divisor subtracted or reaches the last nontrivial divisor < n. Define this to be the perfect deficiency of n. Then a(n) = perfect deficiency of n.

Original entry on oeis.org

0, 1, 2, 1, 4, 0, 6, 1, 5, 2, 10, 2, 12, 4, 6, 1, 16, 6, 18, 8, 10, 8, 22, 0, 19, 10, 14, 0, 28, 3, 30, 1, 18, 14, 22, 11, 36, 16, 22, 10, 40, 9, 42, 4, 12, 20, 46, 12, 41, 7, 30, 6, 52, 15, 38, 20, 34, 26, 58, 2, 60, 28, 22, 1, 46, 21, 66, 10, 42, 31, 70, 9, 72, 34, 26, 12, 58, 27, 78
Offset: 1

Views

Author

Amarnath Murthy, Jul 11 2005

Keywords

Comments

If n is a perfect number then a(n) = 0. But if a(n) = 0, n needs not be perfect, e.g., a(24) = 0, but 24 is not a perfect number. See A064510.

Examples

			a(14) = 4: 14-1 = 13, 13-2 = 11, 11-7 = 4.
a(6) = 0: 6-1 = 5, 5-2 = 3, 3-3 = 0. 6 is a perfect number.
a(35) = 22: 35-1 = 34, 34-5 = 29, 29-7 = 22.
		

Crossrefs

Programs

  • Maple
    A109883:=proc(n)local d,j,k,m:if(n=1)then return 0:fi:j:=1:m:=n:d:=divisors(n);k:=nops(d):for j from 1 to k do m:=m-d[j]:if(mNathaniel Johnston, Apr 15 2011
  • Mathematica
    subtract = If[ #1 < #2, Throw[ #1], #1 - #2]&;
    a[n_] := Catch @ Fold[subtract, n, Divisors @ n]
    Table[ a[n], {n, 80}] (* Bobby R. Treat (DrBob(AT)bigfoot.com), Jul 14 2005 *)
  • PARI
    a(n) = {my(r = n); fordiv(n, d, if (r < d, return (r)); r -= d;); 0;} \\ Michel Marcus, Dec 28 2018
    
  • Python
    from sympy import divisors
    def A109883(n):
        if n == 1: return 0
        s = n
        for d in divisors(n)[:-1]:
            if s < d: break
            s -= d
        return s
    print([A109883(n) for n in range(1, 80)]) # Michael S. Branicky, Mar 31 2024

Formula

a(1) = 0, a(2^n) = 1.
a(p) = p-1, a(p^n) = (p^(n+1) - 2*p^n + 1)/(p-1), if p is a prime.
a(n) = n - A117552(n). - Ridouane Oudra, Jan 25 2024

Extensions

More terms from Jason Earls and Robert G. Wilson v, Jul 12 2005

A117553 When adding some positive divisors of n in order from lowest divisor to highest divisor, a(n) is lowest sum achievable which is >= n.

Original entry on oeis.org

1, 3, 4, 7, 6, 6, 8, 15, 13, 18, 12, 16, 14, 24, 24, 31, 18, 21, 20, 22, 32, 36, 24, 24, 31, 42, 40, 28, 30, 42, 32, 63, 48, 54, 48, 37, 38, 60, 56, 50, 42, 54, 44, 84, 78, 72, 48, 52, 57, 93, 72, 98, 54, 66, 72, 64, 80, 90, 60, 78, 62, 96, 104, 127, 84, 78, 68, 126, 96, 74, 72
Offset: 1

Views

Author

Leroy Quet, Mar 28 2006

Keywords

Comments

Often, but not always, a(n)=n+A054024(n). The exceptions to this rule are at n=24, 36, 48, 60, 72, 84,90, 96, 108, ... - R. J. Mathar, Mar 14 2007

Examples

			12's divisors are 1,2,3,4,6 and 12. Adding the divisors in order we have:
1 = 1, 1+2 = 3, 1+2+3 = 6, 1+2+3+4 = 10, 1+2+3+4+6 = 16 and 1+2+3+4+6+12 = 28.
Of these sums, 1+2+3+4+6 = 16 is the lowest which is >= 12. So a(12) = 16.
		

Crossrefs

Programs

  • Maple
    A117553 := proc(n) local divs,a,i ; divs := numtheory[divisors](n) ; a := op(1,divs) ; i := 1 ; while a < n do i := i+1 ; a := a+op(i,divs) ; od ; RETURN(a) ; end: for n from 1 to 80 do printf("%d, ",A117553(n)) ; od ; # R. J. Mathar, Mar 14 2007
  • Mathematica
    Table[Select[Accumulate[Divisors[n]],#>=n&,1],{n,80}]//Flatten (* Harvey P. Dale, Apr 05 2017 *)

Extensions

More terms from R. J. Mathar, Mar 14 2007

A377247 a(n) is the largest k such that the sum of the first k divisors of n is at most n.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 1, 3, 2, 3, 1, 4, 1, 3, 3, 4, 1, 4, 1, 4, 3, 3, 1, 6, 2, 3, 3, 5, 1, 6, 1, 5, 3, 3, 3, 6, 1, 3, 3, 6, 1, 6, 1, 5, 5, 3, 1, 7, 2, 5, 3, 5, 1, 6, 3, 6, 3, 3, 1, 9, 1, 3, 5, 6, 3, 6, 1, 5, 3, 6, 1, 9, 1, 3, 5, 5, 3, 6, 1, 8, 4, 3, 1, 9, 3, 3, 3, 6
Offset: 1

Views

Author

David A. Corneth, Oct 21 2024

Keywords

Examples

			a(1) = 1 as the sum of the first divisor of 1 is 1 <= 1 and 1 has no more divisors.
a(6) = 3 as the sum of the first three divisors is 1+2+3 <= 6 but the sum of the first four divisors is 1 + 2 + 3 + 6 = 12 > 6.
		

Crossrefs

Cf. A081512, A117552 (corresponding sums).

Programs

  • Mathematica
    A377247[n_] := LengthWhile[Accumulate[Divisors[n]], # <= n &];
    Array[A377247, 100] (* Paolo Xausa, Aug 05 2025 *)
  • PARI
    A377247(n) = {my(d = divisors(n), t = 0); for(i = 1, #d, t += d[i]; if(t > n, return(i-1))); 1}
Showing 1-3 of 3 results.