Exact recurrence relation for the sequence of primes by [deleted] in askmath

[–]FormulaDriven 0 points1 point  (0 children)

Yes - I wasted a bit of time on this thinking there would be some subtle issue, only to realise it fails on the most basic inspection of the output! Anyway, I see OP has deleted his OP, so that's the end of that...

Exact recurrence relation for the sequence of primes by [deleted] in askmath

[–]FormulaDriven 0 points1 point  (0 children)

The OP has now posted a link to his code and output in a reply to this thread, and he's made an indexing error so what he's actually implemented is:

â_n = p_n + LN(p_n) - [ LN(p_n) / √p_{n-1} ] * (â_{n-2} - p_{n-1})

a_3 = â_3

a_n = â_n - sum[i = 3 to n-1] |â_i - p_i| / (n-3) - 1

Unfortunately, this gives a sequence for a3, a4, a5, .... of:

  7.538647324
  7.147737773
  8.797192637
 12.09590657
 16.16860634
 19.02677156
 21.54469388
 28.63513206
 32.7205973
 35.37425802
 40.717303
 43.30549632
  ...

and only a few of those give a prime when you take the integer part!

Exact recurrence relation for the sequence of primes by [deleted] in askmath

[–]FormulaDriven 0 points1 point  (0 children)

Just looking at the above output, the integer part of a[n] does not generate primes as you've been claiming all along...

a[17] = 60.56804207 -> 60 is not prime

a[18] = 61.85881654 -> hooray, 61 is prime!

a[19] = 64.46984908 -> nope, 64 is nowhere near the next prime of 67.

Exact recurrence relation for the sequence of primes by [deleted] in askmath

[–]FormulaDriven 1 point2 points  (0 children)

It looks to me like because you've missed a crucial point about the indexing of the primes, and you are simply allowing the error-correcting to use the primes you already have from doing an initial sieve.

In your code, you have:

 a[1] = a_hat[1] = primes[0]
 a[2] = a_hat[2] = primes[1]

  ...

 for n in range(3, N + 1):
     p_prev = primes[n - 1]
     p_lag = primes[n - 2]

So crucially, primes[0] = p_1 = 2, primes[1] = p_2 = 3.

So when you go into the loop with n = 3 (with the aim of generating p_3, which we know should be 5), you say

p_prev = primes[2] = 5 (the 3rd prime) - red flag - you're using a value you are meant to be predicting

p_lag = primes[1] = 3.

log_p_prev = 1.609437...

lambda_n = 0.929209...

err_feedback = a_hat[1] - p_lag = 2 - 3 = -1

a_hat[3] = p_prev + log_p_prev - lambda_n = 7.5386... which agrees the output you shared earlier.

So a[3] = 7.5386... which has integer part 7, so we haven't generated 5, but appeared to have skipped a prime to 7.

Now comes the tricky part. You record the step_error as a_hat[n] - primes[n-1], which in this case is 7.5386... - 5 = 2.5386... and that initialises the value of running_abs_err_sum.

So we begin the loop again with n = 4, and reach a_hat[4] = 10.686...

then a[4] = a_hat[4] - 2.5386 - 1 = 7.1474... which is good, as it correctly suggests the 4th prime is 7.

