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.

A117818 a(n) = n if n is 1 or a prime, otherwise a(n) = n divided by the least prime factor of n (A032742(n)).

This page as a plain text file.
%I A117818 #32 May 25 2024 10:44:36
%S A117818 1,2,3,2,5,3,7,4,3,5,11,6,13,7,5,8,17,9,19,10,7,11,23,12,5,13,9,14,29,
%T A117818 15,31,16,11,17,7,18,37,19,13,20,41,21,43,22,15,23,47,24,7,25,17,26,
%U A117818 53,27,11,28,19,29,59,30,61,31,21,32,13,33,67,34,23,35,71,36,73,37,25,38
%N A117818 a(n) = n if n is 1 or a prime, otherwise a(n) = n divided by the least prime factor of n (A032742(n)).
%C A117818 A026741 generalized to give either a prime or the largest proper divisor of a nonprime.
%C A117818 Sometimes called "Conway's subprime function", although it surely predates John Conway. - _N. J. A. Sloane_, Sep 29 2017
%H A117818 Reinhard Zumkeller, <a href="/A117818/b117818.txt">Table of n, a(n) for n = 1..10000</a>
%p A117818 A117818 := proc(n)
%p A117818     local a,d;
%p A117818     if isprime(n) or n =1 then
%p A117818         return n;
%p A117818     end if;
%p A117818     a := -1 ;
%p A117818     for d in numtheory[divisors](n) do
%p A117818         if d < n and d> a then
%p A117818             a := d ;
%p A117818         end if;
%p A117818     end do:
%p A117818     a ;
%p A117818 end proc:
%p A117818 seq(A117818(n),n=1..100) ; # _R. J. Mathar_, Apr 30 2024
%t A117818 Table[If[PrimeQ[n], n, If[n == 1, 1, n/FactorInteger[n][[1, 1]]]], {n, 1, 76}]
%t A117818 Table[Which[n==1,1,PrimeQ[n],1,True,Divisors[n][[-2]]],{n,80}] (* _Harvey P. Dale_, Feb 02 2022 *)
%o A117818 (Haskell)
%o A117818 a117818 n = if a010051 n == 1 then n else a032742 n
%o A117818 -- _Reinhard Zumkeller_, Jun 24 2013
%o A117818 (Python)
%o A117818 import sympy
%o A117818 def A117818(n):
%o A117818     if n == 1:
%o A117818         return 1
%o A117818     else:
%o A117818         _=sympy.ntheory.factor_.primefactors(n)
%o A117818         return _[-1]
%o A117818 print([A117818(n) for n in range(1,100)])
%o A117818 # _R. J. Mathar_, May 24 2024
%Y A117818 Cf. A026741, A032742, A292772.
%K A117818 nonn,easy
%O A117818 1,2
%A A117818 _Roger L. Bagula_, Apr 30 2006
%E A117818 Edited by _Stefan Steinerberger_, Jul 22 2007
%E A117818 Extended by _Charles R Greathouse IV_, Jul 28 2010