|
|
A080080
|
|
T(n,k) = length of longest carry sequence when adding k to n in binary representation, 1 <= k <= n (triangular array).
|
|
4
|
|
|
1, 0, 1, 2, 1, 1, 0, 0, 0, 1, 1, 0, 3, 1, 1, 0, 2, 2, 1, 1, 1, 3, 2, 2, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 2, 0, 1, 0, 4, 1, 1, 0, 1, 1, 0, 0, 3, 3, 1, 1, 1, 2, 1, 1, 0, 4, 3, 3, 1, 2, 1, 1, 0, 0, 0, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 0, 4, 2, 2, 2, 2, 1, 1, 1, 3, 1, 1, 0, 3, 3, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1
(list;
table;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,4
|
|
COMMENTS
|
|
|
LINKS
|
|
|
EXAMPLE
|
Triangle begins:
1
0 1
2 1 1
0 0 0 1
1 0 3 1 1
0 2 2 1 1 1
3 2 2 1 2 1 1
|
|
PROG
|
(Haskell)
import Data.Bits (xor, (.&.), shiftL)
a080080 :: Int -> Int -> Int
a080080 n k = addc n k 0 where
addc x y z | y == 0 = z - 1
| otherwise = addc (x `xor` y) (shiftL (x .&. y) 1) (z + 1)
a080080_row n = map (a080080 n) [1..n]
a080080_tabl = map a080080_row [1..]
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|