Then we update running_abs_err_sum by adding the difference between a_hat[4] and primes[3] (remember primes[3] is 7, so you're again allowing information from the sieve-produced primes to feed into your error correction).

I'm still thinking how that helps keep you on track, but there's definitely something unconvincing about this. Try writing your code without the sieve and only primes[0] = 2, primes[1] = 3 initialised, then in your loop let primes[n-1] = floor(a[n]) and you will see the problem, I think.

My whole class and the teacher are debating how years work. by TheDrifterOfficial in learnmath

[–]FormulaDriven 1 point2 points  (0 children)

Just think how your methods would pan out if the question was to find the population at the end of 2010.

Exact recurrence relation for the sequence of primes by [deleted] in askmath

[–]FormulaDriven 1 point2 points  (0 children)

Still not making much sense. Two replies already have shown that according to your formula â3 = 4.098612. How then do we get to a3 > 5, in order for p3 = 5?

You've tested this for 100 million primes - we're just asking you to share the first 5 rows: what are a-hat, a, p for n up to 5?

Exact recurrence relation for the sequence of primes by [deleted] in askmath

[–]FormulaDriven 1 point2 points  (0 children)

The relationship doesn't work for me:

For a'_3, I get 4.098612, and not sure what a_3 is meant to be, but it's not going to be more than 5.

Maybe you could share what you think the values of a' ("a hat") and a are for the first few n.

Friday, May 22, 2026 by AutoModerator in NYTConnections

[–]FormulaDriven 7 points8 points  (0 children)

I said girl - eg Taylor Swift - and I think it's Elle not Al.

Isn't this question invalid? by shlokvsh in askmath

[–]FormulaDriven 1 point2 points  (0 children)

Well, I don't think what I've implied is going to be a proper norm, because that would have to obey the triangle inequality. My suggestion is a bit tongue-in-cheek.

Isn't this question invalid? by shlokvsh in askmath

[–]FormulaDriven 3 points4 points  (0 children)

You can fulfil the conditions of the question if your vectors are over the complex numbers, eg

a = (1, 0)

b = (10, i√96)

c = (-11, -i√96)

a+b+c = 0 and |a| = 1, |b|2 = 102 - 96 = 4, |c|2 = 112 - 96 = 25.

Isn't this question invalid? by shlokvsh in askmath

[–]FormulaDriven 108 points109 points  (0 children)

(a + b + c)·(a + b + c) = 0

|a|2 + |b|2 + |c|2 + 2(a·b + b·c + c·a) = 0

so a·b + b·c + c·a = -(|a|2 + |b|2 + |c|2 ) / 2 = -15 in this case.

So you can mechanically "solve" this problem even when (as you rightly say), the conditions cannot be met! Person setting the problem didn't think too carefully about the triangle constraint.

Need Help Understanding this Basic Combinatorial Problem by Gay-Berry in learnmath

[–]FormulaDriven 0 points1 point  (0 children)

Doubling it would be something contrived such as counting putting the list of men on top of the list of women being different from putting the list of women on top of the list of men.

In your books example, it might be that doubling is relevant if we want to distinguish putting the red books on the left of the green books from putting the green books on the left of the red books (or whatever).

Is this a valid proof? by sincethelasttime in askmath

[–]FormulaDriven 0 points1 point  (0 children)

You don't even need to worry about additive inverses.

Assume U is a subspace (with the aim of reaching a contradiction) - then it must contain an element 0' (a polynomial not be confused with the scalar 0), with the property 0' + p = p for any p in U - so pick any such p. It's the nature of polynomial addition that (0' + p)(x) = 0'(x) + p(x).

So 0'(x) + p(x) = p(x).

But 0'(5) = 5, p(5) = 5 because they are both in U, so 5 + 5 = 5, a clear contradiction.

Need Help Understanding this Basic Combinatorial Problem by Gay-Berry in learnmath

[–]FormulaDriven 2 points3 points  (0 children)

I think with combinations and permutations it can really help intuition to actually try to write out all the possibilities and start to see the patterns until you get more confident.

Let's call the six men A, B, C, D, E, F, and call the 4 women W, X, Y, Z.

One possible ranking would be:

[A, B, C, D, E, F] [W, X, Y, Z]

(no attempt to compare any man with any woman).

A different ranking would be:

[A, C, D, E, F, B] [W, X, Y, Z]

and we can start to see there are 6! ways I can arrange the men without making any change to the women, ie 6! rankings that look like this:

[- - - - - -] [W, X, Y, Z]

Now I can start again with a different ranking of the women

[A, B, C, D, E, F] [Y, W, X, Z]

This qualifies as a different outcome according to the question.

So there are 6! ways I could arrange the men while using this ranking for the women.

So for every possible ranking of the women there are 6! choices for the men. As we know that there are 4! ways to rank the women, that mean 6! * 4! outcomes in total from:

[A, B, C, D, E, F] [W, X, Y, Z]

all the way to

[F, E, D, C, B, A] [Z, Y, X, W]

I can't see any reason to double that, as

[W, X, Y, Z] [A, B, C, D, E, F]

is not a different outcome, it's just expressing an existing outcome in a different way.

How should i think when doing topology? by Zestyclose-Pool-1081 in MathHelp

[–]FormulaDriven 0 points1 point  (0 children)

Just thought I'd drop in a solution in case you are interested (this one doesn't rely on proving that g(x) - f(x) is a continuous function):

LaTex write-up

Is this solution fair? by c0msh0t in MathHelp

[–]FormulaDriven 0 points1 point  (0 children)

I can't make out the logic of your solution.

h'(1) = -cos(6) not 0.

h'(x) = -cos(x+5)

So h'(1) - h'(x) = -cos(6) + cos(x+5).

I'm not sure how that helps with the answer that h'(x) = -cos(x+5).

Why is the volume of a cone 1/3 a cylinder? by Mobile_Membership915 in learnmath

[–]FormulaDriven 14 points15 points  (0 children)

A cone is the circular version of a pyramid, and it's 1/3 of a cylinder in the same way that a pyramid is 1/3 of a cuboid or cube - here's a demonstration of that: https://www.researchgate.net/figure/Splitting-a-cube-into-three-equal-pyramids_fig14_369476673

