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

A340956 Integers n such that s(n^2) = s(n)*(s(n)+1)/2, where s(n) is the sum of binary digits of n (A000120).

Original entry on oeis.org

0, 1, 2, 4, 5, 8, 9, 10, 16, 17, 18, 20, 21, 32, 33, 34, 36, 37, 40, 42, 64, 65, 66, 68, 69, 72, 73, 74, 80, 81, 84, 128, 129, 130, 132, 133, 136, 137, 138, 144, 146, 148, 160, 161, 162, 168, 256, 257, 258, 260, 261, 264, 265, 266, 272, 273, 274, 276, 277, 288, 289, 292, 293, 296, 320, 321, 322, 324, 336, 337, 512, 513, 514, 516
Offset: 1

Views

Author

Max Alekseyev, Feb 01 2021

Keywords

Comments

Also, integers n such that A159918(n) = A000217(A000120(n)).
For any n, s(n^2) <= s(n)*(s(n)+1)/2. This sequence gives n for which the equality is achieved.

Crossrefs

Programs

  • Maple
    q:= n-> (s-> is(s(n^2)=(t->t(s(n)))(h->h*(h+1)/2)))(
             k-> add(i, i=Bits[Split](k))):
    select(q, [$0..555])[];  # Alois P. Heinz, Feb 01 2021
  • Mathematica
    s[n_] := DigitCount[n, 2, 1]; t[n_] := n*(n + 1)/2; Select[Range[0, 500], s[#^2] == t[s[#]] &] (* Amiram Eldar, Feb 01 2021 *)
  • PARI
    isok(n) = my(hn=hammingweight(n)); hammingweight(n^2) == hn*(hn+1)/2; \\ Michel Marcus, Feb 01 2021

A355505 a(n) is the number of distinct cycles when iterating the function f_n(x), where f_n(x) is the sum of the digits in base n of x^2.

Original entry on oeis.org

2, 5, 3, 4, 4, 7, 4, 3, 4, 6, 4, 7, 4, 8, 6, 3, 3, 7, 5, 7, 9, 7, 4, 6, 4, 7, 5, 9, 5, 12, 7, 3, 9, 5, 8, 9, 5, 10, 9, 6, 4, 16, 8, 9, 8, 7, 5, 7, 9, 7, 7, 8, 4, 9, 8, 8, 11, 9, 4, 14, 7, 13, 11, 3, 8, 16, 7, 6, 9, 16, 8, 8, 5, 9, 9, 11, 13, 17, 7, 6, 6, 7, 5, 17, 6, 15, 11, 9, 4
Offset: 2

Views

Author

Wouter Zandsteeg, Jul 04 2022

Keywords

Comments

The trajectory from every starting point will enter a cycle given a sufficient number of iterations of f_n.
To determine a(n), only starting points 0, 1, 2, ..., n^2 have to be checked for cycles. Larger starting points will always lead to a cycle reached from one (or more) of 0, 1, 2, ..., n^2.
From Iain Fox, Jul 09 2022: (Start)
Since f_n(x) <= (n-1)*(1 + floor(2*log_n(x))), only numbers less than the largest zero of (n-1)*(1 + floor(2*log_n(x))) - x need to be checked.
The value mentioned above is less than or equal to (2-2n)*W_{-1}(log(n)/((2-2n)*sqrt(n)))/log(n) where W_k(x) is the k-th branch of the Lambert W function. (End)

Examples

			a(8) = 4 because there are 4 cycles for n = 8:
  f_8(0) = 0 (since 0^2 = 0 = 0_8, with digit sum 0),
  f_8(1) = 1 (1^2 = 1 = 1_8, with digit sum 1),
  f_8(4) = 2 (4^2 = 20_8) and f_8(2) = 4 (2^2 = 4_8), and
  f_8(7) = 7 (7^2 = 61_8, with digit sum 7).
		

Crossrefs

Programs

  • PARI
    a(n) = my(d=1); while(d<=logint(((n-1)*d)^2, n)+1, d++); my(l=(n-1)*(d-1)+1, x=vector(l, i, l-i), y=[], z=[], j, c=0); for(i=1, #x, y=setunion(y, z); j=x[i]; z=[]; while(!setsearch(z, j), if(setsearch(y, j), next(2)); z=setunion(z, [j]); j=sumdigits(j^2, n)); c++); c \\ Iain Fox, Jul 09 2022

A357656 a(n) is a lower bound for the largest Hamming weight of squares with exactly n binary zeros.

Original entry on oeis.org

1, 0, 13, 8, 13, 16, 37, 38, 44
Offset: 0

Views

Author

Keywords

Comments

The terms from a(2) onwards must be regarded as lower bounds, because no proof for the non-existence of squares with a very small number of binary zeros in the range k^2 > 2^90 (see b-file of A230097) is known.
a(9) >= 63, a(10) >= 57.

Examples

			                A357657(n)
   n  a(n) bits     k       k^2          k^2 in binary
   0    1    1      1         1                      1
   1    0    1      0         0                      0
   2   13   15    181     32761        111111111111001
   3    8   11     45      2025            11111101001
   4   13   17    362    131044      11111111111100100
   5   16   21   1241   1540081  101110111111111110001
		

Crossrefs

A357657 are the corresponding square roots of the record-setting squares.

A357657 a(n) is a lower bound for the square root of the maximum square with exactly n zeros in its binary representation.

Original entry on oeis.org

1, 0, 181, 45, 362, 1241, 2965685, 5931189, 57804981
Offset: 0

Views

Author

Keywords

Comments

See A357656 for more information.
a(9) >= 66537313397, a(10) >= 10520476455.

Crossrefs

A357656 gives the Hamming weight of the squared terms.

A357742 a(n) is the maximum binary weight of the squares of n-bit numbers.

Original entry on oeis.org

1, 2, 3, 5, 6, 8, 9, 13, 13, 15, 16, 18, 20, 22, 24, 25, 27, 29, 31, 34, 34, 37, 38, 39, 41, 44, 44, 47, 49, 51, 52, 54, 55, 57, 59, 63, 63, 64, 66, 68, 69, 72, 73, 76, 77, 78, 80, 82, 85, 87
Offset: 1

Views

Author

Keywords

Examples

			   bit   |
  length |          possible binary weight of k^2
   of k  | 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
   = n   |          the rightmost value is a(n)
  -------+--------------------------------------------------------------
     1   | 0  1
     2   |    1  2  -  -
     3   |    1  2  3  -  -  -
     4   |    1  2  3  4  5  -  -  -
     5   |    1  2  3  4  5  6  -  -  -  -
     6   |    1  2  3  4  5  6  7  8  -  -  -  -
     7   |    1  2  3  4  5  6  7  8  9  -  -  -  -  -
     8   |    1  2  3  4  5  6  7  8  9 10 11  - 13  -  -  -
     9   |    1  2  3  4  5  6  7  8  9 10 11 12 13  -  -  -  -  -
    10   |    1  2  3  4  5  6  7  8  9 10 11 12 13 14 15  -  -  -  -  -
		

Crossrefs

Formula

a(n) = max(A357658(2*n-2), A357658(2*n-1)).

Extensions

a(47)-a(50) from Martin Ehrenstein, Dec 26 2023

A358701 a(n) is the least number > 1 that needs n toggles in the trailing bits of its binary representation to become a square.

Original entry on oeis.org

4, 5, 7, 14, 79, 831, 6495, 247614, 7361278, 743300286, 121387475838
Offset: 0

Views

Author

Hugo Pfoertner, Dec 16 2022

Keywords

Examples

			a(0) = 4 = 100 in binary, 0 toggled bits needed;
a(1) = 5 = 101_2, 1 toggled bit -> 100_2 = 4;
a(2) = 7 = 111_2, 2 toggled bits -> 100_2 = 4;
a(3) = 14 = 1110_2, 3 toggled bits -> 1001_2 = 9;
a(4) = 79 = 1001111_2, 4 toggled bits -> 1000000_2 = 64;
a(5) = 831 = 1100111111_2, 5 toggled bits -> 1100010000_2 = 784 = 28^2.
		

Crossrefs

Programs

  • Go
    // see linked program
    (C#) // see linked program

Extensions

a(9) from Michael S. Branicky, Dec 19 2022
a(10) from Delbert L. Johnson, Apr 13 2024

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).
Previous Showing 31-37 of 37 results.