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.

A167185 Largest prime power <= n that is not prime.

This page as a plain text file.
%I A167185 #32 Oct 25 2024 14:14:56
%S A167185 1,1,1,4,4,4,4,8,9,9,9,9,9,9,9,16,16,16,16,16,16,16,16,16,25,25,27,27,
%T A167185 27,27,27,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,49,49,49,
%U A167185 49,49,49,49,49,49,49,49,49,49,49,49,64,64,64,64,64,64,64,64,64,64,64
%N A167185 Largest prime power <= n that is not prime.
%H A167185 Robert Price, <a href="/A167185/b167185.txt">Table of n, a(n) for n = 1..2000</a>
%e A167185 For a(14), 10, 12, and 14 are not prime powers, and 11 and 13 are prime powers but they are prime. Since 9 = 3^3 is a prime power, a(14) = 9.
%t A167185 Array[SelectFirst[Range[#, 1, -1], Or[And[! PrimeQ@ #, PrimePowerQ@ #], # == 1] &] &, 74] (* _Michael De Vlieger_, Jun 14 2017 *)
%o A167185 (PARI) isA025475(n) = (omega(n) == 1 & !isprime(n)) || (n == 1)
%o A167185 A167185(n) = {local(m);m=n;while(!isA025475(m),m--);m}
%o A167185 (Sage)
%o A167185 p = [n for n in (1..81) if (is_prime_power(n) or n == 1) and not is_prime(n)]
%o A167185 r = [[p[i]]*(p[i+1] - p[i]) for i in (0..9)]
%o A167185 print([y for x in r for y in x]) # _Peter Luschny_, Jun 14 2017
%o A167185 (Python)
%o A167185 from sympy import factorint
%o A167185 def A167185(n): return next(filter(lambda m:len(f:=factorint(m))<=1 and max(f.values(),default=2)>1, range(n,0,-1))) # _Chai Wah Wu_, Oct 25 2024
%Y A167185 List of nonprime prime powers: A025475.
%Y A167185 Next nonprime prime power: A167184.
%Y A167185 Previous prime power including primes: A031218.
%K A167185 nonn,easy
%O A167185 1,4
%A A167185 _Michael B. Porter_, Oct 29 2009