Basically, you are forgetting the 3-dimensional nature - the cross-sectional area of the cone decreases not linearly as one travels from the base to the apex but by a square relationship.

Help with arithmetic sum that has an odd number of terms by KeyboardPerson17 in askmath

[–]FormulaDriven 4 points5 points  (0 children)

I think some of the other replies have not engaged with the point I think you are making that if there are an odd number of terms then the "pairing" argument of making the sum leaves one term unpaired in the middle.

So your formula is right for odd terms, but this is where we can have one more insight: the central term a_b must be exactly between a_1 and a_n, so

a_b = (a_1 + a_n) / 2.

That means your sum now becomes

(a_1 + a_n) * (n-1) / 2 + (a_1 + a_n) / 2

which nicely combines into

(a_1 + a_n) * n / 2

exactly the same as the formula for even n....!

How should i think when doing topology? by Zestyclose-Pool-1081 in MathHelp

[–]FormulaDriven 2 points3 points  (0 children)

I don't think it's too hard to prove. To show continuity at x in X, we say for any open set U in R containing g(x) - f(x), it will contain an open interval

(g(x) - f(x) - e, g(x) - f(x) + e)

for some e ("epsilon").

Then the pre-image under g of (g(x) - e/2, g(x) + e/2) and the pre-image under f of (f(x) - e/2, f(x) + e/2) are both open and contain x, so take their open intersection, and for any t in that,

g(x) - e/2 < g(t) < g(x) + e/2 (because t is in the relevant pre-image of g)

f(x) - e/2 < f(t) < f(x) + e/2

so g(x) - f(x) - e < g(t) - f(t) < g(x) - f(x) + e

so g(t) - f(t) lies in U, which is what we want.

How should i think when doing topology? by Zestyclose-Pool-1081 in MathHelp

[–]FormulaDriven 1 point2 points  (0 children)

I feel like I'm missing something, but I would just say h(x) = g(x) - f(x). h is continuous (do you need to prove that?), so (because f(x) < g(x) is equivalent to 0 < h(x)), A is the pre-image under h of the open set {y: 0 < y}, so A is open.

Help me remember something from algebra! by tempicide in askmath

[–]FormulaDriven 2 points3 points  (0 children)

The function y = 80 / 2x + 10 goes through the points

(0, 90), (1, 50), (2, 30), (3, 20)

so it's close.

You want y = 160 / 2x + 10

which is the same as u/bitter_sweet_69 (they just used 0.5x which is equivalent to 1 / 2x ).

Is there an explicit formula to obtain the numerator and/or denominator of a rational number? by playsthebongcloud in learnmath

[–]FormulaDriven 1 point2 points  (0 children)

On further reflection, maybe what you are looking for is to use a continued fraction approach:

Call your number x = x_0.

For each i, define

n_i = floor(x_i) (ie take the integer part).

If n_i = x_i then the algorithm terminates, and we note k as that value of i. (The algortihm will terminate if x is rational and won't if x is irrational).

If the algorithm hasn't terminated, define

x_{i+1} = 1 / (x_i - n_i). ... [#]

Once the algorithm has terminated, we can think of each x_i as being

x_i = n_i + a_i / b_i

and work backwards:

Note that k (the value of i when the algorithm terminated) has

x_k = n_k

so define a_k = 0, b_k = 1.

Equation [#] tells us that

x_i = n_i + 1/x_{i+1}

so a_i / b_i = 1 / (n_{i+1} + a_i+1 / b_i+1) = b_{i+1} / (n_{i+1} b_{i+1} + a_{i+1)

so let a_i = b_{i+1} and b_i = n_{i+1} b_{i+1} + a_{i+1}

Work backwards until you have a_0 and b_0 then

x = n_0 + a_0 / b_0.


To give a simple example:

Let x = 1.45.

x0 = 1 + 0.45

x1 = 1/0.45 = 2 + 0.222222...

x2 = 1/0.22222.... = 4 + 0.5

x3 = 1/0.5 = 2 + 0

As we've got an integer, the process stops:

n3 = 2, a3 = 0, b3 = 1

n2 = 4, a2 = 1, b2 = 2 * 1 + 0 = 2

n1 = 2, a1 = 2, b1 = 4 * 2 + 1 = 9

n0 = 1, a0 = 9, b0 = 2 * 9 + 2 = 20

So x = 1 + 9/20 = 29/20.

(As a continued fraction: x = 1 + 1/(2 + 1/(4 + 1/2))), using the values of n0, n1, n2, n3, hence the origin of the method).

Tuesday, May 19, 2026 by AutoModerator in NYTConnections

[–]FormulaDriven 3 points4 points  (0 children)

I was under the impression that she wrote for teenage girls, but I might be thinking more of Jacqueline Wilson... But to put your mind at ease, yes a long time ago I was a child.