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.

This page as a plain text file.
%I A271268 #39 Apr 13 2025 16:33:23
%S A271268 8,88,1664,17144,17112,1214,88,1664,17144,17112,1214,88,1664,17144,
%T A271268 17112,1214,88,1664,17144,17112,1214,88,1664,17144,17112,1214,88,1664,
%U A271268 17144,17112,1214,88,1664,17144,17112,1214,88,1664,17144,17112,1214,88,1664,17144
%N A271268 Concatenate sum of digits of previous term and product of digits of previous term, starting with 8.
%C A271268 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.
%H A271268 Peter Kagey, <a href="/A271268/b271268.txt">Table of n, a(n) for n = 0..9999</a>
%H A271268 <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,1).
%t A271268 NestList[FromDigits@ Join[IntegerDigits@ Total@ #, IntegerDigits[Times @@ #]] &@ IntegerDigits@ # &, 8, 48] (* _Michael De Vlieger_, Aug 26 2016 *)
%t A271268 PadRight[{8},50,{1214,88,1664,17144,17112}] (* _Harvey P. Dale_, Oct 04 2017 *)
%o A271268 (Haskell)
%o A271268 a271268 = 8 : cycle [88, 1664, 17144, 17112, 1214]
%o A271268 -- Correction by _Peter Kagey_, Aug 25 2016
%o A271268 (Python)
%o A271268 from functools import reduce
%o A271268 from operator import mul
%o A271268 def product(seq):
%o A271268     return reduce(mul, seq, 1)
%o A271268 def conversion(n):
%o A271268     n = str(n)
%o A271268     return str(sum(int(i) for i in n)) + \
%o A271268            str(product(int(i) for i in n))
%o A271268 def a271268(n):
%o A271268     if n == 1:
%o A271268         return 8
%o A271268     else:
%o A271268         r = 8
%o A271268         while n > 1:
%o A271268             r = conversion(r)
%o A271268             n -= 1
%o A271268         return int(r)
%o A271268 (Python)
%o A271268 from math import prod  # first program for illustration - better use the second one
%o A271268 def A271268_gen(n = 8): # optional parameter defines starting value
%o A271268     while True: yield n; d=list(map(int,str(n))); n=int(f"{sum(d)}{prod(d)}")
%o A271268 def A271268(n = None): # if no n given, generator of "infinite" sequence
%o A271268     return (8, 17112, 1214, 88, 1664, 17144)[n%5+1 if n>1 else 0] if n \
%o A271268         else (A271268(n)for n in range(1,1<<59)) # _M. F. Hasler_, Apr 01 2025
%o A271268 (PARI) /* first rather for illustration, second is more efficient to get a(n) */
%o A271268 A271268_first(n)=vector(n,i,n=if(i>1,eval(Str(vecsum(n=digits(n)),vecprod(n))), 8))
%o A271268 apply( {A271268(n)=[8, 17112, 1214, 88, 1664, 17144][n%5+(n>1)*2]}, [1..15]) \\ _M. F. Hasler_, Apr 01 2025
%Y A271268 Cf. A271220.
%K A271268 nonn,easy,base
%O A271268 0,1
%A A271268 _Sander Claassen_, Apr 03 2016
%E A271268 Offset changed to 0 by _Sean A. Irvine_, Apr 12 2025