0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

2025にまつわる計算をプログラムで

Last updated at Posted at 2025-03-01

2025年

あけましておめでとうございます

環境

processing

①45^2

45^2=2025
(=3^45^2)
print(45*45);

②和の平方

(20+25)^2=2025
int year = 2025;
int a = year/100;
int b = year%100;
print((a+b)*(a+b));

③1桁数の和の平方

(\sum_{n=1}^{9}n)^2=(1+2+3+4+5+6+7+8+9)^2=2025
int sum = 0;
for(int n=1; n<10; n++)  sum += n;
print(sum*sum);

④3乗和

\sum_{n=1}^{9}n^3=1^3+2^3+3^3+4^3+5^3+6^3+7^3+8^3+9^3=2025
int sum=0;
for(int n=1; n<10; n++)  sum += n*n*n;
print(sum);

ニコマクスの定理

1^3+2^3+3^3+4^3+5^3+\cdots=(1+2+3+4+5+\cdots)^2

拡張式:ファウルハーバーの公式

⑤九九の総和

\sum_{n=1}^{9}\sum_{m=1}^{9} nm
int sum = 0;
for(int n=1; n<10; n++)
  for(int m=1; m<10; m++)
    sum += n*m;
print(sum);

⑥平方の和

27^2+36^2=2025
int sum = 0;
for(int n=1; n<45; n++)
  for(int m=1; m<45; m++)
    if(n*n+m*m==2025)
      println(n,m);
\displaylines{
4^2+28^2+35^2=2025\\
5^2+ 8^2+ 44^2=2025\\
5^2+ 20^2+ 40^2=2025\\
6^2+ 15^2+ 42^2=2025\\
6^2+ 30^2+ 33^2=2025\\
8^2+ 19^2+ 40^2=2025\\
13^2+ 16^2+ 40^2=2025\\
(15^2+ 30^2+ 30^2=2025)\\
16^2+ 20^2+ 37^2=2025\\
(20^2+ 20^2+ 35^2=2025)\\
20^2+ 28^2+ 29^2=2025\\
}
for (int n=1; n<45; n++)
  for (int m=1; m<45; m++)
    for (int l=1; l<45; l++)
      if (n*n+m*m+l*l==2025)
        if (n<=m && m<=l)
          println(n, m, l);

以下、結果のみ
1 2 16 42
1 2 24 38
1 8 14 42
1 10 18 40
1 10 30 32
1 16 18 38
1 18 26 32
2 2 9 44
2 4 18 41
2 4 22 39
2 6 7 44
2 6 31 32
2 7 26 36
2 9 28 34
2 10 20 39
2 10 25 36
2 12 14 41
2 14 15 40
2 14 23 36
2 16 26 33
2 17 24 34
2 22 24 31
3 4 8 44
3 4 20 40
3 12 24 36
4 4 12 43
4 6 23 38
4 7 14 42
4 8 24 37
4 9 22 38
4 12 29 32
4 16 27 32
4 18 23 34
4 21 28 28
4 22 25 30
5 12 16 40
5 20 24 32
6 7 28 34
6 9 12 42
6 10 17 40
6 12 18 39
6 16 17 38
6 17 26 32
6 18 24 33
6 23 26 28
7 12 26 34
7 14 22 36
7 20 26 30
8 10 30 31
8 14 26 33
8 18 26 31
8 19 24 32
9 10 20 38
9 12 30 30
9 18 18 36
9 22 26 28
10 10 12 41
10 10 15 40
10 10 23 36
10 12 25 34
10 15 16 38
10 15 26 32
10 20 25 30
12 12 21 36
12 14 23 34
12 16 16 37
12 16 20 35
12 16 28 29
12 23 26 26
12 24 24 27
13 16 24 32
14 16 22 33
14 20 23 30
15 18 24 30
16 16 27 28
16 17 18 34
16 18 22 31
17 22 24 26
18 20 25 26
20 20 21 28

for (int n=1; n<45; n++)
  for (int m=1; m<45; m++)
    for (int l=1; l<45; l++)
      for (int p=1; p<45; p++)
      if (n*n+m*m+l*l+p*p==2025)
        if (n<=m && m<=l && l<=p)
          println(n, m, l, p);

⑦3乗の和

\displaylines{
n^3+m^3=2025\\
n^3+m^3+l^3=2025\\
}

を満たす自然数は見つからない。

\displaylines{
n^3+m^3+l^3+p^3=2025\\
}

の場合、

\displaylines{
1^3+8^3+8^3+10^3=2025\\
2^3+7^3+7^3+11^3=2025\\
}
for (int n=1; n<13; n++)
  for (int m=1; m<13; m++)
    for (int l=1; l<13; l++)
      for (int p=1; p<13; p++)
      if (n*n*n+m*m*m+l*l*l+p*p*p==2025)
        if (n<=m && m<=l && l<=p)
          println(n, m, l, p);
\displaylines{
n^3+m^3+l^3+p^3+q^3=2025\\
}

の場合、

\displaylines{
2^3+6^3+7^3+9^3+9^3=2025\\
3^3+3^3+3^3+6^3+12^3=2025\\
}

⑧他

\displaylines{
(82^4-1)\mod2025=0\\
(82^4-1)=(82^2+1)(82+1)(82-1)=3^4\times5^2\times83\times269\\
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?