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.
%I A078970 #14 Jul 26 2025 16:08:19 %S A078970 39,93,349,394,439,493,934,943,999,1139,1193,1319,1391,1913,1931,1999, %T A078970 3139,3193,3319,3339,3391,3393,3913,3931,3933,9111,9139,9193,9319, %U A078970 9391,9399,9913,9931,9939,9993,11129,11192,11219,11291,11912,11921,12119,12191,12239 %N A078970 Cycle of the inventory sequence (as in A063850) starting with n consists of prime numbers. %C A078970 It can be proved that any inventory sequence ends in a cycle all of whose terms are <= 10^20. %H A078970 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 A078970 The inventory sequence starting with 39 is: 39, 1319, 211319, 12311319, 41122319, 1431221319, 4114232219, 2431321319, 2214333119, 2231143319, 2233311419, 2233311419, .... The cycle is 2233311419, 2233311419, .... and 2233311419 is prime, so 39 is in the sequence. %t A078970 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 A078970 pr[n_] := Module[{r, t, p1, p, a}, r = {}; t = g[n]; a = True; While[ ! MemberQ[r, t], r = Append[r, t]; t = g[t]]; r = Append[r, t]; p1 = Flatten[Position[r, t]]; p = PrimeQ[Drop[r, p1[[1]]]]; If[MemberQ[p, False], a = False]; a]; %t A078970 l = {}; For[k = 1, k <= 10^4, k++, If[pr[k], l = Append[l, k]]]; l %Y A078970 Cf. A063850, A078786. %K A078970 base,nice,nonn %O A078970 1,1 %A A078970 _Joseph L. Pe_, Jan 14 2003 %E A078970 Missing terms inserted by _Sean A. Irvine_, Jul 25 2025