let define the "waved" factorial as $\prod_{i=1}^n (\text{if } \bmod(i,2)=={0\text{ or } 1}\text{ then } [2/i] \text{ else } [i])$

134 Views Asked by At

Consider these two products:

EvenWavedFactorial = $$\prod_{i=1}^n \text{if } (i\bmod 2 ==0)\text{ then } \left(\frac{2}{i}\right) \text{ else }(i)$$ OddWavedFactorial = $$\prod_{i=1}^n \text{ if } (i\bmod2==1)\text{ then } \left(\frac{2}{i}\right) \text{ else } (i)$$

the sum of the reciprocal partial sums of EvenWavedFactorial $\,\cong\, \pi + 1$

$$\sum_{j=1}^k \left(\prod_{i=1}^j [\text{if } (i\bmod 2==0)\text{ then } \left(\frac{2}{i}\right) \text{ else }(\ i\ )]\right)^{-1} \cong \pi + 1$$

the sum of the reciprocal partial sums of OddWavedFactorial $\,\cong\, 2\sqrt2-1$

$$\sum_{j=1}^k \left(\prod_{i=1}^j [\text{ if } (i\bmod 2==1)\text{ then } \left(\frac{2}{i}\right) \text{ else }(\ i\ )]\right)^{-1} \cong 2\sqrt2-1$$

We need to set k = 100 to reach a good precision (~12 decimals) Here below the output of a test program: ____________factorialAlternateEven(1..100) ~ π + 1$ bf_sum : 4.141592653589781694678858471900 pi + 1 : 4.141592653589793238462643383280 delta : 0.000000000000011543783784911380

____________factorialAlternateOdd(1..100) ~ 2 √2 - 1 bf_sum : 1.828427124746182819286454719580 2*sqr(2)-1: 1.828427124746190097603377448419 delta : 0.000000000000007278316922728839

The 20 first values of these "waved" factorials

The 20 first values of these "waved" factorials

As you can see these "waved" factorials grow slowly and alternate somehow as a sinusoid.

Questions:

  • how can it be explained that the sum of "even waved factorial" is about pi + 1?
  • how can it be explained that the sum of "odd waved factorial" is about 2 * sqrt(2) - 1?
  • it could be linked with the double-factorial function, but I am not able to find the trick.
1

There are 1 best solutions below

0
On

here below the julia program that i used:

function EvenWavedFactorial(bi_Max::Int64 )::BigFloat bf_factalt = BigFloat(1.0) bi_n = BigInt(0) for bi_n = 1:bi_Max if (mod(bi_n, 2) == 0) bf_factalt *= BigFloat(2.0 / bi_n) #same as: #bf_factalt /= BigFloat(bi_n / 2.0) else bf_factalt *= BigFloat(bi_n) end end return bf_factalt end

function OddWavedFactorial(bi_Max::Int64 )::BigFloat bf_factalt = BigFloat(1.0) bi_n = BigInt(0) for bi_n = 1:bi_Max if (mod(bi_n, 2) == 1) bf_factalt *= BigFloat(2.0 / bi_n) #same as: bf_factalt /= BigFloat(bi_n / 2.0) else bf_factalt *= BigFloat(bi_n) end end return bf_factalt end

println("----------------------------------------------------------------") println(string(">>>> starting at ", now())) println("----------------------------------------------------------------")

bi_n = Int64(0) bf_sum = BigFloat(0.0) bf_res = BigFloat(0.0)

for bi_n = 1:100 # the cumulative sum of EvenWavedFactorial trending to : π + 1 bf_res = 1.0 / EvenWavedFactorial(bi_n) bf_sum += bf_res end

println("EvenWavedFactorial(1..100) ==> π + 1") println("-----------------------------------------") @printf("bf_sum : %32.30f", bf_sum) print('\n') @printf("pi + 1 : %32.30f", BigFloat(pi) + 1) print('\n') @printf("delta : %32.30f", BigFloat(pi) + 1 - bf_sum) print('\n') println("==================================================================================")

bf_sum = BigFloat(0.0) ## reset the cumulative sum - the cumulative sum of OddWavedFactorial trending to : 2√(2)-1 for bi_n = 1:100 bf_res = 1.0 / OddWavedFactorial(bi_n) bf_sum += bf_res end

println("OddWavedFactorial(1..100) ==> 2 √2 - 1") println("-------------------------------------------") @printf("bf_sum : %32.30f", bf_sum) print('\n') @printf("2*sqr(2)-1: %32.30f", BigFloat(2.0) * BigFloat(sqrt(BigFloat(2.0, 64))) - BigFloat(1.0) ) print('\n') @printf("delta : %32.30f", BigFloat(2.0) * BigFloat(sqrt(BigFloat(2.0, 64))) - BigFloat(1.0) - bf_sum ) print('\n') println("==================================================================================") print('\n')

println("the first WavedFactorial Even and Odd values:") println("---------------------------------------------")

frm_string = ""

for bi_n = 1:30 frm_string = @sprintf("%s %2.0f", "n:", bi_n ) frm_string = string(frm_string, " ", @sprintf("%s %12.5f", " EvenWaved! : ", EvenWavedFactorial(bi_n)))

if mod(bi_n, 2) == 0
   frm_string = string(frm_string, " ", @sprintf("%s %9.6f", "[x]", 2/bi_n))
else
   frm_string = string(frm_string, " ", @sprintf("%s %9.6f", "[x]", bi_n))
end

frm_string = string(frm_string, " ", @sprintf("%s %12.5f", " OddWaved! : ", OddWavedFactorial(bi_n)))

if mod(bi_n, 2) == 1
   frm_string = string(frm_string, " ", @sprintf("%s %9.6f", "[x]", 2/bi_n))
else
   frm_string = string(frm_string, " ", @sprintf("%s %9.6f", "[x]", bi_n))
end

println(frm_string)

end

println("----------------------------------------------------------------") println(string("<<<< ending at ", now())) println("----------------------------------------------------------------")