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.

A271268 Concatenate sum of digits of previous term and product of digits of previous term, starting with 8.

Original entry on oeis.org

8, 88, 1664, 17144, 17112, 1214, 88, 1664, 17144, 17112, 1214, 88, 1664, 17144, 17112, 1214, 88, 1664, 17144, 17112, 1214, 88, 1664, 17144, 17112, 1214, 88, 1664, 17144, 17112, 1214, 88, 1664, 17144, 17112, 1214, 88, 1664, 17144, 17112, 1214, 88, 1664, 17144
Offset: 0

Views

Author

Sander Claassen, Apr 03 2016

Keywords

Comments

Each term is created by calculating the sum of the digits of the previous number, and the product of its digits. The results are concatenated to give the new number. Starting with 8, the second number is 88. The third number is generated as follows: 8+8 = 16, 8*8 = 64, which gives 1664. Continuing this way, the 7th number in this sequence becomes 88, equal to the second number of the sequence. Therefore, the pattern 88, 1664, 17144, 17112, 1214, ... repeats indefinitely.

Crossrefs

Cf. A271220.

Programs

  • Haskell
    a271268 = 8 : cycle [88, 1664, 17144, 17112, 1214]
    -- Correction by Peter Kagey, Aug 25 2016
    
  • Mathematica
    NestList[FromDigits@ Join[IntegerDigits@ Total@ #, IntegerDigits[Times @@ #]] &@ IntegerDigits@ # &, 8, 48] (* Michael De Vlieger, Aug 26 2016 *)
    PadRight[{8},50,{1214,88,1664,17144,17112}] (* Harvey P. Dale, Oct 04 2017 *)
  • PARI
    /* first rather for illustration, second is more efficient to get a(n) */
    A271268_first(n)=vector(n,i,n=if(i>1,eval(Str(vecsum(n=digits(n)),vecprod(n))), 8))
    apply( {A271268(n)=[8, 17112, 1214, 88, 1664, 17144][n%5+(n>1)*2]}, [1..15]) \\ M. F. Hasler, Apr 01 2025
  • Python
    from functools import reduce
    from operator import mul
    def product(seq):
        return reduce(mul, seq, 1)
    def conversion(n):
        n = str(n)
        return str(sum(int(i) for i in n)) + \
               str(product(int(i) for i in n))
    def a271268(n):
        if n == 1:
            return 8
        else:
            r = 8
            while n > 1:
                r = conversion(r)
                n -= 1
            return int(r)
    
  • Python
    from math import prod  # first program for illustration - better use the second one
    def A271268_gen(n = 8): # optional parameter defines starting value
        while True: yield n; d=list(map(int,str(n))); n=int(f"{sum(d)}{prod(d)}")
    def A271268(n = None): # if no n given, generator of "infinite" sequence
        return (8, 17112, 1214, 88, 1664, 17144)[n%5+1 if n>1 else 0] if n \
            else (A271268(n)for n in range(1,1<<59)) # M. F. Hasler, Apr 01 2025
    

Extensions

Offset changed to 0 by Sean A. Irvine, Apr 12 2025