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.

A345965 a(1) = 1; for n>1, a(n) = phi(n) + a(n/p) where p is the least prime divisor of n.

This page as a plain text file.
%I A345965 #23 Dec 23 2024 22:56:56
%S A345965 1,2,3,4,5,5,7,8,9,9,11,9,13,13,13,16,17,15,19,17,19,21,23,17,25,25,
%T A345965 27,25,29,21,31,32,31,33,31,27,37,37,37,33,41,31,43,41,37,45,47,33,49,
%U A345965 45,49,49,53,45,51,49,55,57,59,37,61,61,55,64,61,51,67,65,67,55
%N A345965 a(1) = 1; for n>1, a(n) = phi(n) + a(n/p) where p is the least prime divisor of n.
%H A345965 Peter Cameron, <a href="https://cameroncounts.wordpress.com/2021/05/23/a-new-constant/">A new constant?</a>, May 23 2021.
%F A345965 a(p) = p for prime p.
%F A345965 a(n) = Sum_{k=0..bigomega(n)} phi(F^k(n)), where F^k(n) is the k-th iterate of F(n) = A032742(n). - _Ridouane Oudra_, Mar 17 2024
%p A345965 a:= proc(n) option remember; uses numtheory;
%p A345965       `if`(n=1, 1, phi(n)+a(n/min(factorset(n))))
%p A345965     end:
%p A345965 seq(a(n), n=1..80);  # _Alois P. Heinz_, Jun 30 2021
%t A345965 a[1] = 1; a[n_] := a[n] = EulerPhi[n] + a[n/FactorInteger[n][[1, 1]]]; Array[a, 100] (* _Amiram Eldar_, Jun 30 2021 *)
%o A345965 (PARI) a(n) = if (n==1, 1, eulerphi(n) + a(n/vecmin(factor(n)[,1])));
%o A345965 (Python)
%o A345965 from sympy import primefactors, totient as phi
%o A345965 def a(n): return 1 if n == 1 else phi(n) + a(n//min(primefactors(n)))
%o A345965 print([a(n) for n in range(1, 71)]) # _Michael S. Branicky_, Jun 30 2021
%Y A345965 Cf. A000010, A032742.
%K A345965 nonn
%O A345965 1,2
%A A345965 _Michel Marcus_, Jun 30 2021