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.

A078786 Period of cycle of the inventory sequence (as in A063850) starting with n.

This page as a plain text file.
%I A078786 #5 Jul 26 2025 16:06:40
%S A078786 2,2,2,2,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,2,2,2,2,
%T A078786 1,1,1,1,1,4,2,1,2,1,1,4,4,4,4,3,1,1,1,1,1,4,3,3,3,2,1,1,1,4,4,1,3,2,
%U A078786 2,2,1,1,1,4,3,3,1,2,2,2,1,1,1,4,3,2,2,1,2,2,1,1,1,4,3,2,2,2,1,1
%N A078786 Period of cycle of the inventory sequence (as in A063850) starting with n.
%C A078786 It can be proved that any inventory sequence ends in a cycle all of whose terms are <= 10^20. Conjecture: a(n) <= 4 for all n. It suffices to check this for all inventory sequences starting with n, where n <= 10^20.
%H A078786 Carlos Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_207.htm">Puzzle 207. The Inventory Sequences and Self-Inventoried Numbers</a>, The Prime Puzzles & Problems Connection.
%e A078786 The inventory sequence starting with 1 is: 1, 11, 21, 1211, 3112, 132112, 311322, 232122, 421311, 14123113, 41141223, 24312213, 32142321, 23322114, 32232114, 23322114, .... which ends in the cycle 32232114, 23322114 of period 2. Hence a(1) = 2.
%t A078786 g[n_] := Module[{seen, r, d, l, i, t}, seen = {}; r = {}; d = IntegerDigits[n]; l = Length[d]; For[i = 1, i <= l, i++, t = d[[i]]; If[ ! MemberQ[seen, t], r = Join[r, IntegerDigits[Count[d, t]]]; r = Join[r, {t}]; seen = Append[seen, t]]]; FromDigits[r]];
%t A078786 per[n_] := Module[{r, t, p1, p}, r = {}; t = g[n]; While[ ! MemberQ[r, t], r = Append[r, t]; t = g[t]]; r = Append[r, t]; p1 = Flatten[Position[r, t]]; p = p1[[2]] - p1[[1]]; p]; Table[per[i], {i, 1, 100}]
%Y A078786 Cf. A063850, A078970.
%K A078786 base,nice,nonn
%O A078786 1,1
%A A078786 _Joseph L. Pe_, Jan 14 2003