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.

A177980 Iterate (n + lpf(n)) / 2 until a prime is reached, where lpf equals the least prime factor. a(n) is that terminating prime.

This page as a plain text file.
%I A177980 #15 Dec 15 2021 10:29:51
%S A177980 2,3,3,5,3,7,5,3,3,11,7,13,5,3,3,17,3,19,11,7,7,23,13,3,5,3,3,29,3,31,
%T A177980 17,3,3,11,19,37,11,7,7,41,7,43,23,13,13,47,3,3,5,3,3,53,3,3,29,3,3,
%U A177980 59,31,61,17,3,3,11,3,67,11,19,19,71,37,73,11
%N A177980 Iterate (n + lpf(n)) / 2 until a prime is reached, where lpf equals the least prime factor. a(n) is that terminating prime.
%C A177980 The function (n + lpf(n)) / 2 reduces the input according to its lowest prime factor if it is composite or simply returns the input if it is prime.
%C A177980 Sequence contains only prime numbers (and every prime number).
%H A177980 Dumitru Damian, <a href="/A177980/b177980.txt">Table of n, a(n) for n = 2..30000</a>
%e A177980 7 is prime, so (7 + lpf(7)) / 2 = (7 + 7) / 2 = 7.
%e A177980 15 is composite: (15 + 3) / 2 = 9, (9 + 3) / 2 = 6, (6 + 2) / 2 = 4, (4 + 2) / 2 = 3.
%t A177980 g[n_] := (n + FactorInteger[n][[1, 1]])/2; f[n_] := Last@ NestWhileList[g, n, !PrimeQ@ # &]; Array[f, 73, 2]
%o A177980 (Python)
%o A177980 from sympy import factorint, isprime
%o A177980 def a177980(n):
%o A177980     while True:
%o A177980         if isprime(n): return n
%o A177980         else: n=int((n+A020639(n))/2)
%o A177980 [a177980(n) for n in range(2, 160)] # _Dumitru Damian_, Dec 15 2021
%Y A177980 Cf. A020639, A061228.
%K A177980 nonn
%O A177980 2,1
%A A177980 _Grant Garcia_, Dec 16 2010