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

A066272 Number of anti-divisors of n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Dec 31 2001

Keywords

Comments

Anti-divisors are the numbers that do not divide a number by the largest possible margin. E.g. 20 has anti-divisors 3, 8 and 13. An alternative name for anti-divisor is unbiased non-divisors.
Definition: If an odd number i in the range 1 < i <= n divides N where N is any one of 2n-1, 2n or 2n+1 then d = N/i is called an anti-divisor of n. The numbers 1 and 2 have no anti-divisors.
Equivalently, an anti-divisor of n is a number d in the range [2,n-1] which does not divide n and is either a (necessarily odd) divisor of 2n-1 or 2n+1, or a (necessarily even) divisor of 2n.
Thus an anti-divisor of n is an integer d in [2,n-1] such that n == (d-1)/2, d/2, or (d+1)/2 (mod d), the class of d being -1, 0, or 1, respectively.
k is an anti-divisor of n if and only if 1 < k < n and | (n mod k) - k/2 | < 1. - Max Alekseyev, Jul 21 2007
The number of even anti-divisors of n is one less than the number of odd divisors of n; specifically, all but the largest odd divisor multiplied by the power of two dividing 2n (i.e., 2^A001511(n)). For example, the odd divisors of 18 are 1, 3, and 9, so the even anti-divisors of 18 are 1*4 = 4 and 3*4 = 12. - Franklin T. Adams-Watters, Sep 11 2009
2n-1 and 2n+1 are twin primes if and only if n has no odd anti-divisors (e.g., n=15 has no odd anti-divisors so 29 and 31 are twin primes). - Jon Perry, Sep 02 2012
Records are in A066464. - Robert G. Wilson v, Sep 03 2012

Examples

			For example, n = 18: 2n-1, 2n, 2n+1 are 35, 36, 37 with odd divisors > 1 {5,7,35}, {3,9}, {37} and quotients 7, 5, 1, 12, 4, 1, so the anti-divisors of 18 are 4, 5, 7, 12. Therefore a(18) = 4.
		

Crossrefs

See A130799 for the anti-divisors.

