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.

A039636 Number of steps to fixed point of "n -> n/2 or (n-1)/2 until result is prime".

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a039636 1 = 1
    a039636 n = snd $ until ((== 1) . a010051 . fst)
                            (\(x, i) -> (x `div` 2 , i + 1)) (n, 1)
    -- Reinhard Zumkeller, Nov 17 2013
  • Mathematica
    nerlist[ n_Integer ] := Length/@Drop[ FixedPointList[ If[ EvenQ[ # ]&&#>2, #/ 2, If[ PrimeQ[ # ]||(#===1), #, (#-1)/2 ] ]&, n, 20 ], -1 ]

Extensions

Offset corrected by Reinhard Zumkeller, Nov 17 2013