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.

Showing 1-3 of 3 results.

A181935 Curling number of binary expansion of n.

Original entry on oeis.org

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
Offset: 0

Views

Author

N. J. A. Sloane, Apr 02 2012

Keywords

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.

Examples

			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.
		

Crossrefs

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

Programs

  • 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
  • Mathematica
    f[n_, e_] := Module[{d = IntegerDigits[n, 2^e]}, Length[Split[d][[-1]]] - If[SameQ @@ d && Mod[n, 2^e] < 2^(e-1), 1, 0]]; a[n_] := Max[Table[f[n, e], {e, Range[Max[1, Floor[Log2[n]]]]}]]; a[0] = 1; Array[a, 100, 0] (* Amiram Eldar, Apr 08 2025 *)

Formula

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

A224762 Define a sequence of rationals by S(1)=1; for n>=1, write S(1),...,S(n) as XY^k, Y nonempty, where the fractional exponent k is maximized, and set S(n+1)=k; sequence gives numerators of S(1), S(2), ...

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 3, 2, 6, 1, 5, 1, 3, 4, 1, 4, 3, 5, 8, 1, 6, 13, 1, 4, 5, 8, 9, 1, 6, 5, 6, 3, 16, 1, 7, 1, 3, 6, 8, 14, 1, 6, 5, 16, 1, 5, 4, 24, 1, 5, 3, 15, 1, 5, 3, 7, 1, 5, 3, 7, 2, 54, 1, 7, 31, 1, 4, 21, 1, 4, 5, 1, 4, 5, 2, 15, 25, 1, 7, 17, 1, 4, 11, 1, 4, 5, 5, 30, 1, 6, 25, 15, 17, 1, 6, 7, 1, 4, 15, 1, 4, 5, 19
Offset: 1

Views

Author

Conference dinner party, Workshop on Challenges in Combinatorics on Words, Fields Institute, Toronto, Apr 22 2013, entered by N. J. A. Sloane

Keywords

Comments

k is the "fractional curling number" of S(1),...,S(n). The infinite sequence S(1), S(2), ... is a fractional analog of Gijswijt's sequence A090822.
For the first 1000 terms, 1 <= S(n) <= 2. Is this always true?
The fractional curling number k of S = (S(1), S(2), ..., S(n)) is defined as follows. Write S = X Y Y ... Y Y' where X may be empty, Y is nonempty, there are say i copies of Y, and Y' is a prefix of Y. There may be many ways to do this. Choose the version in which the ratio k = (i|Y|+|Y'|)/|Y| is maximized; this k is the fractional curling number of S.
For example, if S = (S(1), ..., S(6)) = (1, 1, 2, 1, 3/2, 1), the best choice is to take X = 1,1,2, Y = 1,3/2, Y' = 1, giving k = (2+1)/2 = 3/2 = S(7).

Examples

			The sequence S(1), S(2), ... begins 1, 1, 2, 1, 3/2, 1, 3/2, 2, 6/5, 1, 5/4, 1, 3/2, 4/3, 1, 4/3, 3/2, 5/4, 8/7, 1, 6/5, 13/12, 1, 4/3, 5/4, 8/7, 9/7, 1, 6/5, 5/4, 6/5, 3/2, 16/15, 1, 7/6, 1, 3/2, 6/5, 8/7, 14/13, 1, 6/5, 5/4, 16/13, 1, 5/4, 4/3, 24/23, 1, 5/4, 3/2, 15/14, 1, 5/4, 3/2, 7/4, ...
		

Crossrefs

Cf. A224763 (denominators), A090822, A224765.

Programs

  • Maple
    See link.

A224764 Numerator of fractional curling number of binary expansion of n.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 1, 3, 3, 4, 2, 2, 2, 3, 1, 4, 4, 5, 5, 2, 2, 5, 5, 3, 3, 4, 2, 2, 2, 3, 1, 5, 5, 6, 3, 2, 2, 2, 3, 3, 3, 5, 3, 2, 2, 2, 3, 4, 4, 5, 5, 2, 2, 5, 2, 3, 3, 4, 2, 2, 2, 3, 1, 6, 6, 7, 3, 2, 2, 2, 7, 3, 3, 7, 5, 2, 2, 5, 7, 4
Offset: 0

Views

Author

N. J. A. Sloane, Apr 26 2013

Keywords

Comments

See A224762 for definition and Maple program.

Examples

			1, 1, 1, 2, 2, 3/2, 1, 3, 3, 4/3, 2, 2, 2, 3/2, 1, 4, 4, 5/4, 5/3, 2, 2, 5/2, 5/3, 3, 3, 4/3, 2, 2, 2, 3/2, 1, 5, 5, 6/5, 3/2, 2, 2, 2, 3/2, 3, 3, 5/3, 3, 2, 2, 2, 3/2, 4, 4, 5/4, 5/3, 2, 2, 5/2, 2, 3, 3, 4/3, 2, 2, 2, 3/2, 1, 6, 6, 7/6, 3/2, 2, ...
For example, 18 = 10010 in binary has fractional curling number 5/4.
		

Crossrefs

Showing 1-3 of 3 results.