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.

A171862 Index of first occurrence of n in A181391, or 0 if n never appears.

Original entry on oeis.org

1, 3, 5, 20, 17, 12, 10, 66, 47, 24, 148, 44, 173, 121, 30, 35, 138, 41, 63, 89, 56, 105, 324, 101, 215, 110, 257, 142, 320, 225, 471, 72, 59, 81, 183, 539, 134, 92, 263, 168, 129, 548, 52, 199, 179, 228, 98, 297, 621, 670, 357, 156, 116, 1486, 475
Offset: 0

Views

Author

N. J. A. Sloane, Oct 17 2010

Keywords

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex)
    import Data.Maybe (fromJust)
    a171862 n = 1 + fromJust (elemIndex n a181391_list)
    -- Reinhard Zumkeller, Oct 31 2011
  • Mathematica
    nmax = 100;
    seq[m_] := seq[m] = Module[{b, last}, b[] = 0; last[] = -1; last[0] = 2; nxt = 1; Do[hist = last[nxt]; b[n] = nxt; last[nxt] = n; nxt = 0; If[hist > 0, nxt = n - hist], {n, 3, m}];
     A171862 = Array[b, m];
     a[n_] := FirstPosition[A171862, n];
     Table[a[n], {n, 0, nmax}] /. Missing["NotFound"] -> 0 // Flatten
    ];
    seq[m = nmax];
    seq[m = 2 m];
    While[Print["m = ", m]; seq[m] != seq[m/2], m = 2 m;];
    seq[m] (* Jean-François Alcover, Aug 02 2018, borrowing some Maple code from N. J. A. Sloane *)

Extensions

Offset corrected by Reinhard Zumkeller, Oct 31 2011