Programs

  • Maple
    antidivisors := proc(n)
        local a,k;
        a := {} ;
        for k from 2 to n-1 do
            if abs((n mod k)- k/2) < 1 then
                a := a union {k} ;
            end if;
         end do:
         a ;
    end proc:
    A066272 := proc(n)
        nops(antidivisors(n)) ;
    end proc:
    seq(A066272(n),n=1..120); # R. J. Mathar, May 24 2010
  • Mathematica
    antid[ n_ ] := Select[ Union[ Join[ Select[ Divisors[ 2n - 1 ], OddQ[ # ] && # != 1 & ], Select[ Divisors[ 2n + 1 ], OddQ[ # ] && # != 1 & ], 2n / Select[ Divisors[ 2n ], OddQ[ # ] && # != 1 & ] ] ], # < n & ]; Table[ Length[ antid[ n ] ], {n, 1, 100} ]
    f[n_] := Length@ Complement[ Sort@Join[ Select[ Union@ Flatten@ Divisors[{2 n - 1, 2 n + 1}], OddQ@ # && # < n &], Select[ Divisors[2 n], EvenQ@ # && # < n &]], Divisors@ n]; Array[f, 105] (* Robert G. Wilson v, Jul 17 2007 *)
    nd[n_]:=Count[Range[2,n-1],?(Abs[Mod[n,#]-#/2]<1&)]; Array[nd,110] (* _Harvey P. Dale, Jul 11 2012 *)
  • PARI
    al(n)=Vec(sum(k=1,n,(x^(3*k)+x*O(x^n))/(1-x^(2*k))+(x^(3*k+1)+x^(3*k+2)+x*O(x^n))/(1-x^(2*k+1)))) \\ Franklin T. Adams-Watters, Sep 11 2009
    
  • PARI
    a(n) = if(n>1, numdiv(2*n+1) + numdiv(2*n-1) + numdiv(n/2^valuation(n,2)) - 5, 0) \\ Max Alekseyev, Apr 27 2010
    
  • PARI
    antidivisors(n)=select(t->n%t && tCharles R Greathouse IV, May 12 2016
    
  • Python
    from sympy import divisors
    def A066272(n):
        return len([d for d in divisors(2*n) if n > d >=2 and n%d]) +  len([d for d in divisors(2*n-1) if n > d >=2 and n%d]) +  len([d for d in divisors(2*n+1) if n > d >=2 and n%d]) # Chai Wah Wu, Aug 11 2014

Formula

G.f.: Sum_{k>0} x^(3k) / (1 - x^(2k)) + (x^(3k+1) + x^(3k+2)) / (1 - x^(2k+1)). - Franklin T. Adams-Watters, Sep 11 2009
a(n) = A000005(2*n-1) + A000005(2*n+1) + A001227(n) - 5. - Max Alekseyev, Apr 27 2010
a(n) = Sum_{i=3..n} (i mod 2) * (3 + floor((2n-1)/i) - ceiling((2n-1)/i) + floor(2n/i) - ceiling(2n/i) + floor((2n+1)/i) - ceiling((2n+1)/i)). - Wesley Ivan Hurt, Aug 10 2014
Sum_{k=1..n} a(k) ~ (n/2) * (3*log(n) + 6*gamma - 13 + 7*log(2)), where gamma is Euler's constant (A001620). - Amiram Eldar, Jan 19 2024

Extensions

More terms from Robert G. Wilson v, Jan 02 2002
More terms from Max Alekseyev, Apr 27 2010

A066417 Sum of anti-divisors of n.

Original entry on oeis.org

0, 0, 2, 3, 5, 4, 10, 8, 8, 14, 12, 13, 19, 16, 18, 14, 28, 28, 18, 24, 22, 36, 34, 23, 39, 24, 42, 46, 24, 36, 42, 58, 48, 30, 52, 32, 50, 70, 52, 55, 41, 66, 56, 40, 86, 58, 60, 56, 72, 80, 42, 94, 88, 52, 74, 56, 74, 96, 90, 107, 57, 78, 112, 46, 84, 86, 132, 112, 54, 102
Offset: 1

Views

Author

Jon Perry, Dec 28 2001

Keywords

Comments

See A066272 for definition of anti-divisor.

Examples

			For n = 18: 2n-1, 2n, 2n+1 are 35, 36, 37 with odd divisors > 1 {5,7,35}, {3,9}, {37} and quotients 7, 5, 1, 12, 4, 1, so the anti-divisors of 12 are 4, 5, 7, 12. Therefore a(18) = 28.
		

Crossrefs

Programs

  • Maple
    # Uses antidivisors() implemented in A066272.
    A066417 := proc(n) add(d,d=antidivisors(n)) ; end proc: # R. J. Mathar, Jul 04 2011
    # faster alternative with Alekseyev formula
    A066417 := proc(n)
        k := A007814(n) ;
        numtheory[sigma](2*n-1)+numtheory[sigma](2*n+1) +numtheory[sigma(n/2^k)*2^(k+1) -6*n-2 ;
    end proc: # R. J. Mathar, Nov 11 2014
  • Mathematica
    antid[n_] := Select[ Union[ Join[ Select[ Divisors[2n - 1], OddQ[ # ] && # != 1 & ], Select[ Divisors[2n + 1], OddQ[ # ] && # != 1 & ], 2n/Select[ Divisors[ 2n], OddQ[ # ] && # != 1 &]]], # < n &]; Table[ Plus @@ antid[n], {n, 70}] (* Robert G. Wilson v, Mar 15 2004 *)
    a066417[n_Integer] := Total[Cases[Range[2, n - 1], ?(Abs[Mod[n, #] - #/2] < 1 &)]]; Array[a066417, 120] (* _Michael De Vlieger, Aug 08 2014, after Harvey P. Dale at A066272 *)
  • PARI
    al(n)=Vec(sum(k=1,n,2*k*(x^(3*k)+x*O(x^n))/(1-x^(2*k))+(2*k+1)*(x^(3*k+1)+x^(3*k+2)+x*O(x^n))/(1-x^(2*k+1)))) \\ Franklin T. Adams-Watters, Sep 11 2009
    
  • PARI
    { a(n) = my(k); if(n>1, k=valuation(n,2); sigma(2*n+1)+sigma(2*n-1)+sigma(n/2^k)*2^(k+1)-6*n-2, 0); } \\ Max Alekseyev, Apr 27 2010
    
  • Python
    from sympy import divisors
    A066417 = [sum([2*d for d in divisors(n) if n > 2*d and n%(2*d)] + [d for d in divisors(2*n-1) if n > d >=2 and n%d] + [d for d in divisors(2*n+1) if n > d >=2 and n%d]) for n in range(1,10**6)] # Chai Wah Wu, Aug 12 2014

Formula

G.f.: Sum_{k>0} (2k x^(3k) / (1 - x^(2k)) + (2k+1)(x^(3k+1) + x^(3k+2)) / (1 - x^(2k+1))). - Franklin T. Adams-Watters, Sep 11 2009
For n>1, a(n) = A000203(2*n-1) + A000203(2*n+1) + A000203(n/2^k)*2^(k+1) - 6*n - 2, where k=A007814(n). - Max Alekseyev, Apr 27 2010
Sum_{k=1..n} a(k) ~ c * n^2, where c = 3*Pi^2/8 - 3 = 0.70110165... . - Amiram Eldar, Jan 19 2024

A066452 Anti-phi(n).

Original entry on oeis.org

1, 1, 2, 1, 4, 1, 4, 4, 3, 2, 8, 3, 7, 7, 9, 2, 8, 5, 10, 10, 8, 6, 19, 6, 12, 9, 9, 8, 22, 9, 12, 12, 15, 10, 31, 9, 11, 14, 24, 13, 23, 9, 24, 17, 16, 10, 35, 15, 23, 25, 20, 12, 40, 17, 34, 21, 18, 14, 37, 17, 24, 25, 41, 20, 39, 14, 31, 34, 33, 18, 42, 16, 32, 37, 41, 18, 44, 25
Offset: 2

Views

Author

Jon Perry, Dec 29 2001

Keywords

Comments

anti-phi(n) = the number of integers < n that are not divisible by any anti-divisor of n.
The old definition given for this sequence was: anti-phi(n) = number of integers <= n that are coprime to the anti-divisors of n. However this does not match the entries.
See A066272 for definition of anti-divisor.

Examples

			10 has anti-divisors 3,4,7. The numbers not divisible by any of 3,4,7 and less than 10 are 1,2,5. Therefore anti-phi(10)=3.
		

Crossrefs

Programs

  • Maple
    # needs antidivisors() as implemented in A066272
    A066452 := proc(n)local ad,isad,j,k,totad:ad:=antidivisors(n):totad:=0:for j from 1 to n-1 do isad:=1:for k from 1 to nops(ad) do if(j mod ad[k]=0)then isad:=0:break: fi:od:totad:=totad+isad:od:return totad:end:
    seq(A066452(n), n=2..50); # Nathaniel Johnston, Apr 20 2011
  • PARI
    antidiv(n) = {my(v = []); for (k=2, n-1, if (abs((n % k) - k/2) < 1, v = concat(v, k));); v;}
    a(n) = {my(vad = antidiv(n)); my(nbad = 0); for (j=1, n-1, isad = 1; for (k=1, #vad, if ((j % vad[k]) == 0, isad = 0; break); ); nbad += isad;); nbad;} \\ Michel Marcus, Feb 25 2016
  • Python
    def A066452(n):
        return len([x for x in range(1,n) if all([x % d  for d in range(2,n) if (n % d) and (2*n) % d in [d-1,0,1]])]) # Chai Wah Wu, Aug 07 2014
    

Extensions

Better definition and more terms from Diana L. Mecum, Jul 01 2007

A066241 1 + number of anti-divisors of n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Dec 31 2001

Keywords

Comments

See A066272 for definition of anti-divisor.

Examples

			For example, n = 18: 2n-1, 2n, 2n+1 are 35, 36, 37 with odd divisors > 1 {3,7,35}, {3,9}, {37} and quotients 7, 5, 1, 12, 4, 1, so the anti-divisors of 12 are 4, 5, 7, 12. Therefore a(18) = 1 + 4 = 5.
		

Crossrefs

Cf. A058838. Equals 1 + A066272(n).

Programs

  • Mathematica
    antid[n_] := Select[ Union[ Join[ Select[ Divisors[2n - 1], OddQ[ # ] && # != 1 &], Select[ Divisors[2n + 1], OddQ[ # ] && # != 1 &], 2n/Select[ Divisors[2*n], OddQ[ # ] && # != 1 &]]], # < n &]; Table[ Length[ antid[n]] + 1, {n, 1, 100} ]

Extensions

More terms from Robert G. Wilson v, Jan 03 2002

A066418 Numbers k for which phi(k) + anti-phi(k) = k.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 8, 12, 15, 27, 30, 40, 44, 57, 117, 128, 171, 236, 399, 408, 510, 1623, 3597, 3915, 4616, 4684, 7335, 10197, 10768, 14144, 32768, 39387, 76035, 77097, 106605, 162450, 196080, 219966, 391696
Offset: 1

Views

Author

Jon Perry, Dec 28 2001

Keywords

Comments

Anti-phi(n) (A066452) is the number of numbers coprime to all the anti-divisors of n.
See A066272 for definition of anti-divisor.

Examples

			The anti-divisors of 7 are 1, 2, 3 and 5. Therefore of the integer 1-6, only 1 is coprime to 2, 3 and 5, therefore anti-phi(7)=1. phi(7)=6, therefore anti-phi(7)+phi(7)=7
		

Crossrefs

Extensions

a(21)-a(34) from Nathaniel Johnston, Apr 20 2011
a(35)-a(39) from Amiram Eldar, Jan 12 2020

A066416 Number of numbers m such that the sum of the anti-divisors of m is n+1.

Original entry on oeis.org

0, 1, 1, 1, 1, 0, 0, 2, 0, 1, 0, 1, 1, 2, 0, 1, 0, 2, 1, 0, 0, 1, 1, 3, 0, 0, 0, 2, 0, 1, 0, 1, 0, 1, 0, 2, 0, 0, 1, 1, 1, 3, 0, 0, 0, 2, 0, 1, 0, 1, 0, 3, 0, 1, 1, 3, 1, 3, 0, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, 1, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 0, 0, 2, 0, 2, 0, 2
Offset: 1

Views

Author

Jon Perry, Dec 28 2001

Keywords

Comments

See A066272 for definition of anti-divisor.

Examples

			8 has anti-divisors 1, 3 and 5, whose sum is 9 and 9 has anti-divisors 1, 2 and 6, whose sum is 9 and there are no others. Therefore a(8)=2.
		

Crossrefs

Showing 1-6 of 6 results.