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

A094695 Numbers having in binary representation fewer ones than in their squares.

Original entry on oeis.org

5, 9, 10, 11, 13, 17, 18, 19, 20, 21, 22, 25, 26, 27, 29, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 61, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 93, 97, 98, 99
Offset: 1

Views

Author

Reinhard Zumkeller, May 20 2004

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Range[100],DigitCount[#,2,1]Harvey P. Dale, May 29 2017 *)

Formula

A000120(a(n)) < A000120(A000290(a(n))).

A232243 a(n) = wt(n^2) - wt(n), where wt(n) = A000120(n) is the binary weight function.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 1, 2, 1, 3, 2, -1, 0, 2, 1, 2, 0, 1, 0, 0, 0, 1, 1, 2, 1, 3, 2, 3, 1, 2, 3, 3, 2, 4, -1, -1, 0, 2, 2, 1, 1, 4, 2, 2, 0, 2, 1, 2, 0, 1, 0, 0, 0, 1, 1, 2, 1, 3, 2, 3, 1, 3, 3, 5, 2, 3, 3, 0, 1, 3, 2, 4, 3, 3, 3, 2, 2, 5, 4, 0, -1, 1, -1, -1, 0, 2, 2, 2
Offset: 0

Views

Author

Jon Perry, Nov 20 2013

Keywords

Comments

A077436 lists n for which a(n) = 0.
A094694 lists n for which a(n) < 0.

Examples

			a(5): 5 = 101_2, 25 = 11001_2, so a(5) = 3 - 2 = 1.
a(23): 23 = 10111_2, 529 = 10001001_2, so a(23) = 3 - 4 = -1.
		

Crossrefs

Programs

  • JavaScript
    function bitCount(n) {
       var i,c,s;
       c=0;
       s=n.toString(2);
       for (i=0;i
    				
  • PARI
    a(n) = hammingweight(n^2) - hammingweight(n); \\ Michel Marcus, Mar 05 2023
  • Python
    def A232243(n): return (n**2).bit_count()-n.bit_count()
    print(list(A232243(n) for n in range(10**2)))  # Dumitru Damian, Mar 04 2023
    

Formula

a(n) = A159918(n) - A000120(n).

A236514 Primes with a binary weight greater than or equal to the binary weight of their squares.

Original entry on oeis.org

2, 3, 7, 23, 31, 47, 79, 127, 157, 191, 223, 317, 367, 379, 383, 479, 727, 751, 887, 1087, 1151, 1277, 1279, 1451, 1471, 1531, 1663, 1783, 1789, 1951, 2297, 2557, 2927, 3067, 3259, 3319, 3581, 3583, 3967, 4253, 4349, 5119, 5231, 5503, 5807, 5821, 6079, 6143, 6271, 6653, 6871, 6911, 7039, 7103, 7151
Offset: 1

Views

Author

Irina Gerasimova, Jan 27 2014

Keywords

Comments

Primes p such that A000120(p) = A000120(p^2): 2, 3, 7, 31, 79, 127, 157, 317, 379, 751, 1087, 1151, 1277, 1279,...

Examples

			2 is in this sequence because 2 is 10 in binary representation, and it has as many 1s as its square 4, which is 100 in binary.
		

Crossrefs

Programs

  • Mathematica
    bc[n_] := DigitCount[n, 2][[1]]; Select[Range[7151], PrimeQ[#] && bc[#] >= bc[#^2] &] (* Giovanni Resta, Jan 28 2014 *)
    Select[Prime[Range[1000]], DigitCount[#, 2, 1] >= DigitCount[#^2, 2, 1] &] (* Alonso del Arte, Jan 28 2014 *)
  • PARI
    is(n)=hammingweight(n^2)<=hammingweight(n) && isprime(n) \\ Charles R Greathouse IV, Mar 18 2014

Formula

Primes p such that A000120(p) >= A000120(p^2).

A351149 a(n) is the least exponent k such that the Hamming weight of n^(k+1) is not greater than the Hamming weight of n^k.

Original entry on oeis.org

1, 1, 1, 1, 3, 1, 1, 1, 3, 3, 5, 1, 7, 1, 1, 1, 3, 3, 4, 3, 2, 5, 1, 1, 4, 7, 5, 1, 5, 1, 1, 1, 3, 3, 7, 3, 4, 4, 3, 3, 5, 2, 5, 5, 3, 1, 1, 1, 5, 4, 7, 7, 2, 5, 3, 1, 3, 5, 2, 1, 3, 1, 1, 1, 3, 3, 4, 3, 5, 7, 3, 3, 3, 4, 3, 4, 3, 3, 1, 3, 5, 5, 3, 2, 3, 5, 11
Offset: 1

Views

Author

Hugo Pfoertner, Feb 07 2022

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{k = 1}, While[DigitCount[n^k, 2, 1] < DigitCount[n^(k + 1), 2, 1], k++]; k]; Array[a, 100] (* Amiram Eldar, Feb 07 2022 *)
  • PARI
    for(n=1,87, for(k=1,oo, my(hw1=hammingweight(n^k), hw2=hammingweight(n^(k+1))); if(hw2<=hw1, print1(k,", "); break)))
    
  • Python
    def A351149(n):
        k = 1
        while bin(n**k)[2:].count("1") < bin(n**(k+1))[2:].count("1"): k += 1
        return(k)
    print([A351149(n) for n in range(1, 88)]) # Karl-Heinz Hofmann, Feb 07 2022

A363799 Numbers whose binary representation has more 1-bits than its cube.

Original entry on oeis.org

407182835067, 445317119867, 478351981947, 814365670134, 873268508637, 890634239734, 956703963894, 956703964539, 1628731340268, 1746537017274, 1781268479468, 1913407927788, 1913407929078, 2774213097787, 3257462680536, 3493074034548, 3562536958936, 3573277243773
Offset: 1

Views

Author

Zhao Hui Du, Jun 23 2023

Keywords

Comments

a(n) must have more 1-bits than a(n)^3 when they are written in binary.

Examples

			407182835067 is a term because A000120(407182835067) = 29, while A192085(407182835067) = A000120(407182835067^3) = 28.
		

Crossrefs

Cf. A000120, A192085, A138597 (equality).
Cf. A094694 (for squares).

Programs

  • PARI
    isok(k) = hammingweight(k) > hammingweight(k^3); \\ Michel Marcus, Aug 07 2023

Extensions

a(9)-a(18) from Martin Ehrenstein, Jul 31 2023

A293655 Numbers having in binary representation more zeros than their squares.

Original entry on oeis.org

181, 5221, 11309, 19637, 21577, 22805, 43151, 69451, 74969, 76845, 82709, 83539, 85029, 86283, 86581, 91205, 148245, 165013, 165061, 165418, 166027, 170021, 172213, 172615, 173095, 173101, 173162, 173331, 180405, 182433, 184587, 184885, 185363, 201829, 282713
Offset: 1

Views

Author

Alex Ratushnyak, Feb 06 2018

Keywords

Examples

			181 in base 2 is 10110101, with 3 zeros, and 181^2 is 111111111111001, with 2 zeros.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[3*10^5], DigitCount[#, 2, 0] > DigitCount[#^2, 2, 0] &] (* Michael De Vlieger, Feb 21 2018 *)
  • PARI
    nbz(n) = my(b=binary(n)); #b - hammingweight(n);
    isok(n) = nbz(n) > nbz(n^2); \\ Michel Marcus, Feb 12 2018
  • Python
    def count0(n):
        return bin(n)[2:].count('0')
    for n in range(1000000):
        if count0(n*n) < count0(n):
            print(str(n), end=',')
    

A352291 Odd numbers k such that hammingweight(k^2) < hammingweight(k).

Original entry on oeis.org

23, 47, 95, 111, 191, 223, 367, 383, 415, 447, 479, 727, 767, 831, 887, 895, 959, 1451, 1471, 1503, 1535, 1663, 1727, 1775, 1783, 1791, 1855, 1917, 1919, 1983, 2527, 2911, 2943, 2991, 3071, 3327, 3455, 3549, 3551, 3567, 3575, 3583, 3695, 3711, 3837, 3839, 3967, 3999, 5793, 5823, 5855, 5883, 5885, 5887, 5949, 5951, 5983, 5993, 5999
Offset: 1

Views

Author

Joerg Arndt, Mar 11 2022

Keywords

Comments

Odd terms in A094694.

Crossrefs

Programs

  • Maple
    select(t -> convert(convert(t^2,base,2),`+`) < convert(convert(t,base,2),`+`), [seq(i,i=1..10^4,2)]); # Robert Israel, Mar 13 2022
  • Mathematica
    Select[Range[1, 6000, 2], Greater @@ DigitCount[{#, #^2}, 2, 1] &] (* Amiram Eldar, Mar 11 2022 *)
  • PARI
    forstep(n=1,10^4,2,if(hammingweight(n^2)
    				
  • Python
    def ok(n): return n%2 == 1 and bin(n).count('1') > bin(n**2).count('1')
    print([k for k in range(6000) if ok(k)]) # Michael S. Branicky, Mar 11 2022

A232245 Sum of the number of ones in binary representation of n and n^2.

Original entry on oeis.org

0, 2, 2, 4, 2, 5, 4, 6, 2, 5, 5, 8, 4, 7, 6, 8, 2, 5, 5, 8, 5, 9, 8, 7, 4, 8, 7, 10, 6, 9, 8, 10, 2, 5, 5, 8, 5, 9, 8, 11, 5, 8, 9, 11, 8, 12, 7, 9, 4, 8, 8, 9, 7, 12, 10, 12, 6, 10, 9, 12, 8, 11, 10, 12, 2, 5, 5, 8, 5, 9, 8, 11, 5, 9, 9, 13, 8, 11, 11, 10, 5, 9
Offset: 0

Views

Author

Jon Perry, Nov 20 2013

Keywords

Comments

The sequence is never 1 or 3, but seems to take on all other values. The fact it is never 3 can be used to prove if n^2 has exactly 4 1's then it must have an even number of 0's (A231898).

Examples

			5 is 101 and 25 is 11001, so a(5) = 2 + 3 = 5.
		

Crossrefs

Programs

  • JavaScript
    function bitCount(n) {
    var i,c,s;
    c=0;
    s=n.toString(2);
    for (i=0;i
    				

Formula

a(n) = A159918(n) + A000120(n).
Showing 1-8 of 8 results.