This site is supported by donations to The OEIS Foundation.
User talk:Peter Luschny/OddsAndEnds
Contents
What is a prime number?
"greater than 1" is even worse
IMO, "greater than 1" is even worse than "positive", so I don't understand why you give this as second try. The natural definition of primes is, like that of irreducible elements (see that page for good definitions), always defined modulo the units (of a ring, e.g.).
Only in Z you have the order induced from R, but e.g. in Z+iZ you don't have such an order. Of course you might then "prefer" (or call "canonical representative") the elements in the first quadrant.
Similarly, in R[X], you will use as representative the unitary polynomials (with a(n)=1 where n=deg(P) [I resist the temptation to recall that P=a...]).
These choices are always almost rather arbitrary than canonical, and often people will not necessarily agree. (In Z+iZ, some might prefer the representative with -pi/4 < arg(z) <= pi/4, instead of 0 <= arg(z) < pi/2.)
The "correct" point of view IMHO is to say that A000040 lists the set of "conventional" (yes: positive) representatives of the primes in Z. — M. F. Hasler 23:25, 9 October 2012 (UTC)
Re: "greater than 1" is even worse
IMO, "greater than 1" is even worse than "positive",..
I agree. The notion of order has no place in a definition of primality.
...so I don't understand why you give this as second try.
Because in the first step I wanted to change the wording of A000040 as little as possible to show that these definitions are plain wrong if `number´ is understood as `element of Z´.
In the formulations into which I finally transformed the A000040-definitions ((Dnp) and (Dzp)) an order is no longer referenced.
The "correct" point of view IMHO is to say that A000040 lists the set of "conventional" (yes: positive) representatives of the primes in Z.
This is a good view, perhaps the best for a `working mathematician´.
On the other hand I do like the idea that the notion `prime´ is also meaningful in a semiring and even in a commutative monoid with cancellation law (Kürzungsregel) a*b = a*c --> b = c.
For more on this see the Webpage of Helmut Richter, who also gives some nice examples (in German) Warum 1 keine Primzahl ist.
— Peter Luschny 10:11, 10 October 2012 (UTC)
How to compute the number of partitions of 1,000,000?
Partition and Fibonacci numbers
The implementation of Euler's pentagonal number theorem (the blue function) can be easily extended by replacing the constant 2 by a parameter m. If this is done rather unexpectedly (at least to me) a connection to the Fibonacci numbers appears.
0: [ 1] 1: [ 1, 1] 2: [ 2, 2, 2] 3: [ 3, 3, 3, 3] 4: [ 5, 5, 5, 5, 5] 5: [ 7, 8, 8, 8, 8, 8] 6: [11, 14, 13, 13, 13, 13, 13] 7: [15, 23, 22, 21, 21, 21, 21, 21] 8: [22, 39, 36, 35, 34, 34, 34, 34, 34] 9: [30, 65, 60, 57, 56, 55, 55, 55, 55, 55] 10: [42, 109, 99, 94, 91, 90, 89, 89, 89, 89, 89] 11: [56, 183, 164, 154, 149, 146, 145, 144, 144, 144, 144, 144]
In the first column are the partition numbers and on the diagonal are the Fibonacci numbers. Can anybody give an interpretation of this connection?
The algorithm then looks like this:
@CachedFunction def PartToFibo(n, m): if n < 2: return 1 S = 0; J = n-1; j = m while 0 < J: T = PartToFibo(J, m) S = S-T if (j//m)%m == 0 else S+T J -= j//m if j%m == 0 else j j += 1 return S for n in (0..12): [PartToFibo(n+1,m+2) for m in (0..n)]
— Peter Luschny 23:11, 13 October 2012 (UTC)
Concerning the extension of Euler's pentagonal number theorem
Hello Peter,
numbers which for m = 5 are analogous to the generalized pentagonal
numbers for m = 2 are calculated by the following sage code:
m = 5 p_t_f = ['ph', 1] index_diff = [] sign = [] s = 'a' count_0 = 0 for n in range (2, 70): count_1 = 0 S = 0 J = n - 1 j = m while J >= 1: count_1 += 1 T = p_t_f[J] if (j // m) % m == 0: S -= T s = '-' else: S += T s = '+' if j % m == 0: J -= j // m else: J -= j j += 1 S p_t_f.append(S) p_t_f if count_1 > count_0: count_0 = count_1 index_diff.append(n - 1) sign.append(s) p_t_f_1 = ['ph', 1] for n in range (2, max(index_diff)+1): v = 0 index = 0 while index_diff[index] < n and index < len(index_diff): if sign[index] == '+': v += p_t_f[n-index_diff[index]] else: v -= p_t_f[n-index_diff[index]] index += 1 p_t_f_1.append(v) for n in range (1, max(index_diff)+1): n, p_t_f_1[n],p_t_f[n]
These numbers are stored in the list 'index_diff', the original values of
'PartToFibo' are stored in the list 'p_t_f' and the values of 'PartToFibo'
calculated by the numbers in 'index_diff' are stored in the list 'p_t_f_1'.
A list of the first numbers in 'index_diff' for some values of m:
m=2: [1, 2, 5, 7, 12, 15, 22, 26, 35, 40, 51, 57] m=3: [1, 2, 6, 11, 13, 20, 28, 31, 41, 52, 56] m=4: [1, 2, 7, 13, 20, 22, 31, 41, 52, 55, 68] m=5: [1, 2, 8, 15, 23, 32, 34, 45, 57] m=6: [1, 2, 9, 17, 26, 36, 47, 49, 62] m=7: [1, 2, 10, 19, 29, 40, 52, 65, 67]
Regards, Susanne Wienand, November 9, 2012.
How to compute ...?
Good solution
Solution (not implementation) due to Colin Barker:
def LinearRecurrence7(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13): x, y, z, u, v, w, s = Integer(a0),Integer(a1),Integer(a2), Integer(a3),Integer(a4),Integer(a5), Integer(a6) while true: yield x x, y, z, u, v, w, s = y, z, u, v, w, s, a13*x+a12*y+a11*z+a10*u+a9*v+a8*w+a7*s a = LinearRecurrence7(7,1,19,13,111,121,763,1,9,-5,-17,1,5,-1) [a.next() for i in range(29)]
Pi, Euler and Bernoulli
More general, let
w(z) approaches Pi as z goes to infinity. This function is the quotient Bernoulli-function/Euler-function. These terms are explained in my blog post on the lost Bernoulli numbers. Specialized to the Euler and Bernoulli numbers the relation on the front page results (and which is recorded in A013776).