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.

A328330 Let f(n) be the number of segments shown on a digital calculator to display n. Then a(n) is the number of terms in the sequence formed by iteration n -> f(n) until n = f(n).

This page as a plain text file.
%I A328330 #28 Oct 27 2020 17:24:37
%S A328330 3,2,2,1,1,1,3,4,2,5,2,4,4,2,4,5,2,3,5,3,4,6,6,3,6,3,5,5,3,3,4,6,6,3,
%T A328330 6,3,5,5,3,6,2,3,3,5,3,6,4,3,6,3,4,6,6,3,6,3,5,5,3,5,5,3,3,6,3,5,3,5,
%U A328330 5,3,2,5,5,4,5,3,2,6,3,5,3,5,5,3,5,5,6,3
%N A328330 Let f(n) be the number of segments shown on a digital calculator to display n. Then a(n) is the number of terms in the sequence formed by iteration n -> f(n) until n = f(n).
%C A328330 Type n on a calculator and count the segments on a calculator display that forms the number. Iterate until you reach a fixed point: 4, 5 or 6. a(n) is the length of the chain.
%H A328330 Chai Wah Wu, <a href="/A328330/b328330.txt">Table of n, a(n) for n = 1..10000</a>
%e A328330 The 12th term is 4 as 12 -> 7 -> 3 -> 5 is a chain of 4.
%e A328330 a(8) = 4 because 8 -> 7 -> 3 -> 5 is a chain of length 4.
%o A328330 (PARI) a(n) = {my(res = 0, on = n, nn = n, cn); while(nn != cn, nn = f(on); cn = on; on = nn; res++); res}
%o A328330 f(n) = {my(d = digits(n), x = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]); sum(i = 1, #d, x[d[i]+1])} \\ _David A. Corneth_, Oct 12 2019
%o A328330 (Python)
%o A328330 def f(n):
%o A328330     return sum((6, 2, 5, 5, 4, 5, 6, 3, 7, 6)[int(d)] for d in str(n))
%o A328330 def A328330(n):
%o A328330     c, m = 1, f(n)
%o A328330     while m != n:
%o A328330         c += 1
%o A328330         n, m = m, f(m)
%o A328330     return c # _Chai Wah Wu_, Oct 27 2020
%Y A328330 Cf. A006942, A338255.
%K A328330 nonn,base
%O A328330 1,1
%A A328330 _Karl Aughton_, Oct 12 2019