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.

Previous Showing 21-30 of 40 results. Next

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).

A177748 First primes of record chains of consecutive primes such that all of them are evil (A027699).

Original entry on oeis.org

3, 257, 337, 4423, 4919, 30431, 66841, 514271, 14490383, 231234569, 325923613, 640085473, 1600993259, 7180164577, 8069913503, 86933359951, 284331217637, 1128352801153, 1209935587291, 2454267258251, 2945783287813
Offset: 1

Views

Author

Vladimir Shevelev, Dec 12 2010

Keywords

Comments

The first lengths of such chains of primes are: 2, 3, 5, 7, 8, 12, 16, ..., cf. A177801.

Examples

			257 is the first evil prime followed by two consecutive primes (263,269) which are also evil. Thus it is record length 3.
		

Crossrefs

Cf. A001969, A000069, A027697, A027699, A177798 (odious version), A177801.

Programs

  • PARI
    {l=0;sp=0;r=0; forprime( p=1, default(primelimit), if( norml2(binary(p))%2, l>r & !print1(sp", ") & r=l; l & l=0, l || sp=p; l++))} \\ M. F. Hasler, Dec 12 2010

Extensions

More terms from D. S. McNeil, Dec 12 2010
a(18)-a(21) from Amiram Eldar, Dec 09 2020

A194991 Primes whose squares are odious.

Original entry on oeis.org

2, 5, 7, 11, 17, 19, 23, 29, 31, 41, 43, 59, 67, 71, 79, 89, 97, 101, 103, 113, 127, 131, 139, 149, 157, 163, 167, 173, 179, 181, 193, 197, 223, 227, 229, 239, 251, 257, 263, 271, 283, 307, 313, 349, 353, 373, 379, 383, 389, 401, 409, 421, 431, 433, 439, 449, 457, 467, 479, 487, 509, 523, 547, 563
Offset: 1

Views

Author

Vladimir Shevelev, Sep 07 2011

Keywords

Comments

Subsequence of the numbers 1, 2, 4, 5, 7, 8, 9, 10, 11, 14, 16, 17, 18, 19, 20, 22, 23, 25, 28, 29, 31, 32, 33, ... which have odious squares. See A235331. - R. J. Mathar, Sep 20 2011

Crossrefs

Programs

A227930 Primes p such that p-1 and p+1 have an even Hamming weight.

Original entry on oeis.org

11, 19, 47, 59, 67, 79, 107, 131, 179, 191, 211, 227, 239, 251, 271, 283, 307, 331, 367, 379, 419, 431, 443, 463, 491, 499, 563, 587, 659, 719, 787, 827, 859, 883, 911, 947, 971, 1019, 1039, 1051, 1087, 1123, 1163, 1171, 1187, 1231, 1259, 1279, 1291, 1327, 1423, 1451, 1459, 1471, 1483
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Oct 06 2013

Keywords

Comments

Primes such that both neighbors are evil (as defined in A001969).
From Antti Karttunen, Dec 29 2013: (Start)
Excluding 2, the intersection of A027697 (Odious primes: primes with odd number of 1's in binary expansion) and A095282 (Primes whose binary-expansion ends with an even number of 1's).
Equally, the intersection of A092246 (Odd "odious" numbers) and A095282.
Equally, odd odious primes p such that A007814(p+1) is even.
(End)

Crossrefs

Subsequence of A002145.
Seems to consist of all primes in A233388.

