OFFSET
1,5
LINKS
FORMULA
EXAMPLE
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.
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 *)
PROG
(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];
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Antti Karttunen, Oct 14 2023
STATUS
approved