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.

A031218 Largest prime power <= n.

This page as a plain text file.
%I A031218 #43 Aug 22 2025 17:40:09
%S A031218 1,2,3,4,5,5,7,8,9,9,11,11,13,13,13,16,17,17,19,19,19,19,23,23,25,25,
%T A031218 27,27,29,29,31,32,32,32,32,32,37,37,37,37,41,41,43,43,43,43,47,47,49,
%U A031218 49,49,49,53,53,53,53,53,53,59,59,61,61,61,64,64,64,67,67,67,67,71,71
%N A031218 Largest prime power <= n.
%C A031218 The length of the m-th run of {a(n)} is the length of the (m+1)-st run of A000015 for m > 1. - _Colin Linzer_, Mar 08 2024
%H A031218 Reinhard Zumkeller, <a href="/A031218/b031218.txt">Table of n, a(n) for n = 1..10000</a>
%H A031218 Sunben Chiu, Pinghzi Yuan, and Tao Zhou, <a href="https://doi.org/10.4134/BKMS.b220166">On the greatest common divisor of binomial coefficients</a>, Bull Korean Math. Soc. 60 (2023) 863-872
%H A031218 B. Dearden, J. Iiams, and J. Metzger, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL16/Dearden/dearden4.html">Rumor Arrays</a>, Journal of Integer Sequences, 16 (2013), #13.9.3.
%H A031218 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimePower.html">Prime Power</a>
%F A031218 a(n) = n - A378457(n). - _R. J. Mathar_, Jul 20 2025
%F A031218 a(n) = A000961(A065515(n)). - _Ridouane Oudra_, Aug 22 2025
%p A031218 A031218 := proc(n)
%p A031218     local a,pi,p,m ;
%p A031218     a := 1 ;
%p A031218     for pi from 1 do
%p A031218         p := ithprime(pi) ;
%p A031218         if p > n then
%p A031218             return a;
%p A031218         end if;
%p A031218         for m from 0 do
%p A031218             if p^m > n then
%p A031218                 break;
%p A031218             elif p^m <= n then
%p A031218                 a := max(a,p^m) ;
%p A031218             end if;
%p A031218         end do:
%p A031218     end do:
%p A031218     a ;
%p A031218 end proc:
%p A031218 seq(A031218(n),n=1..40) ; # _R. J. Mathar_, Jul 20 2025
%o A031218 (PARI) a(n)=if(n<1,0, while(matsize(factor(n))[1]>1,n--); n)
%o A031218 (Haskell)
%o A031218 a031218 n = last $ takeWhile (<= n) a000961_list
%o A031218 -- _Reinhard Zumkeller_, Apr 25 2011
%o A031218 (Python)
%o A031218 from sympy import factorint
%o A031218 def A031218(n): return next(filter(lambda m:len(factorint(m))<=1, range(n,0,-1))) # _Chai Wah Wu_, Oct 25 2024
%Y A031218 Cf. A000015, A000961, A065515.
%K A031218 nonn,easy,changed
%O A031218 1,2
%A A031218 _N. J. A. Sloane_
%E A031218 More terms from _Erich Friedman_