Programs

  • Maple
    read("transforms"):
    isA000069 := proc(n)
        if wt(n) mod 2 = 1 then
            true;
        else
            false;
        end if;
    end proc:
    for n from 1 do
        if isprime(n) and not isA000069(n-1) and not isA000069(n+1) then
            printf("%d,",n) ;
        end if;
    end do: # R. J. Mathar, Oct 08 2013
    (Scheme, with Antti Karttunen's IntSeq-library, two alternative implementations)
    (define A227930 (MATCHING-POS 1 1 (lambda (n) (and (even? (A000120 (- n 1))) (even? (A000120 (+ n 1))) (prime? n)))))
    (define A227930v2 (MATCHING-POS 1 1 (lambda (n) (and (odd? n) (odd? (A000120 n)) (even? (A007814 (+ n 1))) (prime? n))))) # Antti Karttunen, Dec 29 2013
  • Mathematica
    Select[Prime[Range[250]], And @@ EvenQ[DigitCount[# + {-1, 1}, 2, 1]] &] (* Amiram Eldar, Jul 24 2023 *)
  • PARI
    is(n)=hammingweight(n-1)%2==0 && hammingweight(n+1)%2==0 && isprime(n) \\ Charles R Greathouse IV, Oct 09 2013

Extensions

Entries checked by R. J. Mathar, Oct 08 2013

A230070 a(n) is the number of odious integers (A000069) not exceeding n and respectively prime to n.

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 3, 2, 5, 2, 5, 3, 6, 3, 8, 4, 9, 4, 9, 5, 8, 5, 12, 5, 12, 6, 13, 5, 15, 5, 15, 8, 14, 8, 12, 8, 18, 9, 17, 8, 20, 8, 22, 10, 19, 11, 23, 11, 18, 11, 24, 12, 27, 12, 21, 10, 25, 14, 29, 11, 30, 15, 24, 16, 26, 13, 33, 17, 32, 12, 36, 16, 36
Offset: 1

Views

Author

Vladimir Shevelev, Oct 10 2013

Keywords

Comments

Let b(n) is the number of evil integers (A001969) not exceeding n and respectively prime to n. Then a(n) + b(n) = phi(n) (phi = A000010). For which numbers a(n) < b(n)? This sequence begins 28,... . For n = 1,2,3,15, we have a(n) = phi(n). What other solutions has this equation? When a(n) = phi(n)/2, we call n a balanced number. The sequence of balanced numbers begins 4,6,7,8,10,11,13,14,16,19,22,...

Examples

			For n = 30, we have the following numbers respectively prime to n: 1, 7, 11, 13, 17, 19, 23, 29, from which only 5 numbers 1, 7, 11, 13 and 19 are odious. So, a(30) = 5.
		

Crossrefs

Programs

  • Mathematica
    odiouses=Select[Range[rng=100],OddQ[DigitCount[#,2][[1]]]&]; tmp=1; Table[Count[Map[CoprimeQ[n,#]&, Take[odiouses, tmp=NestWhile[#+1&,tmp+1, odiouses[[#]]
    				
  • PARI
    a(n) = sum(k = 1, n, gcd(k, n) == 1 && hammingweight(k) % 2); \\ Amiram Eldar, Nov 10 2024

Formula

For odd prime p, a(p) = (p + 1 or - 1)/2. Primes p for which a(p) = (p+1)/2 are 3, 5, 17, 23, 29,..., i.e., evil primes (A027699), while odd primes p for which a(p) = (p-1)/2 are 7,11,13,19,..., i.e., odious primes (A027697).

A230095 Odious numbers (A000069) that are the product of exactly two distinct primes.

Original entry on oeis.org

14, 21, 22, 26, 35, 38, 55, 62, 69, 74, 82, 87, 91, 93, 94, 115, 118, 122, 133, 134, 143, 145, 146, 155, 158, 161, 185, 194, 203, 205, 206, 213, 214, 217, 218, 247, 253, 254, 259, 262, 265, 274, 295, 299, 301, 302, 309, 314, 319, 321, 327, 334, 339, 341, 346
Offset: 1

Views

Author

N. J. A. Sloane, Oct 11 2013

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Range[400],OddQ[DigitCount[#,2,1]]&&PrimeNu[#]==PrimeOmega[#]==2&] (* Harvey P. Dale, May 21 2024 *)
  • PARI
    isodious(n)=b = binary(n); sum(i=1, #b, b[i]==1) % 2;
    isok(n) = isodious(n) && (bigomega(n)==2) && (omega(n)==2); \\ Michel Marcus, Oct 12 2013
    
  • PARI
    list(lim)=my(v=List()); forprime(p=2,lim\2, forprime(q=2,min(lim\p,p-1), if(hammingweight(p*q)%2, listput(v,p*q)))); Set(v) \\ Charles R Greathouse IV, Jan 31 2017

Extensions

More terms from Michel Marcus, Oct 12 2013

A232667 Primes p such that the p-th odious number is prime; odious primes p such that 2p-1 is prime.

Original entry on oeis.org

2, 7, 19, 31, 37, 79, 97, 157, 199, 211, 229, 271, 307, 331, 367, 379, 439, 499, 577, 601, 607, 661, 727, 829, 877, 967, 997, 1009, 1069, 1171, 1279, 1459, 1531, 1609, 1627, 1657, 1759, 1867, 2011, 2029, 2131, 2137, 2311, 2551, 2557, 3037, 3061, 3109, 3169, 3181
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Nov 27 2013

Keywords

Comments

From Antti Karttunen, Nov 29 & 30 2013: (Start)
This sequence is the intersection of A005382 and A027697.
Proof:
A000069(n) reduces according to the bit parity of n-1 as follows:
A000069(n) = 2n - 2 when n-1 is odious.
A000069(n) = 2n - 1 when n-1 is evil.
which means that no prime in this sequence can be evil, as then p-1 would be an odious number (true for all odd primes) and A000069(p) would be 2(p-1) which obviously cannot be a prime, contradicting the requirement. Thus all primes present must belong to the set of odious primes, A027697.
As each prime p here is thus odious, it means that each p-1 is an evil number (A001969), and thus A000069(p) = 2p-1. And the stipulation that it also must be prime, is just what is required from the terms of A005382. Thus this sequence contains exactly those primes that occur in both A005382 and A027697.
Equally: this is the intersection of A000069 and A005382, thus prime p occurs here iff A000120(p) is odd and 2p-1 is prime also.
Also, apart from the first term (2), all the primes (2*a(n))-1 are also odious. This follows because for any odd number k, A000120(2k-1) = A000120(k).
(End)

Examples

			7 is a prime and A000069(7) = 13, a prime also, thus 7 is in this sequence.
19 is a prime and A000069(19) = 37, a prime also, thus 19 is in this sequence.
Alternatively:
7 is a prime, 2*7-1 = 13 is also prime, and when written in binary, 7 = '111', with an odd number of 1-bits. Thus 7 is included in this sequence.
The next time this happens, is for 19, as it is a prime, 2*19-1 = 37 is also prime, and when written in binary, 19 = '10011', also has on odd number of 1-bits.
		

Crossrefs

Extensions

Edited and erroneous terms removed by Antti Karttunen, Nov 29-30 2013

A291762 Restricted growth sequence transform of ((-1)^A000120(n))*A046523(n); filter combining the parity of binary weight with the prime signature of n.

Original entry on oeis.org

1, 2, 3, 4, 3, 5, 2, 6, 7, 5, 2, 8, 2, 9, 5, 10, 3, 8, 2, 8, 9, 9, 3, 11, 4, 9, 12, 13, 3, 14, 2, 15, 5, 5, 9, 16, 2, 9, 5, 11, 2, 17, 3, 13, 8, 5, 2, 18, 4, 13, 5, 13, 3, 11, 9, 19, 5, 5, 2, 20, 2, 9, 8, 21, 5, 14, 2, 8, 9, 17, 3, 22, 2, 9, 8, 13, 5, 14, 2, 18, 10, 9, 3, 23, 5, 5, 9, 19, 3, 20, 9, 8, 9, 9, 5, 24, 2, 13, 8, 25, 3, 14, 2, 19, 14, 5, 2, 22, 2, 17
Offset: 1

Views

Author

Antti Karttunen, Sep 11 2017

Keywords

Comments

Equally, restricted growth sequence transform of sequence b defined as b(1) = 1; b(n) = A046523(n) + A010060(n) for n > 1, which starts as 1, 3, 2, 5, 2, 6, 3, 9, 4, 6, 3, 12, 3, 7, 6, 17, 2, 12, 3, 12, 7, 7, ...

Crossrefs

Cf. A101296, A286163, A291761 (related or similar filtering sequences).
Cf. A027697 (positions of 2's), A027699 (of 3's), A130593 (of 5's and 7's), A230095 (of 9's).
Cf. also A231431, A235001.

Programs

  • PARI
    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])); }
    A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); };  \\ This function from Charles R Greathouse IV, Aug 17 2011
    write_to_bfile(1,rgs_transform(vector(65537,n,((-1)^hammingweight(n))*A046523(n))),"b291762_upto65537.txt");
    \\ Or alternatively:
    A010060(n) = (hammingweight(n)%2);
    f(n) = if(1==n,n,A046523(n)+A010060(n));
    write_to_bfile(1,rgs_transform(vector(16385,n,f(n))),"b291762.txt");

A176620 Primes p for which the factorization of p! over distinct terms of A050376 does not contain 2.

Original entry on oeis.org

7, 11, 13, 19, 31, 37, 41, 47, 59, 61, 67, 73, 79, 97, 103, 107, 109, 127, 131, 137, 151, 157, 167, 173, 179, 181, 191, 193, 199, 211, 223, 227, 229, 233, 239, 241, 251, 271, 283, 307, 313, 331, 367, 379, 397, 409, 419, 421, 431, 433, 439, 443, 457, 463, 487
Offset: 1

Views

Author

Vladimir Shevelev, Apr 22 2010

Keywords

Comments

Equivalent definition: primes p for which A007814(p!) is even. Apparently, the sequence is A027697 without the 2 (see A014499). [R. J. Mathar, Oct 26 2010]

Crossrefs

Programs

  • Mathematica
    Select[Range[500], PrimeQ[#] && EvenQ @ IntegerExponent[#!, 2] &]  (* Amiram Eldar, Sep 13 2019 *)

Extensions

Corrected (37 added, 41 added, 43 removed...) and extended by R. J. Mathar, Oct 26 2010

A177800 The maximal length of the chain of consecutive primes starting with A177798(n) such that all of them are odious.

Original entry on oeis.org

1, 3, 6, 9, 11, 15, 17, 18, 22, 23, 25, 26, 28, 29, 33, 34, 35, 36, 38, 39, 42
Offset: 1

Views

Author

Vladimir Shevelev, Dec 12 2010

Keywords

Comments

In contrast to sequence of all positive integers, where the length of a chain of consecutive odious numbers cannot exceed 2, we conjecture that over primes the length is not bounded.

Crossrefs

Cf. A000069 (odious numbers), A177798, A177748, A001969, A027697, A027699.

Extensions

Extended by D. S. McNeil, Dec 12 2010
a(20)-a(21) from Amiram Eldar, Dec 09 2020
Previous Showing 21-30 of 40 results. Next