6n-1,6n+1と五角数の関係 - Tarosa
2024/10/29 (Tue) 21:56:33
!6n-1,6n+1と五角数の関係
!A001318 Generalized pentagonal numbers: m*(3*m - 1)/2, m = 0, +-1, +-2, +-3, ....
OPTION ARITHMETIC NATIVE
FOR n=1 TO 1000/3
LET p=n*(3*n-1)/2
LET k=((6*n-1)^2-1)/24
LET p1=n*(3*n+1)/2
LET k1=((6*n+1)^2-1)/24
PRINT p;k
PRINT p1;k1
NEXT n
END
計算結果出力
1 1
2 2
5 5
7 7
12 12
15 15
22 22
26 26
35 35
40 40
51 51
57 57
70 70
77 77
92 92
100 100
6n+1 の数列を眺めていたら・・・
5以上のすべての素数のPn^2 が・・・
Re: 6n-1,6n+1と五角数の関係 - Tarosa
2024/10/29 (Tue) 22:03:58
!6n-1,6n+1
OPTION ARITHMETIC NATIVE
FOR n=1 TO 10000/6
LET p=SQR((n*(3*n-1)/2)*24+1)
!LET p=SQR(12*n*(3*n-1)+ 1)
LET k=6*n-1
LET p1=SQR((n*(3*n+1)/2)*24+1)
!LET p1=SQR(12*n*(3*n+1)+ 1)
LET k1=6*n+1
PRINT p;k
PRINT p1;k1
NEXT n
END
計算結果出力
5 5
7 7
11 11
13 13
17 17
19 19
23 23
25 25
29 29
31 31
35 35
37 37
41 41
43 43
47 47
49 49
53 53
55 55
59 59
確率的素数と5角数の関係
Re: 6n-1,6n+1と五角数の関係 - Tarosa
2024/10/29 (Tue) 22:08:50
!https://oeis.org/A001318
!A001318 Generalized pentagonal numbers: m*(3*m - 1)/2, m = 0, +-1, +-2, +-3, ....
OPTION ARITHMETIC NATIVE
LET t0=TIME
LET k6=1299709 !31607 !10億,31607 1億,9973
LET k2=100000 !3401 !10億,3401 1億,1229
!エラトステネスの篩
DIM P(k6)
DIM A(k2) !素数
MAT P=ZER
MAT A=ZER
LET A(1)=2
LET H1=1
FOR I=3 TO SQR(k6) STEP 2
IF P(I)=0 THEN
FOR J=I*I TO k6 STEP I
LET P(J)=1
NEXT J
END IF
NEXT I
FOR I=3 TO k6 STEP 2
IF P(I)=0 THEN
LET H1=H1+1
LET A(H1)=I
END IF
NEXT I
LET Z=10000
DIM Pn(z)
DIM Pm(z)
MAT Pn = ZER
LET cc=1
FOR n=1 TO z/2
LET pp=n*(3*n-1)/2
LET Pn(cc)=pp
LET cc=cc+1
LET p1=n*(3*n+1)/2
LET Pn(cc)=p1
LET cc=cc+1
NEXT n
LET S=0
FOR n=1 TO z
LET Pm(n)=SQR(Pn(n)*24+1)
!PRINT
next n
LET c1=1
LET cc=3
FOR n=1 TO z
LET DD=Pm(n)
FOR nn=c1 TO z
IF DD=A(nn) THEN
PRINT cc;A(nn)
LET cc=cc+1
LET c1=c1+1
EXIT FOR
END IF
NEXT nn
NEXT n
LET TM=TIME-t0
PRINT USING"####." & REPEAT$("#",2):TM;
PRINT "秒"
END
計算結果出力
3 5
4 7
5 11
6 13
7 17
8 19
9 23
10 29
11 31
12 37
13 41
14 43
15 47
16 53
17 59
18 61
19 67
20 71
21 73
22 79
23 83
24 89
25 97
26 101
素数の個数と素数