Showing posts with label cs. Show all posts
Showing posts with label cs. Show all posts

Monday, October 19, 2026

[frgmmhxx] tmux extended regular expression not working

https://github.com/orgs/tmux/discussions/5055 claims tmux supprts Extended Regular Expressions.  "man 7 regex" says "modern" or "extended" has the | operator.

tmux 3.5a-3 amd64 on Debian trixie.

~/.tmux.conf:

set -g status off
set -g mode-keys vi

first, prime the terminal with strings to match:

tmux

echo 'foo|bar'
foo|bar

echo foo
foo

this ought not matter, but including for completeness:

echo $EDITOR
emacs

Ctrl-B [

[0/dddd] appears in top right corner

?

[prompt (search up) appears]

foo|bar
[there is NO incremental highlighting as I type foo|bar]
[hit enter]

literal string "foo|bar" is matched.  repeatedly pressing "n" does not match "foo" by itself.  (2 results) appears in the top right corner.

q

Ctrl-B [

[0/dddd] appears in top right corner

Ctrl-B :

[prompt : appears]

send -X search-backward "foo|bar" [hit enter]

same result as "?"; only literal string "foo|bar" is matched.  repeatedly pressing "n" does not match "foo" by itself.  (2 results) appears in the top right corner.

q

Ctrl-B [

[0/dddd] appears in top right corner

Ctrl-R

[nothing happens, confirming mode-keys has been vi not emacs]

q

Ctrl-B :

[prompt : appears]

set -g mode-keys emacs

Ctrl-B [

?

[nothing happens, as expected in emacs mode]

Ctrl-R

[prompt (search up) appears]

foo
[there IS incremental highlighting as I type "foo"]

Thursday, October 15, 2026

[nwhsphcc] self exponentiation yielding googol

x^x = 10^100

solution x = 56.96124843

raising a number to its own power; self-power.  previously, Lambert W.

Mathematica:

u=100*Log[10]

N[u/ProductLog[u], 10]

Pari/GP:

solve(x=56, 57, x^x - 1e100)

(10^100 - epsilon) is the largest number representable on typical scientific calculators.  the solution joins factorial 69! ~= 1.7e+98 as the largest permitted inputs to scientific calculator functions that produce huge outputs from small imputs.

[bedtmcgm] decimal expansions of negative powers of 2

the digits in the decimal expansion of negative powers of 2, equivalently positive powers of 0.5, are the same as the digits of positive powers of 5.  positive powers of 5 can be computed with arbitrary precision integer arithmetic only: arbitrary precision floating point not necessary.  then, the only difficulty is determining the number of zeros in front after the decimal point.  in the perl script below, the number of zeros is computed and stored in $c.  "x" is the perl string repetition operator.  the general idea is the total length after the decimal point grows by 1 each time, yielding a pretty triangle.

perl -lwe 'use bigint; $b=1; for($i=1;;++$i){ $b*=5; $c=$i-length$b; $_= "0." . ("0"x$c) . $b; print"$_ $i"}'

0.5 1
0.25 2
0.125 3
0.0625 4
0.03125 5
0.015625 6
0.0078125 7
0.00390625 8
0.001953125 9
0.0009765625 10
0.00048828125 11
0.000244140625 12
0.0001220703125 13
0.00006103515625 14
0.000030517578125 15
0.0000152587890625 16
0.00000762939453125 17
0.000003814697265625 18
0.0000019073486328125 19
0.00000095367431640625 20

if scientific notation is acceptable, then one can cheat:

5e-1
25e-2
125e-3
625e-4
3125e-5
15625e-6

where the negative exponent decreases by 1 each time.  this works because 5^n * 10^-n = (1/2)^n .

[lruunnwl] permutations of subsets

f(n) = sum(k=0, n, binomial(n,k) * k!)

for(i=0, 12, x=f(i); print(i" "x" ",x-1))

0 1 0
1 2 1
2 5 4
3 16 15
4 65 64
5 326 325
6 1957 1956
7 13700 13699
8 109601 109600
9 986410 986409
10 9864101 9864100
11 108505112 108505111
12 1302061345 1302061344

OEIS A000522

the sequence grows quickly, conjecturally asymptotically factorial(n) * e .

permutations of subsets of 4 physical items is intriguing: 64 possibilities excluding empty set, encoding exactly 6 bits.  base64.  the empty subset can be used as a separator.

5 physical items encodes 1 byte with room for escape characters.

"physical" items because duplication forbidden.  if repetitions permitted, then future post ijyxrmio .

inspired by My Little Pony action figures arranged in a row.

Wednesday, October 14, 2026

[erhwccoo] Hamiltonian paths

given a graph, find a Hamiltonian path if it exists.  this is NP-complete.

if a Hamiltonian path is easy to find (perhaps there are many), find a path quickly.  this feels vaguely like the axiom of choice.  uniformly randomly sample among all Hamiltonian paths (cf Wilson's algorithm uniformly sampling spanning trees).

assign indices to each possible Hamiltonian path.  given an index, get its path.  inverse.

find a Hamiltonian cycle if one exists.  sample.  index.

find a Hamiltonian path if it exists with start and endpoint constrained to given subsets of nodes.

if a Hamiltonian path does not exist, find a path that maximizes the number of nodes visited, not visiting any node more than once.  or, approximately maximize: visit a lot of nodes.

[gjadlrnh] d12 pick a random key

or random starting note, for a piece you want to practice in all transpositions (perhaps Well Tempered Clavier).

#!perl -lw
@a=split//,<<'eof';
C
G
D
A
E
B
F# / G flat
C# / D flat
G# / A flat
D# / E flat
A# / B flat
F
eof
print$a[int rand@a];

notes ordered in circle of fifths rather than chromatically in case the following Perl negative array index trick becomes useful in the future.  sign of index indicates whether the key signature is sharps or flats; absolute value indicates number of accidentals:

$a[0] == C
$a[1] == G
$a[-1] == F

a relabeled d12 physical die is probably not a great implementation of this randomizer, as music performance or practice typically does not have a tabletop to roll dice.  ironically, a percussion table would be good for rolling dice, but percussion instruments are typically unpitched.

Tuesday, September 29, 2026

[kxdvujsv] N queens of two colors (peaceable queens)

Q/2 white queens, Q/2 black.  how many can fit on a chessboard (i.e., maximize Q) with no queen attacking one of the opposite color?  queens of the same color may attack (actually defend) each other (but don't have to).

I'm sure this problem has been proposed before because it makes sense for regular chess. but it is hard to search for it, dominated by results of the traditional N queens problem all of the same color, (or, to be consistent with actual chess, all of different colors, because queens of the same color defending each other is not something to avoid in chess).

update: OEIS A250000, found by luck from Pictures from the OEIS, calls the problem Peaceable Queens.  the problem seems young, much younger than the chess queen itself, with the oldest reference 1977, and the OEIS sequence itself created in 2014.  (Sloane himself arranged for it to get a nice OEIS A-number because he likes the problem, with lower bounds findable by simulated annealing and upper bounds findable by integer programming.)  but certainly chess players had considered the problem earlier?

the maximum for the 8x8 board is 9 queens of each color, which coincidentally corresponds to the original queens plus all pawns promoted to queens.  how many maximal solutions are there for the 8x8 board?

for NxN board sizes larger than N=8, the known solutions are larger than N+1 of each color, lower bound O(N^2), i.e., a constant fraction of the board.  how many solutions are there for an NxN board?  (note well: N denotes the board size, not the number of queens.  in the traditional N queens problem, N could denote both, but in Peaceable Queens the numbers usually different.)

(for chess variants on larger boards, consider letting the sequence minus the number of initial queens define the initial number of pawns.)

the 8x8 solution of 9 queens each, diagrammed on A250000, can easily be changed to 8 queens and 1 king of each color, neither king in check.  but more elegant is to designate one of the 9 queens as royal: capture ends the game.  designate it with the queen piece; the other queens with pawns.  then play real chess starting from this "peaceable" start position.  bloody war likely breaks out very quickly.

while the sequence gives the number A = A250000(N) such that A white queens and A black queens fit on an NxN board, sometimes we can a fit a few more of one color, say, A+d white queens and A black queens.  one commenter on OEIS A250000 calls the situation "aggressors" and mentions that N = 15, A = 32, d = 2 is possible (without actually showing it).  we need another OEIS sequence giving the sequence of maximum d relative to A250000.

Friday, August 07, 2026

[ykierhyf] tilings of triangles and squares

tile the plane with squares and equilateral triangles all of the same side length.  this could be fun with physical tiles.

well investigated are the regular, semiregular, and uniform tilings, but random tilings also seem possible.

possible vertex configurations are (4 squares), (6 triangles), and (2 squares and 3 triangles).  2+3 has 2 possibilities: whether or not the squares are adjacent.

how careful do you need to be to avoid creating a gap into which nothing fits?

(as of early 2026, AI image generators failed to draw this random tiling.)

how difficult are such tilings to 4-color?  I think the following works: assign squares 2 colors.  2-color in a checkerboard pattern every connected component of just squares.  similarly, triangles with the other 2 colors.

this pair of tiles feels vaguely similar to Penrose tiles.  squares and triangles can tile periodically but they don't have to.

the edges form a penny graph.  these graphs feel aesthetically dense like the square and triangular grids.  the graph formed by the edges of the regular hexagon tiling does not feel aesthetically dense.

[kacgvdua] maximal Steiner tree

given a connected graph and a number N, select N vertices in the graph so that the size of the Steiner tree (Steiner tree problem on graphs) spanning the selected vertices is maximized.  (by definition, a Steiner tree minimizes its size, so this is a maximum-minimum problem.)  the size of a Steiner tree is sum of the weights of all its edges.  if unweighted edges, let every edge have unit weight.

if N=2, then the size of the maximum Steiner tree is graph diameter.  for larger N, this generalizes graph diameter: find the N points farthest away from each other.

for an adventure game exploring a graph, these are where the treasures are hidden.

what is the computational complexity of this problem?  solving the Steiner tree problem on graphs just once is NP-complete; now we are solving it binomial(number of graph vertices, N) times.

[ksnmkfky] pixel glyphs

given a region partitioned into a small number of pixels not necessarily square (future post cmpvevta), enumerate glyphs.  two possible pixel colors, denoted background and foreground.  simplest enumeration: with N pixels, 2^N glyphs.

more complicated: avoid glyphs the same after translation.  avoid rotations, so text written sideways or upside down does not change meaning.  avoid reflections, making life easier for dyslexics.

only one connected component of foreground pixels.  strictly more (or less) than half the pixels are foreground.  or, avoid glyphs the same after inversion, swapping foreground and background.  (this might be useful for designing symbols for fairy chess, where we want both a black and white version of symbols.)

avoid not only "same" but also similar, within a given Hamming distance.  maximize the number of distinct symbols.

[argeufrf] automatic field separator

unless this is to be first field (e.g., word) in the line (record), print the field separator (e.g., space for words in a line, comma for CSV, tab for TSV).  then, print the given field data.  the output subsystem automatically keeps track of whether we are at first field in a record.

optionally, automatic escaping or quoting if the field data contains a field or record separator.

similarly, automatic record terminator (e.g., newline) on orderly file close.

in general: field prefix, field terminator, field separator, record prefix, record terminator, record separator.  not all of these will be used.

[lzlpplvi] shortest path on a Euclidean manifold with wormholes

in Euclidean space, the shortest path between two points is a line segment.  then, modify the space:

designate two special points for which travel between them is free, costs no distance, i.e., a wormhole connects the points.  then, the shortest path between two points might no longer be the line between them; it might be to travel to and from the wormhole mouths.

(which pairs of points are affected?  this is a problem in 2*D dimensional space.)

instead of just two special points, add a line of special points with free travel between any two points on the line.  shortest paths will often involve traveling orthogonally to the line, traveling along the line for free, then departing orthogonally from the line to the destination.  maybe this is a river in which transportation cost is negligible.  or, minimize walking where there are moving sidewalks.

the wormhole mouths and river line are examples of sets of points.  a zone of free travel can be generalized to any set of points.  one could have multiple zones: free travel within each zone, but, unless zones are adjacent, you have to exit a zone and travel through the overworld to connect to other zones.

how difficult is finding the shortest path?

once we have a notion of shortest path (geodesic), we can define minimum spanning tree, traveling salesman, Euclidean Steiner tree, Voronoi diagram, Delauney triangulation.

Wednesday, August 05, 2026

[lyncpmou] expected number of barriers passed

let barrier(n,h) be the probability of passing barrier number n, starting from n=1.  h is a parameter that will be used later.

to pass exactly n barriers, one needs to consecutively pass barriers 1 through n, then fail barrier n+1:

exactly(n,h)= prod(i=1,n, barrier(i,h)) * (1-barrier(n+1,h))

(Pari/GP syntax)

the expected number of barriers crossed before the first failure is an infinite sum.  here is the partial sum:

partialexpected(n,h)= sum(i=1,n, i*exactly(i,h))

first, let us investigate the barrier probability being a constant, not dependent on n:

barrier(n,h)= h

the expected number E of barriers crossed for constant barrier probability h:

h=1/6 E=1/5
h=1/5 E=1/4
h=1/4 E=1/3
h=1/3 E=1/2
h=2/5 E=2/3
h=1/2 E=1
h=3/5 E=3/2
h=2/3 E=2
h=3/4 E=3
h=4/5 E=4
h=5/6 E=5

the above exact values are conjectures from the partial sum, e.g.:

partialexpected(999,5.0/6)
4.9999999999999999999999999999999999940
cpu time = 107 ms, real time = 107 ms.

a closed-form formula for a given constant barrier probability is probably not difficult to derive, probably something like geometric series.

if the barrier probability is 1/n, the expected number of barriers crossed is e-1:

barrier(n,h)= 1.0/n
partialexpected(99)
1.7182818284590452353602874713526624977
partialexpected(98)
1.7182818284590452353602874713526624977

the second calculation of only 98 terms verifies convergence of the partial sum.  a barrier probability decreasing as a function of n is nice for making the partial sum converge quickly.

(in Pari/GP, if a function argument is omitted -- in this case h -- it is assigned a default value of 0.)

if the barrier probability is 1/(2*n), equivalently 0.5/n, then the expected value is exp(0.5)-1 (via the RIES Inverse Symbolic Calculator). (the original Inverse Symbolic Calculator has gone offline.)

barrier(n,h)= h/n
partialexpected(99,0.5)
0.64872127070012814684865078781416357161

we conjecture that the expected value for this form of barrier probability is exp(h)-1.  therefore, if h = log(2) ~= 0.693, the expected value is 1 :

partialexpected(99,log(2))
0.99999999999999999999999999999999999996

let the barrier probability decay exponentially:

barrier(n,h)= h^n

if the barrier probability is 1/2^n , then the expected value has the following value, unknown if it has a closed form:

partialexpected(99,0.5)
0.64163256065515386629384277022542943422

if h = 0.7 , the expected value is greater than 1 :

partialexpected(99,0.7)
1.1942513927487148419874371583834978589

we use Pari/GP's nifty solve function to find the value of h such that the expected value is exactly 1 .  does this value of h have a closed form expression?

h = solve(x=0.5,0.7, partialexpected(99,x)-1)
0.64522270323602097913425166394402633225
partialexpected(99,h)
0.99999999999999999999999999999999999996

recall that if the barrier probability is 1/n, the expected value is e-1 :

barrier(n,h)= 1.0/(n+h)
partialexpected(99,0)
1.7182818284590452353602874713526624977

the first barrier is passed with probability 1, not a barrier at all, a free +1 to the expected value.  if we shift all barriers by one, then the expected value is unsurprisingly e-2 :

partialexpected(99,1)
0.71828182845904523536028747135266249771

this is the amount of shift that makes the expected value 1 :

h= solve(x=0,1, partialexpected(99,x)-1)
0.53571808926964201274443895890553620494

let the barrier probability obey a power law.  we shift by 1 to skip the free first barrier:

barrier(n,h)= (n+1.0)^h

when the exponent is -1, the expected value is e-2 as noted before:

partialexpected(99,-1)
0.71828182845904523536028747135266249771

if the probability is 1/sqrt(n+1) , the expected value is greater than 1 :

partialexpected(99,-0.5)
1.4695063145210475624756367446601502576

this exponent makes the expected value 1 :

h= solve(x=-0.5,-1, partialexpected(99,x)-1)
-0.73888040289770820386751815624320497895

inspired by modeling family sizes.  have children until you can't, perhaps because of death caused by complications from childbirth.

if sampling a random tree where the number of children of each node has expected value 1, the population stays approximately constant generation to generation (I think).  such a tree models asexual reproduction, or a filtered view of sexual reproduction paying attention to only one gender.

[jnqlnxts] classification of extensive-form games by computational requirements

game length:

  1. infinite-length games possible.  (if finite game state, then game must be loopy.)
  2. games are guaranteed to be finite length but finite games of arbitrary length possible.  (e.g., players take turns naming smaller positive integers, Kirby-Paris hydra.)
  3. maximum game length known at start.

this classification is practically fuzzy: maximum game length could be finite but so large as to effectively be infinite (future post hxfdvhup).  (e.g., loopy games with special rules prohibiting repetition.)  or, infinite or extremely long games are theoretically possible but require both players to be silly.

game state:

bounded or unbounded amount of information needed to describe game state.

common case of unbounded: loopy game has special rules regarding repeating a previous position (e.g., chess 3-fold repetition, go 囲碁 super-ko) so, as the game progresses, game state includes a growing list of positions already seen (in practice, a hash table).

this classification is practically fuzzy: theoretically bounded but so huge as to effectively be infinite.  chess and go 囲碁 have finite numbers of possible positions so keeping track of all of them classifying each as already seen or not requires only a finite bounded (but huge) amount of information.

the above classifications matter for computer implementations of games: how many bits wide should the move counter be to avoid overflow?

other famous classifications: perfect vs. imperfect information (players hide information).  complete vs. incomplete information (randomness or chance).

[tgtdtucz] Fourier series for ellipse in polar coordinates

below is the formula for an ellipse in polar coordinates, with eccentricity e and one focus at the origin (multiply by scaling factor to embiggen):

r = 1 / (1 - e*cos(t))

the formula has cosine in denominator.  we compute its Fourier transform to get a formula with the sines and cosines only in the numerators.  (only cos is needed.)

Mathematica:

FourierCosSeries[1/(1-e*Cos[t]), t, 7, Assumptions-> e < 1 && 0 <= e] //Timing

{245.35853, 1/Sqrt[1 - e^2] + (2*(-1 + 1/Sqrt[1 - e^2])*Cos[t])/e - (2*(-2 + e^2 + 2*Sqrt[1 - e^2])*Cos[2*t])/(e^2*Sqrt[1 - e^2]) + (2*(-4 + 4/Sqrt[1 - e^2] + e^2*(1 - 3/Sqrt[1 - e^2]))*Cos[3*t])/e^3 + (2*(8 + e^4 - 8*Sqrt[1 - e^2] + 4*e^2*(-2 + Sqrt[1 - e^2]))*Cos[4*t])/(e^4*Sqrt[1 - e^2]) - (2*(16 - 16/Sqrt[1 - e^2] + e^4*(1 - 5/Sqrt[1 - e^2]) + e^2*(-12 + 20/Sqrt[1 - e^2]))*Cos[5*t])/e^5 - (2*(e^6 + e^2*(48 - 32*Sqrt[1 - e^2]) + 6*e^4*(-3 + Sqrt[1 - e^2]) + 32*(-1 + Sqrt[1 - e^2]))*Cos[6*t])/(e^6*Sqrt[1 - e^2]) + (2*(e^6*(-7 + Sqrt[1 - e^2]) - 64*(-1 + Sqrt[1 - e^2]) - 8*e^4*(-7 + 3*Sqrt[1 - e^2]) + 16*e^2*(-7 + 5*Sqrt[1 - e^2]))*Cos[7*t])/(e^7*Sqrt[1 - e^2])}

what is a general formula for the coefficients (to get an infinite series)?  this has almost certainly already been solved, but I could not find such a formula published anywhere.  it seems like the kind of thing Joseph Fourier might have done himself.

investigate Fourier transforms of generalizations of the original formula with cosine in the denominator, for example, r(theta) = 1/(sum(n, A[n] * cos(n*theta + B[n]))).  what is the Fourier transform of the reciprocal of a Fourier transform?  previously, polar plots of regular (not reciprocal) Fourier series.  under what conditions is the shape convex?

[gjjimaii] estimating pi with primes

we compute an approximation of Riemann zeta(2) = pi^2/6 using the Euler product formula over primes, then solve for pi:

? for(n=0, 10, z=1; forprime(p=1, 10^n, z*=(1-(1.0/p^2))); print("10^"n" ",sqrt(6/z)))

pi estimated from the product of all primes less than 10^n:

10^0 2.4494897427831780981972840747058913920
10^1 3.0935921676911454192536940842087145469
10^2 3.1387371950717209555231899287777680519
10^3 3.1413931847879282123372947308786365411
10^4 3.1415772351603451399115522305263190950
10^5 3.1415913934202453316750296375573376397
10^6 3.1415925471279879791648160810012226847
10^7 3.1415926443848380990491814377585237930
10^8 3.1415926527790129584805149679019884804
10^9 3.1415926535173431626391708456483210697
10^10 3.1415926535832448165410657025850891080

cpu time = 7min, 50,161 ms, real time = 7min, 50,326 ms.

each power of 10 yields slightly more than one more correct digit.  asymptotically, probably just one digit, so this is not an efficient method of calculating pi, though it is nice to have gotten the digits above without too much effort.

previously, estimating e with primes.

Tuesday, April 21, 2026

[ynwwppvz] estimating e by counting primes

let n = 2^22 = 4194304.  there are p = primepi(n) = 295947 primes less than n.

using the prime number theorem n/log(n) ~= primepi(n), then e ~= n^(p/n) ~= 2.93 .

using n/(log(n) - 1) ~= primepi(n), then e ~= n^(p/(n+p)) ~= 2.732 .

(the same n was used previously computing e with primorial.  using the values of primes as we did then yielded slightly more precision (2.717) than using just their count as we do now.)

the typical way of computing fractional powers is with log and exp, but if you have such functions, then e = exp(1).

we chose n to be a power of 2 to permit easily computing the fractional power ^(p/n) in the first approximation without needing log and exp: the 1/n power in the can be computed by repeated square roots.  n^(p/n) = (n^p)^(1/n).  compute n^p first by augmenting machine precision floating point with an exponent that can become much larger than provided by the machine type.  the only operations one needs are multiplication and square root.  example implementation in Haskell.  there are some bits (pun!) of symmetry between exponentiation by squaring for the numerator of p/n followed by repeated square root for the denominator.

for the second approximation n^(p/(n+p)), one could have attempted to choose a different n such that n+p is a power of two.  but 3916608 + primepi(3916608) = 2^22-1 and 3916609 + primepi(3916609) = 2^22+1 (because 3916609 is prime), so it would have required some fudging.

better is to approximate the fractional exponent p/(n+p) as round(2^64 * p/(n+p))/2^64 .  (64 bits should be enough for everyone.)  for n = 2^22, p = 295947, this works out to to 1215802539408625636 / 2^64.

or, use Newton's method to compute the (n+p)th root of x^p.

comparing with methods that don't involve primes, but inputs of a similar scale:

e ~= (1+1/n)^n : for n=2^22, e ~= 2.718281504 .

sum(n=0, 10, 1.0/n!) ~= 2.71828180 , choosing 10 because 10! is the largest factorial less than 2^22 .

Sunday, March 01, 2026

[sguflopg] prime(x) = N*x

the 6455th prime number is 64553, a factor of about 10.

here are a few variations on estimating the crossover point using the prime number theorem.

if approximating the nth prime by n*log(n) :

nthprime(i) = 10*i
i*log(i) = 10*i
log(i) = 10
i = exp(10)
i ~= 22026.5

crossover predicted around the 22026th or 22027th prime, namely 249779 or 249797.

if approximating primepi(n)= n/log(n) :

primepi(n) = n/10
n/log(n) = n/10
log(n) = 10
n = exp(10)
n ~= 22026.5

crossover at 22026.5 (bracketed by primes 22013 and 22027 which have indices 2466 and 2467 respectively).

if approximating primepi(n)= n/(log(n)-1) :

primepi(n) = n/10
n/(log(n)-1) = n/10
solve(n=1000, 100000, n/(log(n)-1) - n/10)
n ~= 59874.1417

crossover predicted around 59874.1 which is bracketed by primes 59863 and 59879 which have indices 6048 and 6049 respectively.  this is the best approximation, albeit not closed form.

because exp grows exponentially (like it says on the tin), we will never know the exact crossover for larger factors, e.g., 100.

enumerate the crossover points for small integer factors.  there is much sophistication available for counting primes without explicitly generating them.

as of 2022, the record evaluation of the prime counting function is primepi(10^29) ~= primepi(exp(66.8)) ~= 10^29/65.8 . it will take a little more work to find the crossover point nthprime(x) = 65*x.

[vzqpqtrb] some slowly diverging and slowly converging integrals

evaluate these improper integrals from (some suitable lower bound avoiding undefined values) to infinity.

In[]:= Integrate[1/(x^(1)), x]

Out[]= Log[x]

In[]:= Integrate[1/(x^(1+1/n)), x]

Out[]= -(n/x^n^(-1))

the first integral diverges as x tends to infinity; the second converges.

NB: exponentiation is right associative, so the above expression is equal to -(n/x^(n^(-1))) = -n/(x^(1/n)) .

digression: set n=1 to show Riemann zeta(2) converges; Basel problem asks for its exact value.

In[]:= Integrate[1/(x*(Log[x])^(1)), x]

Out[]= Log[Log[x]]

In[]:= Integrate[1/(x*(Log[x])^(1+1/n)), x]

Out[]= -(n/Log[x]^n^(-1))

In[]:= Integrate[1/(x*Log[x]*(Log[Log[x]])^(1)), x]

Out[]= Log[Log[Log[x]]]

In[]:= Integrate[1/(x*Log[x]*(Log[Log[x]])^(1+1/n)), x]

Out[]= -(n/Log[Log[x]]^n^(-1))

it is nice that these all have simple form.

future post: infinite product of iterated log.

previously vaguely similar: twin primes and LogIntegral

[cgratocc] product of shifted iterated logarithms

each term has value 1 at n = 0:

f1(n) = (n+1) * log(n + e) * log log(n + e^e) * log log log(n + e^e^e) * ...

or, each term has value 1 at n = 1:

f2(n) = n * log(n * e) * log log(n * e^e) * log log log(n * e^e^e) * ...

does the product converge for n>0 or n>1 respectively?  integrate 1/f from n=0 or n=1 respectively to infinity.  does it diverge?

previously on iterated log.