login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A181935 Curling number of binary expansion of n. 8
1, 1, 1, 2, 2, 1, 1, 3, 3, 1, 2, 2, 2, 1, 1, 4, 4, 1, 1, 2, 2, 2, 1, 3, 3, 1, 2, 2, 2, 1, 1, 5, 5, 1, 1, 2, 2, 2, 1, 3, 3, 1, 3, 2, 2, 2, 1, 4, 4, 1, 1, 2, 2, 2, 2, 3, 3, 1, 2, 2, 2, 1, 1, 6, 6, 1, 1, 2, 2, 2, 1, 3, 3, 2, 2, 2, 2, 1, 1, 4, 4, 1, 2, 2, 2, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,4

COMMENTS

Given a string S, write it as S = XYY...Y = XY^k, where X may be empty, and k is as large as possible; then k is the curling number of S.

A212439(n) = 2 * n + a(n) mod 2. - Reinhard Zumkeller, May 17 2012

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 0..8191

Benjamin Chaffin and N. J. A. Sloane, The Curling Number Conjecture, preprint.

EXAMPLE

731 = 1011011011 in binary, which we could write as XY^2 with X = 10110110 and Y = 1, or as XY^3 with X = 1 and Y = 011. The latter is better, giving k = 3, so a(713) = 3.

PROG

(Haskell)

import Data.List (unfoldr, inits, tails, stripPrefix)

import Data.Maybe (fromJust)

a181935 0 = 1

a181935 n = curling $ unfoldr

   (\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2) n where

   curling zs = maximum $ zipWith (\xs ys -> strip 1 xs ys)

                          (tail $ inits zs) (tail $ tails zs) where

      strip i us vs | vs' == Nothing = i

                    | otherwise      = strip (i + 1) us $ fromJust vs'

                    where vs' = stripPrefix us vs

-- Reinhard Zumkeller, May 16 2012

CROSSREFS

Cf. A212412 (parity), A212440, A212441, A007088, A090822, A224764/A224765 (fractional curling number).

Sequence in context: A037162 A278566 A255559 * A027358 A332548 A191781

Adjacent sequences:  A181932 A181933 A181934 * A181936 A181937 A181938

KEYWORD

nonn,base

AUTHOR

N. J. A. Sloane, Apr 02 2012

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 6 07:01 EDT 2021. Contains 343580 sequences. (Running on oeis4.)