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-5 of 5 results.

A033879 Deficiency of n, or 2n - (sum of divisors of n).

Original entry on oeis.org

1, 1, 2, 1, 4, 0, 6, 1, 5, 2, 10, -4, 12, 4, 6, 1, 16, -3, 18, -2, 10, 8, 22, -12, 19, 10, 14, 0, 28, -12, 30, 1, 18, 14, 22, -19, 36, 16, 22, -10, 40, -12, 42, 4, 12, 20, 46, -28, 41, 7, 30, 6, 52, -12, 38, -8, 34, 26, 58, -48, 60, 28, 22, 1, 46, -12, 66, 10, 42, -4, 70, -51
Offset: 1

Views

Author

Keywords

Comments

Records for the sequence of the absolute values are in A075728 and the indices of these records in A074918. - R. J. Mathar, Mar 02 2007
a(n) = 1 iff n is a power of 2. a(n) = n - 1 iff n is prime. - Omar E. Pol, Jan 30 2014
If a(n) = 1 then n is called a least deficient number or an almost perfect number. All the powers of 2 are least deficient numbers but it is not known if there exists a least deficient number that is not a power of 2. See A000079. - Jianing Song, Oct 13 2019
It is not known whether there are any -1's in this sequence. See comment in A033880. - Antti Karttunen, Feb 02 2020

Examples

			For n = 10 the divisors of 10 are 1, 2, 5, 10, so the deficiency of 10 is 10 minus the sum of its proper divisors or simply 10 - 5 - 2 - 1 = 2. - _Omar E. Pol_, Dec 27 2013
		

References

  • Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004, Section B2, pp. 74-84.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 147.

Crossrefs

Cf. A000396 (positions of zeros), A005100 (of positive terms), A005101 (of negative terms).
Cf. A141545 (positions of a(n) = -12).
For this sequence applied to various permutations of natural numbers and some other sequences, see A323174, A323244, A324055, A324185, A324546, A324574, A324575, A324654, A325379.

Programs

Formula

a(n) = -A033880(n).
a(n) = A005843(n) - A000203(n). - Omar E. Pol, Dec 14 2008
a(n) = n - A001065(n). - Omar E. Pol, Dec 27 2013
G.f.: 2*x/(1 - x)^2 - Sum_{k>=1} k*x^k/(1 - x^k). - Ilya Gutkovskiy, Jan 24 2017
a(n) = A286385(n) - A252748(n). - Antti Karttunen, May 13 2017
From Antti Karttunen, Dec 29 2017: (Start)
a(n) = Sum_{d|n} A083254(d).
a(n) = Sum_{d|n} A008683(n/d)*A296075(d).
a(n) = A065620(A295881(n)) = A117966(A295882(n)).
a(n) = A294898(n) + A000120(n).
(End)
From Antti Karttunen, Jun 03 2019: (Start)
Sequence can be represented in arbitrarily many ways as a difference of the form (n - f(n)) - (g(n) - n), where f and g are any two sequences whose sum f(n)+g(n) = sigma(n). Here are few examples:
a(n) = A325314(n) - A325313(n) = A325814(n) - A034460(n) = A325978(n) - A325977(n).
a(n) = A325976(n) - A325826(n) = A325959(n) - A325969(n) = A003958(n) - A324044(n).
a(n) = A326049(n) - A326050(n) = A326055(n) - A326054(n) = A326044(n) - A326045(n).
a(n) = A326058(n) - A326059(n) = A326068(n) - A326067(n).
a(n) = A326128(n) - A326127(n) = A066503(n) - A326143(n).
a(n) = A318878(n) - A318879(n).
a(A228058(n)) = A325379(n). (End)
Sum_{k=1..n} a(k) ~ c * n^2, where c = 1 - Pi^2/12 = 0.177532... . - Amiram Eldar, Dec 07 2023

Extensions

Definition corrected by N. J. A. Sloane, Jul 04 2005

A296075 Sum of deficiencies of divisors of n.

Original entry on oeis.org

1, 2, 3, 3, 5, 4, 7, 4, 8, 8, 11, 1, 13, 12, 13, 5, 17, 6, 19, 7, 19, 20, 23, -10, 24, 24, 22, 13, 29, 4, 31, 6, 31, 32, 33, -16, 37, 36, 37, -2, 41, 12, 43, 25, 30, 44, 47, -37, 48, 34, 49, 31, 53, 8, 53, 6, 55, 56, 59, -49, 61, 60, 46, 7, 63, 28, 67, 43, 67, 36, 71, -78, 73, 72, 58, 49, 75, 36, 79, -27, 63, 80, 83, -47, 83
Offset: 1

Views

Author

Antti Karttunen, Dec 04 2017

Keywords

Comments

a(n)=0 for n in A066218. Are 1 and 12 the only solutions to a(n)=1? - Robert Israel, Dec 04 2017

