login
a(1) = 1; for n > 1, a(n) = Min {m > n | m has same prime factors as n ignoring multiplicity}.
42

%I #88 Feb 09 2024 10:10:46

%S 1,4,9,8,25,12,49,16,27,20,121,18,169,28,45,32,289,24,361,40,63,44,

%T 529,36,125,52,81,56,841,60,961,64,99,68,175,48,1369,76,117,50,1681,

%U 84,1849,88,75,92,2209,54,343,80,153,104,2809,72,275,98,171,116,3481,90,3721

%N a(1) = 1; for n > 1, a(n) = Min {m > n | m has same prime factors as n ignoring multiplicity}.

%C After the initial 1, a permutation of the nonsquarefree numbers A013929. The array A284457 is obtained as a dispersion of this sequence. - _Antti Karttunen_, Apr 17 2017

%C Numbers such that a(n)/n is not an integer are listed in A284342.

%H Reinhard Zumkeller (terms 1..1000) & Antti Karttunen, <a href="/A065642/b065642.txt">Table of n, a(n) for n = 1..65537</a>

%F A007947(a(n)) = A007947(n); a(A007947(n)) = A007947(n) * A020639(n), where A007947 is the squarefree kernel (radical), A020639 is the least prime factor (lpf).

%F a(A000040(n)^k) = A000040(n)^(k+1); A001221(a(n)) = A001221(n).

%F A285328(a(n)) = n. - _Antti Karttunen_, Apr 17 2017

%F n < a(n) <= n*lpf(n) <= n^2. - _Charles R Greathouse IV_, Oct 18 2017

%e a(10) = a(2 * 5) = 2 * 2 * 5 = 20; a(12) = a(2^2 * 3) = 2 * 3^2 = 18.

%t ffi[x_]:= Flatten[FactorInteger[x]]; lf[x_]:= Length[FactorInteger[x]]; ba[x_]:= Table[Part[ffi[x], 2*w-1], {w, 1, lf[x]}]; cor[x_]:= Apply[Times, ba[x]]; Join[{1}, Table[Min[Flatten[Position[Table[cor[w], {w, n+1, n^2}]-cor[n], 0]]+n], {n, 2, 100}]] (* This code is suitable since prime factor set is invariant iff squarefree kernel is invariant. *) (* _G. C. Greubel_, Oct 31 2018 *)

%t Array[If[# == 1, 1, Function[{n, c}, SelectFirst[Range[n + 1, n^2], Times @@ FactorInteger[#][[All, 1]] == c &]] @@ {#, Times @@ FactorInteger[#][[All, 1]]}] &, 61] (* _Michael De Vlieger_, Oct 31 2018 *)

%o (Haskell)

%o a065642 1 = 1

%o a065642 n = head [x | let rad = a007947 n, x <- [n+1..], a007947 x == rad]

%o -- _Reinhard Zumkeller_, Jun 12 2015, Jul 27 2011

%o (PARI) A065642(n)={ my(r=A007947(n)); if(1==n,n, n += r; while(A007947(n) <> r, n += r); n)} \\ _Antti Karttunen_, Apr 17 2017

%o (PARI) a(n)=if(n<2, return(1)); my(f=factor(n),r,mx,mn,t); if(#f~==1, return(f[1,1]^(f[1,2]+1))); f=f[,1]; r=factorback(f); mn=mx=n*f[1]; forvec(v=vector(#f,i,[1,logint(mx/r,f[i])+1]), t=prod(i=1,#f, f[i]^v[i]); if(t<mn && t>n, mn=t)); mn \\ _Charles R Greathouse IV_, Oct 18 2017

%o (Scheme) (define (A065642 n) (if (= 1 n) n (let ((k (A007947 n))) (let loop ((n (+ n k))) (if (= (A007947 n) k) n (loop (+ n k))))))) ;; (Semi-naive implementation) - _Antti Karttunen_, Apr 17 2017

%o (Python)

%o from sympy import primefactors, prod

%o def a007947(n): return 1 if n < 2 else prod(primefactors(n))

%o def a(n):

%o if n==1: return 1

%o r=a007947(n)

%o n += r

%o while a007947(n)!=r:

%o n+=r

%o return n

%o print([a(n) for n in range(1, 51)]) # _Indranil Ghosh_, Apr 17 2017

%Y Cf. A005117, A007947, A013929, A020639, A000040, A001221, A081382.

%Y Cf. A285328 (a left inverse).

%Y Cf. also arrays A284457 & A284311, A285321 and permutations A284572, A285112, A285332.

%Y Cf. A084968, A084969, A084970, A284342.

%K nice,nonn

%O 1,2

%A _Reinhard Zumkeller_, Dec 03 2001