A079277 Largest integer k < n such that any prime factor of k is also a prime factor of n.
1, 1, 2, 1, 4, 1, 4, 3, 8, 1, 9, 1, 8, 9, 8, 1, 16, 1, 16, 9, 16, 1, 18, 5, 16, 9, 16, 1, 27, 1, 16, 27, 32, 25, 32, 1, 32, 27, 32, 1, 36, 1, 32, 27, 32, 1, 36, 7, 40, 27, 32, 1, 48, 25, 49, 27, 32, 1, 54, 1, 32, 49, 32, 25, 64, 1, 64, 27, 64, 1, 64, 1, 64, 45, 64, 49, 72, 1, 64, 27
Offset: 2
Examples
a(10)=8 since 8 is the largest integer< 10 that can be written using only the primes 2 and 5. a(78)=72 since 72 is the largest number less than 78 that can be written using only the primes 2, 3 and 13. (78=2*3*13).
Links
- David W. Wilson, Table of n, a(n) for n = 2..10000
- Aled Walker and Alexander Walker, Arithmetic Progressions with Restricted Digits, arXiv:1809.02430 [math.NT], 2018.
Crossrefs
Programs
-
Mathematica
Table[If[n == 2, 1, Module[{k = n - 2, e = Floor@ Log2@ n}, While[PowerMod[n, e, k] != 0, k--]; k]], {n, 2, 81}] (* Michael De Vlieger, Apr 26 2017 *)
-
PARI
a(n) = {forstep(k = n - 1, 2, -1, f = factor(k); okk = 1; for (i=1, #f~, if ((n % f[i,1]) != 0, okk = 0; break;)); if (okk, return (k));); return (1);} \\ Michel Marcus, Jun 11 2013
-
PARI
A007947(n) = factorback(factorint(n)[, 1]); \\ Andrew Lelechenko, May 09 2014 A079277(n) = { my(r); if((n > 1 && !bitand(n,(n-1))), (n/2), r=A007947(n); if(1==n,0,k = n-1; while(A007947(k*n) <> r, k = k-1); k)); }; \\ Antti Karttunen, Apr 26 2017
-
Python
from sympy import divisors from sympy.ntheory.factor_ import core def a007947(n): return max(d for d in divisors(n) if core(d) == d) def a(n): k=n - 1 while True: if a007947(k*n) == a007947(n): return k else: k-=1 print([a(n) for n in range(2, 101)]) # Indranil Ghosh, Apr 26 2017
Formula
Largest k < n with rad(kn) = rad(n), where rad = A007947.
Comments