login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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). 3
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, 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, 5, 3, 2, 5, 5, 4, 5, 3, 2, 6, 3, 5, 3, 5, 5, 3, 5, 5, 6, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
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.
LINKS
EXAMPLE
The 12th term is 4 as 12 -> 7 -> 3 -> 5 is a chain of 4.
a(8) = 4 because 8 -> 7 -> 3 -> 5 is a chain of length 4.
PROG
(PARI) a(n) = {my(res = 0, on = n, nn = n, cn); while(nn != cn, nn = f(on); cn = on; on = nn; res++); res}
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
(Python)
def f(n):
return sum((6, 2, 5, 5, 4, 5, 6, 3, 7, 6)[int(d)] for d in str(n))
def A328330(n):
c, m = 1, f(n)
while m != n:
c += 1
n, m = m, f(m)
return c # Chai Wah Wu, Oct 27 2020
CROSSREFS
Sequence in context: A010269 A366911 A077450 * A214878 A086138 A170822
KEYWORD
nonn,base
AUTHOR
Karl Aughton, Oct 12 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 12:08 EDT 2024. Contains 371912 sequences. (Running on oeis4.)