Examples

			For n = 6, whose divisors are 1, 2, 3, 6, their deficiencies are 1, 1, 2, 0, thus a(6) = 1 + 1 + 2 + 0 = 4.
For n = 24, whose divisors are 1, 2, 3, 4, 6, 8, 12, 24, their deficiencies are 1, 1, 2, 1, 0, 1, -4, -12, thus a(24) = 1 + 1 + 2 + 1 + 0 + 1 + -4 + -12 = -10.
		

Crossrefs

Programs

  • Maple
    f:= n -> add(2*t-numtheory:-sigma(t), t=numtheory:-divisors(n)):
    map(f, [$1..100]); # Robert Israel, Dec 04 2017
  • Mathematica
    f1[p_, e_] := (p^(e+1)-1)/(p-1); f2[p_, e_] := (p*(p^(e+1)-1) - (p-1)*(e+1))/(p-1)^2; a[1] = 1; a[n_] := Module[{f = FactorInteger[n]}, 2 * Times @@ f1 @@@ f - Times @@ f2 @@@ f]; Array[a, 100] (* Amiram Eldar, Dec 04 2023 *)
  • PARI
    A033879(n) = ((2*n)-sigma(n));
    A296075(n) = sumdiv(n,d,A033879(d));

Formula

a(n) = Sum_{d|n} A033879(d).
a(n) = A296074(n) + A033879(n).
If m and n are coprime, a(m*n) = 2*a(m)*A000203(n)+2*a(n)*A000203(m)-a(m)*a(n)-2*A000203(m)*A000203(n). - Robert Israel, Dec 04 2017
a(n) = 2*A000203(n) - A007429(n). - Ridouane Oudra, Jul 29 2019
Sum_{k=1..n} a(k) ~ (Pi^2/6 - Pi^4/72) * n^2. - Amiram Eldar, Dec 04 2023

A296073 Filter combining A296071(n) and A296072(n), related to the deficiencies of proper divisors of n.

Original entry on oeis.org

1, 2, 2, 3, 2, 4, 2, 5, 6, 7, 2, 8, 2, 9, 10, 11, 2, 12, 2, 13, 14, 15, 2, 16, 17, 18, 19, 20, 2, 21, 2, 22, 23, 24, 25, 26, 2, 27, 28, 29, 2, 30, 2, 31, 32, 33, 2, 34, 35, 36, 37, 38, 2, 39, 40, 41, 42, 43, 2, 44, 2, 45, 46, 47, 48, 49, 2, 50, 51, 52, 2, 53, 2, 54, 55, 56, 57, 58, 2, 59, 60, 61, 2, 62, 63, 64, 65, 66, 2, 67, 68, 69, 70, 71, 72, 73, 2, 74, 75, 76, 2, 77, 2, 78, 79, 80, 2, 81, 2, 82, 83, 84, 2, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 33
Offset: 1

Views

Author

Antti Karttunen, Dec 04 2017

Keywords

Comments

Construction: Pack the values of A296071(n) and A296072(n) to a single value with any injective N x N -> N packing function, like for example as f(n) = (1/2)*(2 + ((A296071(n)+A296072(n))^2) - A296071(n) - 3*A296072(n)) (the packing function here is the two-argument form of A000027). Then apply the restricted growth sequence transform to the sequence f(1), f(2), f(3), ... The transform assigns a unique increasing number for each newly encountered term of the sequence, and for any subsequent occurrences of the same term it gives the same number that term obtained for the first time.
For all i, j: a(i) = a(j) => A296074(i) = A296074(j).
Note that this is NOT restricted growth transform of A239968, which is A305800. Apart from 2's that occur at every prime, there are other duplicates also, first at a(125) = a(46) = 33.

Examples

			To see that a(46) and a(125) have the same value (33), consider the proper divisors of 46 = 1, 2, 23 and of 125 = 1, 5, 25. Their deficiencies are 1, 1, 22 and 1, 4, 19 respectively. When we look at their balanced ternary representations [as here all elements are positive, it can be obtained as A007089(A117967(n)) with 2's standing for -1's]:
   1 =    1
   1 =    1
  22 = 1211 (as 22 = 1*(3^3) + -1*(3^2) + 1*(3^1) + 1*(3^0))
and
   1 =    1
   4 =   11
  19 = 1201 (as 19 = 1*(3^3) + -1*(3^2) + 0*(3^1) + 1*(3^0)).
we see that in each column there is an equal number of 1's and an equal number of 2's. Moreover, this then implies also that the sums of those two sequences of deficiencies {1, 1, 22} and {1, 4, 19} are equal, as A296074(n) is a function of (can be computed from) a(n).
		

Crossrefs

Cf. also A293226.
Differs from A305800 for the first time at n=125.

