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

A356020 Positions of records in A356018, i.e., integers whose number of evil divisors sets a new record.

Original entry on oeis.org

1, 3, 6, 12, 18, 30, 60, 90, 120, 180, 360, 540, 720, 1080, 1440, 2160, 3780, 4320, 6120, 7560, 8640, 12240, 15120, 24480, 27720, 30240, 36720, 48960, 50400, 55440, 73440, 83160, 110880, 128520, 138600, 166320, 221760, 257040, 277200, 332640, 471240, 514080, 554400
Offset: 1

Views

Author

Bernard Schott, Jul 24 2022

Keywords

Comments

Corresponding records of number of evil divisors are 0, 1, 2, 3, 4, 6, 9, 10, 12, 15, ...

Examples

			60 is in the sequence because A356018(60) = 9 is larger than any earlier value in A356018.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := DivisorSum[n, 1 &, EvenQ[DigitCount[#, 2, 1]] &]; fm = -1; s = {}; Do[If[(fn = f[n]) > fm, fm = fn; AppendTo[s, n]], {n, 1, 10^5}]; s (* Amiram Eldar, Jul 24 2022 *)
  • PARI
    upto(n) = my(res = List(), r=-1); forfactored(i=1, n, if(numdiv(i[2]) > r, d = divisors(i[2]); c=sum(j=1, #d, isevil(d[j])); if(c>r, r=c; listput(res,i[1])))); res
    isevil(n) = bitand(hammingweight(n), 1)==0 \\ David A. Corneth, Jul 24 2022
    
  • Python
    from sympy import divisors
    from itertools import count, islice
    def c(n): return bin(n).count("1")&1 == 0
    def f(n): return sum(1 for d in divisors(n, generator=True) if c(d))
    def agen(record=-1):
        for k in count(1):
            if f(k) > record: record = f(k); yield k
    print(list(islice(agen(), 40))) # Michael S. Branicky, Jul 24 2022

Extensions

More terms from Amiram Eldar, Jul 24 2022

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

A227872 Number of odious divisors (A000069) of n.

Original entry on oeis.org

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

Views

Author

Vladimir Shevelev, Oct 25 2013

Keywords

Crossrefs

Programs

  • Maple
    A227872 := proc(n)
        option remember ;
        local a,d ;
        a := 0 ;
        for d in numtheory[divisors](n) do
            if not isA001969(d) then
                a := a+1 ;
            end if;
        end do:
        a ;
    end proc:
    seq(A227872(n),n=1..200) ; # R. J. Mathar, Aug 07 2022
  • Mathematica
    a[n_] := DivisorSum[n, 1 &, OddQ[DigitCount[#, 2, 1]] &]; Array[a, 100] (* Amiram Eldar, Jul 23 2022 *)
  • PARI
    a(n) = sumdiv(n, d, hammingweight(d) % 2); \\ Michel Marcus, Feb 06 2016
    
  • PARI
    isod(n) = hammingweight(n) % 2; \\ A000069
    a(n) = my(v=valuation(n, 2)); n >>= v; sumdiv(n,d,isod(d)) * (v+1) \\ David A. Corneth, Jul 23 2022
    
  • Python
    from sympy import divisors
    def c(n): return bin(n).count("1")&1
    def a(n): return sum(1 for d in divisors(n, generator=True) if c(d))
    print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Jul 23 2022

Formula

a(n) + A356018(n) = A000005(n).
a(2^n) = n+1. - Bernard Schott, Jul 22 2022
a(n) = 1 iff n is in A093688. - Bernard Schott, Jul 23 2022
a(n) = Sum_{d|n} A010060(d). - Ridouane Oudra, Apr 12 2025

Extensions

More terms from Peter J. C. Moses, Oct 25 2013

A093696 Numbers n such that all divisors of n have an odd number of 1's in their binary expansions.

Original entry on oeis.org

1, 2, 4, 7, 8, 11, 13, 14, 16, 19, 22, 26, 28, 31, 32, 37, 38, 41, 44, 47, 49, 52, 56, 59, 61, 62, 64, 67, 73, 74, 76, 79, 82, 88, 91, 94, 97, 98, 103, 104, 107, 109, 112, 118, 121, 122, 124, 127, 128, 131, 133, 134, 137, 143, 146, 148, 151, 152, 157, 158, 164, 167, 173
Offset: 1

Views

Author

Jason Earls, May 16 2004

Keywords

Comments

Subsequence of A000069. - Michel Marcus, Feb 09 2014
Numbers all of whose divisors are odious. - Bernard Schott, Jul 22 2022

Examples

			14 is in the sequence because its divisors are [1, 2, 7, 14] and in binary: 1, 10, 111 and 1110, all have an odd number of 1's.
		

Crossrefs

Similar sequences: A062687, A190217, A337741, A337941, A355596.
A000079 is a subsequence.

Programs

  • Maple
    isA001969 := proc(n)
        if wt(n) mod 2 = 0 then
            true;
        else
            false;
        end if;
    end proc:
    isA093696 := proc(n)
        for d in numtheory[divisors](n) do
            if isA001969(d) then
                return false;
            end if;
        end do;
        true;
    end proc:
    for n from 1 to 200 do
        if isA093696(n) then
            printf("%d,",n);
        end if;
    end do: # R. J. Mathar, Feb 13 2014
  • Mathematica
    odiousQ[n_] := OddQ @ DigitCount[n, 2][[1]]; Select[Range[200], AllTrue[ Divisors[#], odiousQ ] &] (* Amiram Eldar, Dec 09 2019 *)
  • PARI
    is(n)=fordiv(n,d,if(hammingweight(d)%2==0, return(0))); 1 \\ Charles R Greathouse IV, Mar 29 2013
    
  • Python
    from sympy import divisors, isprime
    def c(n): return bin(n).count("1")&1
    def ok(n): return n > 0 and all(c(d) for d in divisors(n, generator=True))
    print([k for k in range(174) if ok(k)]) # Michael S. Branicky, Jul 24 2022

Formula

{n: A356018(n) =0 }. - R. J. Mathar, Aug 07 2022

A093688 Numbers m such that all divisors of m, excluding the divisor 1, have an even number of 1's in their binary expansions.

Original entry on oeis.org

1, 3, 5, 9, 15, 17, 23, 27, 29, 43, 45, 51, 53, 71, 83, 85, 89, 101, 113, 129, 135, 139, 149, 153, 159, 163, 197, 215, 249, 255, 257, 263, 267, 269, 277, 281, 293, 303, 311, 317, 337, 347, 349, 353, 359, 373, 383, 387, 389, 401, 417, 447, 449, 459, 461, 467, 479
Offset: 1

Views

Author

Jason Earls, May 16 2004

Keywords

Comments

Putting the 1 aside, these could be called odiousfree numbers, and are a subsequence of A001969. A093696 would be the evilfree numbers then. - Irina Gerasimova, Feb 08 2014.
Equivalently, numbers all of whose divisors > 1 are evil (A001969). - Bernard Schott, Jul 24 2022

Examples

			51 is in the sequence because, excluding 1, its divisors are 3, 17 and 51.
In binary: 11, 10001, 110011 all have an even number of 1's.
		

Crossrefs

Programs

  • Mathematica
    okQ[n_] := AllTrue[Rest[Divisors[n]], EvenQ[Total[IntegerDigits[#, 2]]]&]; Select[Range[500], okQ] (* Jean-François Alcover, Dec 06 2015 *)
  • PARI
    is(n)=sumdiv(n,d,hammingweight(d)%2)==1 \\ Charles R Greathouse IV, Mar 28 2013
    
  • Python
    from sympy import divisors
    def c(n): return n == 1 or bin(n).count("1")&1 == 0
    def ok(n): return n > 0 and all(c(d) for d in divisors(n, generator=True))
    print([k for k in range(480) if ok(k)]) # Michael S. Branicky, Jul 24 2022

Extensions

a(1) added by Charles R Greathouse IV, Mar 28 2013

A356019 a(n) is the smallest number that has exactly n evil divisors (A001969).

Original entry on oeis.org

1, 3, 6, 12, 18, 45, 30, 135, 72, 60, 90, 765, 120, 1575, 270, 180, 600, 3465, 480, 13545, 360, 540, 1530, 10395, 1260, 720, 3150, 1980, 1080, 49725, 1440, 45045, 2520, 3060, 6930, 2160, 3780, 58905, 27090, 6300, 5040, 184275, 4320, 135135, 6120, 7920, 20790, 329175, 7560, 8640
Offset: 0

Views

Author

Bernard Schott, Jul 23 2022

Keywords

Comments

Differs from A327328 since a(7) = 135 while A327328(7) = 105.

Examples

			a(4) = 18 since 18 has six divisors: {1, 2, 3, 6, 9, 18} of which four {3, 6, 9, 18} have an even number of 1's in their binary expansion: 11, 110, 1001 and 10010 respectively; also, no positive integer smaller than 18 has exactly four divisors that are evil.
		

Crossrefs

Programs

  • Maple
    # output in unsorted b-file style
    A356019_list := [seq(0,i=1..1000)] ;
    for n from 1 do
        evd := A356018(n) ;
        if evd < nops(A356019_list) then
            if op(evd+1,A356019_list) <= 0 then
                printf("%d %d\n",evd,n) ;
                A356019_list := subsop(evd+1=n,A356019_list) ;
            end if;
        end if;
    end do:  # R. J. Mathar, Aug 07 2022
  • Mathematica
    f[n_] := DivisorSum[n, 1 &, EvenQ[DigitCount[#, 2, 1]] &]; seq[len_, nmax_] := Module[{s = Table[0, {len}], c = 0, n = 1, i}, While[c < len && n < nmax, i = f[n] + 1; If[i <= len && s[[i]] == 0, c++; s[[i]] = n]; n++]; s]; seq[50, 10^6] (* Amiram Eldar, Jul 23 2022 *)
  • Python
    from sympy import divisors
    from itertools import count, islice
    def c(n): return bin(n).count("1")&1 == 0
    def f(n): return sum(1 for d in divisors(n, generator=True) if c(d))
    def agen():
        n, adict = 0, dict()
        for k in count(1):
            fk = f(k)
            if fk not in adict: adict[fk] = k
            while n in adict: yield adict[n]; n += 1
    print(list(islice(agen(), 50))) # Michael S. Branicky, Jul 23 2022

Formula

a(n) <= A356040(n). - David A. Corneth, Jul 26 2022

Extensions

More terms from Amiram Eldar, Jul 23 2022
Showing 1-7 of 7 results.