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.

A382986 a(n) is the number of iterations that n requires to reach 0 under the map k -> b(k) where b(k) = k+1 if k is even, and b(k) = k-gpf(k) if k is odd, where gpf(k) is the greatest prime dividing k.

This page as a plain text file.
%I A382986 #58 May 01 2025 16:47:35
%S A382986 0,1,2,1,2,1,2,1,4,3,2,1,2,1,4,3,2,1,2,1,6,5,2,1,8,7,10,9,2,1,2,1,4,3,
%T A382986 4,3,2,1,12,11,2,1,2,1,4,3,2,1,4,3,6,5,2,1,6,5,14,13,2,1,2,1,16,15,4,
%U A382986 3,2,1,4,3,2,1,2,1,4,3,4,3,2,1,4,3,2,1,6,5,4,3,2,1
%N A382986 a(n) is the number of iterations that n requires to reach 0 under the map k -> b(k) where b(k) = k+1 if k is even, and b(k) = k-gpf(k) if k is odd, where gpf(k) is the greatest prime dividing k.
%C A382986 k -> 0 occurs when k is 1 or an odd prime and this is the only way to reach 0.
%C A382986 At 0, a loop 0 -> 1 -> 0 occurs and there are no other loops since either 1 or 2 steps is a decrease: b(k) < k for odd k, or b(b(k)) < k for even k >= 2.
%C A382986 Consecutive terms can form decreasing runs starting at an even term, such as: (4, 3, 2, 1) starting at the 8th term.
%H A382986 Jakub Buczak, <a href="/A382986/b382986.txt">Table of n, a(n) for n = 0..10000</a>
%F A382986 a(p) = 1, for odd prime p.
%F A382986 a(2*n) = a(2*n+1) + 1.
%e A382986 a(0) = 0, since 0 already matches the ending condition.
%e A382986 a(2) = 2, since (b2)=3 and then b(3)=0.
%e A382986 a(3) = 1, since 3 - gpf(3) = 0.
%o A382986 (PARI) gpf(n) = if (n==1, 1, vecmax(factor(n)[,1]));
%o A382986 b(m) = if (m % 2, m - gpf(m), m+1);
%o A382986 a(n)= my(nb=0); while (n>1, n=b(n); nb++); nb; \\ _Michel Marcus_, Apr 13 2025
%o A382986 (Python)
%o A382986 from sympy import factorint
%o A382986 from itertools import count
%o A382986 def b(n): return n - max(factorint(n), default=0) if n&1 else n + 1
%o A382986 def a(n): return next(i for i in count(1) if not (n:=b(n))) if n > 1 else n
%o A382986 print([a(n) for n in range(90)]) # _Michael S. Branicky_, Apr 13 2025
%Y A382986 Cf. A006530, A076563.
%K A382986 nonn,look
%O A382986 0,3
%A A382986 _Jakub Buczak_, Apr 11 2025