Programs

  • PARI
    up_to = 65536;
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    write_to_bfile(start_offset,vec,bfilename) = { for(n=1, length(vec), write(bfilename, (n+start_offset)-1, " ", vec[n])); }
    A019565(n) = {my(j,v); factorback(Mat(vector(if(n, #n=vecextract(binary(n), "-1..1")), j, [prime(j), n[j]])~))}; \\ This function from M. F. Hasler
    A117967(n) = if(n<=1,n,if(!(n%3),3*A117967(n/3),if(1==(n%3),1+3*A117967((n-1)/3),2+3*A117967((n+1)/3))));
    A117968(n) = if(1==n,2,if(!(n%3),3*A117968(n/3),if(1==(n%3),2+3*A117968((n-1)/3),1+3*A117968((n+1)/3))));
    A289813(n) = { my (d=digits(n, 3)); from digits(vector(#d, i, if (d[i]==1, 1, 0)), 2); } \\ From Rémy Sigrist
    A289814(n) = { my (d=digits(n, 3)); from digits(vector(#d, i, if (d[i]==2, 1, 0)), 2); } \\ From Rémy Sigrist
    A295882(n) = { my(x = (2*n)-sigma(n)); if(x >= 0,A117967(x),A117968(-x)); };
    A296071(n) = { my(m=1); fordiv(n,d,if(d < n,m *= A019565(A289813(A295882(d))))); m; };
    A296072(n) = { my(m=1); fordiv(n,d,if(d < n,m *= A019565(A289814(A295882(d))))); m; };
    Anotsubmitted3(n) = (1/2)*(2 + ((A296071(n)+A296072(n))^2) - A296071(n) - 3*A296072(n));
    write_to_bfile(1,rgs_transform(vector(up_to,n,Anotsubmitted3(n))),"b296073.txt");

Extensions

Data section extended up to a(125) by Antti Karttunen, Jun 14 2018

A297159 a(n) = 3*n - 2*phi(n) - sigma(n); Difference between the deficiency of n and its Moebius-transform.

Original entry on oeis.org

0, 1, 1, 1, 1, 2, 1, 1, 2, 4, 1, 0, 1, 6, 5, 1, 1, 3, 1, 2, 7, 10, 1, -4, 4, 12, 5, 4, 1, 2, 1, 1, 11, 16, 9, -7, 1, 18, 13, -2, 1, 6, 1, 8, 9, 22, 1, -12, 6, 17, 17, 10, 1, 6, 13, 0, 19, 28, 1, -20, 1, 30, 13, 1, 15, 14, 1, 14, 23, 18, 1, -27, 1, 36, 21, 16, 15, 18, 1, -10, 14, 40, 1, -20, 19, 42, 29, 4, 1, -12, 17, 20, 31, 46, 21, -28, 1, 39, 21, 3, 1, 26
Offset: 1

Views

Author

Antti Karttunen, Mar 02 2018

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := 3*n - 2*EulerPhi[n] - DivisorSigma[1, n]; Array[a, 100] (* Amiram Eldar, Dec 04 2023 *)
  • PARI
    A297159(n) = (3*n - 2*eulerphi(n) - sigma(n));
    
  • PARI
    A297159(n) = -sumdiv(n,d,(d
    				
  • Python
    from sympy import totient, divisor_sigma
    def a(n): return 3*n-2*totient(n)-divisor_sigma(n)
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Mar 02 2018

Formula

a(n) = A033879(n) - A083254(n) = 3*n - 2*A000010(n) - A000203(n).
a(n) = -Sum_{d|n, dA008683(n/d)*A033879(d).
Sum_{k=1..n} a(k) = (3/2 - 6/Pi^2 - Pi^2/12) * n^2 + O(n*log(n)). - Amiram Eldar, Dec 04 2023

A318447 a(n) = Sum_{d|n, dA294898(d), where A294898(d) = A005187(d) - sigma(d).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, -2, 0, 3, 2, 0, 0, 1, 0, 2, 3, 7, 0, -8, 2, 9, 3, 4, 0, 2, 0, 0, 7, 14, 5, -10, 0, 15, 9, -2, 0, 9, 0, 12, 7, 18, 0, -22, 3, 18, 14, 16, 0, 6, 9, 1, 15, 24, 0, -24, 0, 25, 13, 0, 11, 26, 0, 26, 18, 25, 0, -45, 0, 33, 20, 28, 10, 32, 0, -14, 13, 37, 0, -15, 16, 38, 24, 13, 0, -8, 12, 34, 25, 41, 17, -52, 0
Offset: 1

Views

Author

Antti Karttunen, Aug 27 2018

Keywords

Crossrefs

Programs

Formula

a(n) = Sum_{d|n, dA294898(d).
a(n) = A318448(n) - A294898(n).
a(n) = A318445(n) - A211779(n).
a(n) = A296074(n) - A292257(n).
Showing 1-5 of 5 results.