[go: up one dir, main page]

login
A171862
Index of first occurrence of n in A181391, or 0 if n never appears.
9
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,2
LINKS
N. J. A. Sloane and Reinhard Zumkeller, Table of n, a(n) for n = 0..10000 (terms 1..1594 from N. J. A. Sloane)
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 *)
PROG
(Haskell)
import Data.List (elemIndex)
import Data.Maybe (fromJust)
a171862 n = 1 + fromJust (elemIndex n a181391_list)
-- Reinhard Zumkeller, Oct 31 2011
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Oct 17 2010
EXTENSIONS
Offset corrected by Reinhard Zumkeller, Oct 31 2011
STATUS
approved