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.

A357761 a(n) = A227872(n) - A356018(n).

Original entry on oeis.org

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

Views

Author

Amiram Eldar, Oct 12 2022

Keywords

Comments

The excess of the number of odious (A000069) divisors of n over the number of evil (A001969) divisors of n.
Every integer occurs in this sequence.

Crossrefs

Cf. A000005, A000069, A000290 (positions of odd terms), A001969, A027697, A027699, A106400, A227872, A230851 (positions of 0's), A356018, A357762.
Similar sequences: A046660, A048272.

Programs

  • Mathematica
    a[n_] := -DivisorSum[n, (-1)^DigitCount[#, 2, 1] &]; Array[a, 100]
  • PARI
    a(n) = -sumdiv(n, d, (-1)^hammingweight(d));

Formula

a(n) = -Sum_{d|n} A106400(d).
a(n) = A000005(n) - 2*A356018(n).
a(n) = 2*A227872(n) - A000005(n).
a(n) = 0 iff n is in A230851.
a(n) == 1 (mod 2) iff n is a square (A000290).
a(2^n) = n + 1.
a(p*2^n) = 0 when p is an evil prime (A027699).
a(p^2*2^n) = n + 1 when p is an evil prime (A027699) and p^2 is odious, and when p is an odd odious prime (A027697) and p^2 is evil.
a(p^2*2^n) = -(n+1) when p is an evil prime and p^2 is also evil.
a(p^2*2^n) = 3*(n+1) when p is an odd odious prime and p^2 is also odious.
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = -Sum_{k>=1} A106400(k)/k = 1.196283264... (A357762).

A356040 a(n) is the smallest integer that has exactly n odious divisors (A227872) and n evil divisors (A356018).

Original entry on oeis.org

3, 6, 12, 24, 48, 96, 192, 210, 252, 528, 3072, 420, 12288, 2112, 1008, 840, 196608, 2016, 786432, 1680, 4032, 33792, 12582912, 3360, 30000, 135168, 16128, 6720, 805306368, 19152, 3221225472, 13440, 64512, 2162688, 120000, 26880, 206158430208, 8650752, 258048, 31920
Offset: 1

Views

Author

Bernard Schott, Jul 24 2022

Keywords

Comments

As the number of divisors is even, there is no square in the sequence.

Examples

			48 has ten divisors, five of which are odious {1, 2, 4, 8, 16} as they have an odd number of 1's in their binary expansion: 1, 10, 100, 1000 and 10000; the five other divisors are evil {3, 6, 12, 24, 48} as they have an even number of 1's in their binary expansion: 11, 110, 1100, 11000 and 110000; also, no positive integer smaller than 48 has five divisors that are evil and five divisors that are odious, hence a(5) = 48.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := DivisorSum[n, {1, (-1)^DigitCount[#, 2][[1]]} &]; seq[len_, nmax_] := Module[{s = Table[0, {len}], c = 0, n = 1, i, d}, While[c < len && n < nmax, i = f[n]; If[i[[2]] == 0, d = i[[1]]/2; If[d <= len && s[[d]] == 0, c++; s[[d]] = n]]; n++]; s]; seq[16, 10^6] (* Amiram Eldar, Jul 24 2022 *)
  • PARI
    a(n) = if(isprime(n), return(2^(n-1)*3)); forfactored(i=1, 2^(n-1)*3, if(numdiv(i[2]) == 2*n, d=divisors(i[2]); if(sum(j=1, #d, isevil(d[j])) == n, return(i[1]))))
    isevil(n) = bitand(hammingweight(n), 1) == 0 \\ David A. Corneth, Jul 24 2022
    
  • Python
    from sympy import divisors, isprime
    from itertools import count, islice
    def f(n):
        counts = [0, 0]
        for d in divisors(n, generator=True):
            counts[bin(d).count("1")&1] += 1
        return counts[0] if counts[0] == counts[1] else -1
    def a(n):
        if isprime(n): return 2**(n-1) * 3
        return next(k for k in count(1) if f(k) == n)
    print([a(n) for n in range(1, 34)]) # Michael S. Branicky, Jul 24 2022

Formula

a(n) <= 2^(n-1) * 3.
a(n) = 2^(n-1) * 3 if n is prime. - David A. Corneth, Jul 24 2022
a(n) >= A005179(2*n). - Michael S. Branicky, Jul 24 2022

Extensions

a(9)-a(37) from Amiram Eldar, Jul 24 2022
a(38)-a(40) from David A. Corneth, Jul 24 2022

A230902 Positive numbers such that half of the set of divisors are of the form x^2 + x*y + y^2 (A003136) and half not (A034020).

Original entry on oeis.org

2, 5, 6, 8, 11, 14, 15, 17, 18, 23, 24, 26, 29, 32, 33, 35, 38, 41, 42, 45, 47, 51, 53, 54, 56, 59, 62, 65, 69, 71, 72, 74, 77, 78, 83, 86, 87, 89, 95, 96, 98, 99, 101, 104, 105, 107, 113, 114, 119, 122, 123, 125, 126, 128, 131, 134, 135, 137, 141, 143, 146, 149, 152, 153, 155, 158, 159, 161, 162
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Oct 31 2013

Keywords

Examples

			Triangle read by rows in which row n lists the divisors of n begins:
1(0^2+0*1+1^2);
1(0^2+0*1+1^2), 2;
1(0^2+0*1+1^2), 3(1^1+1*1+1^2);
1(0^2+0*1+1^2), 2, 4(0^2+0*2+2^2);
1(0^2+0*1+1^2), 5;
1(0^2+0*1+1^2), 2, 3(1^1+1*1+1^2), 6;
1(0^2+0*1+1^2), 7(1^1+1*2+2^2);
1(0^2+0*1+1^2), 2, 4(0^2+0*2+2^2), 8;
1(0^2+0*1+1^2), 3(1^1+1*1+1^2), 9;
1(0^2+0*1+1^2), 2, 5, 10;
1(0^2+0*1+1^2), 11;
1(0^2+0*1+1^2), 2, 3(1^1+1*1+1^2), 4(0^2+0*2+2^2), 6, 12(2^2+2*2+2^2);
1(0^2+0*1+1^2), 13(1^2+1*3+3^2);
1(0^2+0*1+1^2), 2, 7(1^1+1*2+2^2), 14;
1(0^2+0*1+1^1), 3(1^11+1*1+1^2), 5, 15,
i.e. a(1)=2, a(2)=5, a(3)=6, a(4)=8, a(5)=11, a(6)=14, a(7)=15.
		

Crossrefs

Cf. A027750, A230851. Subsequence of A000037.

Programs

  • Maple
    isA003136 := proc(n)
        local x,y ;
        for x from 0 do
            if x^2 > n then
                return false;
            end if;
            for y from 0 do
                if x^2+x*y+y^2 = n then
                    return true;
                elif x^2+x*y+y^2 > n then
                    break;
                end if;
            end do:
        end do:
    end proc:
    isA230902 := proc(n)
        local a36,a20,d ;
        a36 := 0 ;
        a20 := 0 ;
        for d in numtheory[divisors](n) do
            if isA003136(d) then
                a36 := a36+1 ;
            else
                a20 := a20+1 ;
            end if;
        end do:
        simplify( a36=a20) ;
    end proc:
    for n from 0 to 200 do
        if isA230902(n) then
        printf("%d,",n);
        end if;
    end do: # R. J. Mathar, Nov 08 2013
  • Mathematica
    A003136Q[n_] := Resolve[Exists[{x, y}, Reduce[n == x^2 + x*y + y^2, {x, y}, Integers]]];
    okQ[n_] := With[{dd = Divisors[n]}, 2 Count[dd, _?A003136Q] == Length[dd]];
    Select[Range[200], okQ] (* Jean-François Alcover, Jun 07 2024 *)

Extensions

Corrected by R. J. Mathar, Nov 08 2013
Showing 1-3 of 3 results.