A061060
Write product of first n primes as x*y with x
Original entry on oeis.org
1, 1, 1, 1, 13, 17, 1, 41, 157, 1811, 1579, 18859, 95533, 17659, 1995293, 208303, 2396687, 58513111, 299808329, 2460653813, 3952306763, 341777053, 115405393057, 437621467859, 1009861675153, 6660853109087, 29075165225531
Offset: 1
a(4)=1: 2*3*5*7 = 210 = 14*15, so we can take x=14, y=15, with difference of 1.
Also: n=3: 2*3-5=1; n=4: 3*5-2*7=1; n=5: 5*11-2*3*7=13; n=6: 2*7*13-3*5*11=17; n=7: 5*11*13-2*3*7*17=1; n=8: 3*5*11*19-2*7*13*17=41
-
A061060aux := proc(l1,l2) local resul ; resul := product(l1[i],i=1..nops(l1)) ; resul := resul-product(l2[i],i=1..nops(l2)) ; RETURN(abs(resul)) ; end:
A061060 := proc(n) local plist,i,subl,resul,j,l1,l2,k,d ; plist := [] ; resul := 1 ; for i from 1 to n do resul := resul*ithprime(i) ; plist := [op(plist), ithprime(i)] ; od; for i from 1 to n/2 do subl := combinat[choose](plist,i) ; for j from 1 to nops(subl) do l1 := op(j,subl) ; l2 := convert(plist,set) minus convert(l1,set) ; d := A061060aux(l1,l2) ; if d < resul then resul := d ; fi ; od; od ; RETURN(resul) ; end:
for n from 3 to 19 do printf("%d,",A061060(n)) ; od ; # R. J. Mathar, Aug 26 2006 [This Maple program was attached to A121315. However I think it belongs here, so I renamed the variables and moved it to this entry. - N. J. A. Sloane, Sep 16 2005]
-
(* first do *) Needs["DiscreteMath`Combinatorica`"] (* then *) f[n_] := Block[{arrayofnprimes = Array[Prime, n], primorial = Times @@ Array[Prime, n], diffmin = Infinity, adiff, sub}, If[n == 1, 1, Do[sub = Times @@ NthSubset[i, arrayofnprimes]; adiff = Abs[primorial/sub - sub]; If[adiff < diffmin, diffmin = adiff], {i, 2, 2^n/2}]; diffmin]]; Do[ Print@f@n, {n, 30}] (* Robert G. Wilson v, Sep 14 2006 *)
Terms a(16)-a(45) in b-file computed by
Jud McCranie, Apr 15 2000; Jan 12 2016
a(46)-a(60) in b-file from
Don Reble, Jul 11 2020
A038667
Minimal value of |product(A) - product(B)| where A and B are a partition of {1,2,3,...,n}.
Original entry on oeis.org
0, 0, 1, 1, 2, 2, 6, 2, 18, 54, 30, 36, 576, 576, 840, 6120, 24480, 20160, 93696, 420480, 800640, 1305696, 7983360, 80313120, 65318400, 326592000, 2286926400, 3002360256, 13680979200, 37744574400, 797369149440, 1763653953600, 16753029012720, 16880461678080, 10176199188480, 26657309952000
Offset: 0
For n=1, we put 1 in one set and the other is empty; with the standard convention for empty products, both products are 1.
For n=13, the central pair of divisors of n! are 78975 and 78848. Since neither is divisible by 10, these values cannot be obtained. The next pair of divisors are 79200 = 12*11*10*6*5*2*1 and 78624 = 13*9*8*7*4*3, so a(13) = 79200 - 78624 = 576.
-
a:= proc(n) local l, ll, g, gg, p, i; l:= [i$i=1..n]; ll:= [i!$i=1..n]; g:= proc(m, j, b) local mm, bb, k; if j=1 then m else mm:= m; bb:= b; for k to 2 while (mmbb then bb:= max(bb, g(mm, j-1, bb)) fi; mm:= mm*l[j] od; bb fi end; Digits:= 700; p:= ceil(sqrt(ll[n])); gg:= g(1, nops(l), 1); ll[n]/gg -gg end: a(0):=0:
seq(a(n), n=0..20); # Alois P. Heinz, Jul 09 2009, revised Oct 17 2015
-
a[n_] := Module[{l, ll, g, gg, p, i}, l = Range[n]; ll = Array[Factorial, n]; g[m_, j_, b_] := g[m, j, b] = Module[{mm, bb, k}, If[j==1, m, mm=m; bb=b; For[k=1, mm bb , bb = Max[bb, g[mm, j-1, bb]]]; mm = mm*l[[j]]]; bb]]; p = Ceiling[Sqrt[ ll[[n]]]]; gg = g[1, Length[l], 1]; ll[[n]]/gg - gg]; a[0]=0; Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 0, 35}] (* Jean-François Alcover, Feb 29 2016, after Alois P. Heinz *)
-
from math import prod, factorial
from itertools import combinations
def A038667(n):
m = factorial(n)
return 0 if n == 0 else min(abs((p:=prod(d))-m//p) for l in range(n,n//2,-1) for d in combinations(range(1,n+1),l)) # Chai Wah Wu, Apr 06 2022
A283261
Product of the different products of subsets of the set of numbers from 1 to n.
Original entry on oeis.org
1, 1, 2, 36, 331776, 42998169600000000, 13974055172471046820331520000000000000, 1833132881579690383668380351534446872452674453158326975200092938148249600000000000000000000000000
Offset: 0
Rows with subsets of the sets of numbers from 1 to n:
{},
{}, {1};
{}, {1}, {2}, {1, 2};
{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3};
...
Rows with the products of elements of these subsets:
1;
1, 1;
1, 1, 2, 2;
1, 1, 2, 3, 2, 3, 6, 6;
...
Rows with the different products of elements of these subsets:
1;
1;
1, 2;
1, 2, 3, 6;
...
a(0) = 1, a(1) = (1), a(2) = (1*2) = 2, a(3) = (1*2*3*6) = 36, ... .
-
b:= proc(n) option remember; `if`(n=0, {1},
map(x-> [x, x*n][], b(n-1)))
end:
a:= n-> mul(i, i=b(n)):
seq(a(n), n=0..7); # Alois P. Heinz, Aug 01 2022
-
Table[Times @@ Union@ Map[Times @@ # &, Subsets@ Range@ n], {n, 7}] (* Michael De Vlieger, Mar 05 2017 *)
-
a(n)=my(v=[2..n]); factorback(Set(vector(2^(n-1),i, factorback(vecextract(v,i-1))))) \\ Charles R Greathouse IV, Mar 06 2017
Showing 1-3 of 3 results.
Comments