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.

This page as a plain text file.
%I A171862 #17 Aug 02 2018 09:34:08
%S A171862 1,3,5,20,17,12,10,66,47,24,148,44,173,121,30,35,138,41,63,89,56,105,
%T A171862 324,101,215,110,257,142,320,225,471,72,59,81,183,539,134,92,263,168,
%U A171862 129,548,52,199,179,228,98,297,621,670,357,156,116,1486,475
%N A171862 Index of first occurrence of n in A181391, or 0 if n never appears.
%H A171862 N. J. A. Sloane and Reinhard Zumkeller, <a href="/A171862/b171862.txt">Table of n, a(n) for n = 0..10000</a> (terms 1..1594 from N. J. A. Sloane)
%t A171862 nmax = 100;
%t A171862 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}];
%t A171862  A171862 = Array[b, m];
%t A171862  a[n_] := FirstPosition[A171862, n];
%t A171862  Table[a[n], {n, 0, nmax}] /. Missing["NotFound"] -> 0 // Flatten
%t A171862 ];
%t A171862 seq[m = nmax];
%t A171862 seq[m = 2 m];
%t A171862 While[Print["m = ", m]; seq[m] != seq[m/2], m = 2 m;];
%t A171862 seq[m] (* _Jean-François Alcover_, Aug 02 2018, borrowing some Maple code from _N. J. A. Sloane_ *)
%o A171862 (Haskell)
%o A171862 import Data.List (elemIndex)
%o A171862 import Data.Maybe (fromJust)
%o A171862 a171862 n = 1 + fromJust (elemIndex n a181391_list)
%o A171862 -- _Reinhard Zumkeller_, Oct 31 2011
%Y A171862 Cf. A181391, A171863, A171864.
%K A171862 nonn
%O A171862 0,2
%A A171862 _N. J. A. Sloane_, Oct 17 2010
%E A171862 Offset corrected by _Reinhard Zumkeller_, Oct 31 2011