Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Revision History for A117351

(Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing entries 1-10 | older changes
Where n appears in A082224, provided A082224 is read as a sequence rather than as an array.
(history; published version)
#17 by Bruno Berselli at Fri Feb 26 05:00:22 EST 2021
STATUS

reviewed

approved

#16 by Joerg Arndt at Fri Feb 26 04:59:46 EST 2021
STATUS

proposed

reviewed

#15 by Petros Hadjicostas at Fri Feb 26 03:04:10 EST 2021
STATUS

editing

proposed

Discussion
Fri Feb 26
03:07
Michel Marcus: b[ii] is the condition : 0 false; >0 : true
03:15
Petros Hadjicostas: OK, thanks. (Computer programmers invented these shortcuts to programming, but that is why programs are not readable! Do you really think I fully understand Max's original programs?)
04:59
Joerg Arndt: "if (b[ii], " --> "if (b[ii]!=0, " for readability (if you like). Or "if (b[ii]<>0, " to make Peter Luschny happy 8^)
#14 by Petros Hadjicostas at Fri Feb 26 02:59:26 EST 2021
PROG

(PARI) lista(nn) = { A=matrix(nn, nn); my(b=vector(nn^2)); S=Set(); for(s=2, nn+1, for(i=1, s-1, if(s%2, q=[i, s-i], q=[s-i, i]); p=[sum(j=1, q[2]-1, A[q[1], j]), sum(j=1, q[1]-1, A[j, q[2]])]; n=1; while(setsearch(S, n) || (p[1]&&!isprime(p[1]+n)) || (p[2]&&isprime(p[2]+n)), n++); A[q[1], q[2]]=n; S=setunion(S, Set([n])); mm=(q[1]+q[2]-1)*(q[1]+q[2]-2)/2 + q[2]*(1 + (-1)^(q[1]+q[2]))/2 + q[1]*(1 - (-1)^(q[1]+q[2]))/2; b[n]=mm; )); for(ii=1, nn^2, if (b[ii], print1(b[ii], ", "), break)); } \\ If the desired a(n) does not appear in the output is 0, , then one needs to increase the value of nn in lista(nn) until a(n) becomes positiveappears. This program is a modification of the PARI program by Max Alekseyev in A082228. - Petros Hadjicostas, Feb 25 2021

STATUS

proposed

editing

Discussion
Fri Feb 26
03:04
Petros Hadjicostas: OK, it works. I fixed the program. Thanks. But where is the condition in the if(...) statement?
#13 by Michel Marcus at Fri Feb 26 00:14:34 EST 2021
STATUS

editing

proposed

Discussion
Fri Feb 26
00:31
Petros Hadjicostas: I do not know how to exit (when a condition is satisfied) in PARI! I am still a novice... I took Max's program and modified it slightly. Sometimes I had to check your emails from last year.
00:33
Petros Hadjicostas: Because an integer n may be appear far away in this sequence, it is impossible to know in advance how large the matrix A should be for that to happen (unless of course someone studies this problem mathematically and derives reasonable bounds on the position of n).
02:48
Michel Marcus: you can try this suggestion for last instruction: for(ii=1, nn^2, if (b[ii], print1(b[ii], ", "), break));
#12 by Michel Marcus at Fri Feb 26 00:11:55 EST 2021
PROG

(PARI) lista(nn) = { A=matrix(nn, nn); my(b=vector(nn^2)); S=Set(); for(s=2, nn+1, for(i=1, s-1, if(s%2, q=[i, s-i], q=[s-i, i]); p=[sum(j=1, q[2]-1, A[q[1], j]), sum(j=1, q[1]-1, A[j, q[2]])]; n=1; while(setsearch(S, n) || (p[1]&&!isprime(p[1]+n)) || (p[2]&&isprime(p[2]+n)), n++); A[q[1], q[2]]=n; S=setunion(S, Set([n])); mm=(q[1]+q[2]-1)*(q[1]+q[2]-2)/2 + q[2]*(1 + (-1)^(q[1]+q[2]))/2 + q[1]*(1 - (-1)^(q[1]+q[2]))/2; b[n]=mm; )); for(ii=1, nn^2, print1(b[ii], ", ")); } // \\ If the desired a(n) in the output is 0, then one needs to increase the value of nn in lista(nn) until a(n) becomes positive. This program is a modification of the PARI program by Max Alekseyev in A082228. - Petros Hadjicostas, Feb 25 2021

STATUS

proposed

editing

Discussion
Fri Feb 26
00:14
Michel Marcus: in the last piece, maybe you could exit as soon as b[ii] is 0 ?
#11 by Petros Hadjicostas at Thu Feb 25 20:52:05 EST 2021
STATUS

editing

proposed

#10 by Petros Hadjicostas at Thu Feb 25 20:51:46 EST 2021
NAME

Where n appears in A082224, provided A082224 is read as a sequence rather than as an array.

STATUS

proposed

editing

#9 by Petros Hadjicostas at Thu Feb 25 20:32:08 EST 2021
STATUS

editing

proposed

#8 by Petros Hadjicostas at Thu Feb 25 20:28:38 EST 2021
PROG

(PARI) lista(nn) = { A=matrix(nn, nn); my(b=vector(nn^2)); S=Set(); for(s=2, nn+1, for(i=1, s-1, if(s%2, q=[i, s-i], q=[s-i, i]); p=[sum(j=1, q[2]-1, A[q[1], j]), sum(j=1, q[1]-1, A[j, q[2]])]; n=1; while(setsearch(S, n) || (p[1]&&!isprime(p[1]+n)) || (p[2]&&isprime(p[2]+n)), n++); A[q[1], q[2]]=n; S=setunion(S, Set([n])); mm=(q[1]+q[2]-1)*(q[1]+q[2]-2)/2 + q[2]*(1 + (-1)^(q[1]+q[2]))/2 + q[1]*(1 - (-1)^(q[1]+q[2]))/2; b[n]=mm; )); for(ii=1, 100nn^2, print1(b[ii], ", ")); } // If the desired a(n) in the output is 0, then one needs to increase the value of nn in lista(nn) until a(n) becomes positive. This program is a modification of the PARI program by Max Alekseyev in A082228.- Petros Hadjicostas, Feb 25 2021