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.

A366370 Square array A(n,k) giving the length of the least significant run of 0-bits in binary expansion of A000225(n)^k, or 0 if A000225(n)^k is a binary repunit.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Oct 14 2023

Keywords

Examples

			The top left corner of the square array:
  n\k| 1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17
-----+-------------------------------------------------------------------
   1 | 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   2 | 0,  2,  1,  3,  2,  2,  1,  4,  3,  2,  1,  3,  2,  2,  1,  5,  4,
   3 | 0,  3,  1,  4,  2,  3,  1,  5,  3,  3,  1,  4,  2,  3,  1,  6,  4,
   4 | 0,  4,  1,  5,  2,  4,  1,  6,  3,  4,  1,  5,  2,  4,  1,  7,  4,
   5 | 0,  5,  1,  6,  2,  5,  1,  7,  3,  5,  1,  6,  2,  5,  1,  8,  4,
   6 | 0,  6,  1,  7,  2,  6,  1,  8,  3,  6,  1,  7,  2,  6,  1,  9,  4,
   7 | 0,  7,  1,  8,  2,  7,  1,  9,  3,  7,  1,  8,  2,  7,  1, 10,  4,
   8 | 0,  8,  1,  9,  2,  8,  1, 10,  3,  8,  1,  9,  2,  8,  1, 11,  4,
   9 | 0,  9,  1, 10,  2,  9,  1, 11,  3,  9,  1, 10,  2,  9,  1, 12,  4,
  10 | 0, 10,  1, 11,  2, 10,  1, 12,  3, 10,  1, 11,  2, 10,  1, 13,  4,
  11 | 0, 11,  1, 12,  2, 11,  1, 13,  3, 11,  1, 12,  2, 11,  1, 14,  4,
  12 | 0, 12,  1, 13,  2, 12,  1, 14,  3, 12,  1, 13,  2, 12,  1, 15,  4,
  13 | 0, 13,  1, 14,  2, 13,  1, 15,  3, 13,  1, 14,  2, 13,  1, 16,  4,
  14 | 0, 14,  1, 15,  2, 14,  1, 16,  3, 14,  1, 15,  2, 14,  1, 17,  4,
  15 | 0, 15,  1, 16,  2, 15,  1, 17,  3, 15,  1, 16,  2, 15,  1, 18,  4,
  16 | 0, 16,  1, 17,  2, 16,  1, 18,  3, 16,  1, 17,  2, 16,  1, 19,  4,
  17 | 0, 17,  1, 18,  2, 17,  1, 19,  3, 17,  1, 18,  2, 17,  1, 20,  4,
etc.
A000225(4)^4 = ((2^4)-1)^4 = 50625 and A007088(50625) = "1100010111000001", where the rightmost run of 0-bits has length 5, therefore A(4,4) = 5.
A000225(3)^5 = ((2^3)-1)^5 = 16807 and A007088(16807) = "100000110100111", where the rightmost run of 0-bits has length 2, therefore A(3,5) = 2.
A000225(5)^3 = ((2^5)-1)^3 = 29791 and A007088(29791) = "111010001011111", where the rightmost run of 0-bits is a singleton, therefore A(5,3) = 1.
		

Crossrefs

Programs

  • Mathematica
    A285097[n_]:=If[DigitCount[n,2,1]<2,0,IntegerExponent[BitAnd[n-1,n],2]-IntegerExponent[n,2]];A366370[n_,k_]:=A285097[1+(2^n-1)^k];
    Table[A366370[k,n-k+1],{n,20},{k,n}] (* Paolo Xausa, Dec 02 2023 *)
  • PARI
    up_to = 105;
    A285097(n) = if(!n || !bitand(n,n-1), 0, valuation((n>>valuation(n,2))-1, 2));
    A366370sq(n,k) = A285097(1+(((2^n)-1)^k));
    \\ Or more directly as:
    A366370sq(n,k) = if(1==n||1==k, 0, if(!(k%2), n, 1)+valuation(k>>1,2));
    A366370list(up_to) = { my(v = vector(up_to), i=0); for(a=1,oo, for(col=1,a, i++; if(i > up_to, return(v)); v[i] = A366370sq(col,(a-(col-1))))); (v); };
    v366370 = A366370list(up_to);
    A366370(n) = v366370[n];

Formula

A(n,k) = A285097(1+(A000225(n)^k)).
For all n >= 2, k >= 2, A(n,2k) = n+A007814(k), A(n,2k+1) = 1+A007814(k).