Determine all four-digit numbers $\overline{abcd} $ such that $(a + b)(a + c)(a + d)(b + c)(b + d)(c + d) =\overline{abcd} $:
Problem
Source: JBMO 2016 Shortlist N5
Tags: JBMO, number theory
05.01.2018 14:53
for a in range (1,10): for b in range (0,10): for c in range (0,10): for d in range (0,10): if 1000*a+100*b+10*c+d == (a+b)*(a+c)*(a+d)*(b+c)*(b+d)*(c+d): print (a,b,c,d)for a in range (1,10): for b in range (0,10): for c in range (0,10): for d in range (0,10): if 1000*a+100*b+10*c+d == (a+b)*(a+c)*(a+d)*(b+c)*(b+d)*(c+d): print (a,b,c,d)RunResetPop Out /
05.01.2018 15:04
https://pregatirematematicaolimpiadejuniori.files.wordpress.com/2017/06/shortlist_jbmo_2016_v7-1.pdf
05.01.2018 23:10
2016 the key is
14.04.2020 13:47
boboceageorge wrote: https://pregatirematematicaolimpiadejuniori.files.wordpress.com/2017/06/shortlist_jbmo_2016_v7-1.pdf Hello, do you have for other years?
03.03.2024 00:13
#include <bits/stdc++.h> #define ll long long using namespace std; signed main(){ ll i , j , k , l; for(i = 1 ; i < 10 ; i++){ for(j = 0 ; j < 10 ; j++){ for(k = 0 ; k < 10 ; k++){ for(l = 0; l < 10 ; l++){ if((i + j) * (i + k) * (i + l) * (j + k) * (j + l) * (k + l) == (i * 1000 + j * 100 + k * 10 + l)){ cout << i << j << k << l << endl; } } } } } }
19.01.2025 20:26
#include<bits/stdc++.h> #include<iostream> #include<string> #include<vector> #include<queue> #include<deque> #define sync using ll=long long; using namespace std; int main() { for(int a=1000 ; a<10000; a++){ ; long long a1,a2,a3,a4; a1=a/1000; a2=a/100%10; a3=a/10%10; a4=a%10; if((a1+a2)*(a1+a3)*(a1+a4)*(a2+a3)*(a2+a4)*(a3+a4)==a) cout<<a<<" "; } }
19.01.2025 20:27
Aykhan_2009 wrote: #include <bits/stdc++.h> #define ll long long using namespace std; signed main(){ ll i , j , k , l; for(i = 1 ; i < 10 ; i++){ for(j = 0 ; j < 10 ; j++){ for(k = 0 ; k < 10 ; k++){ for(l = 0; l < 10 ; l++){ if((i + j) * (i + k) * (i + l) * (j + k) * (j + l) * (k + l) == (i * 1000 + j * 100 + k * 10 + l)){ cout << i << j << k << l << endl; } } } } } } I think mine is shorter. #include<bits/stdc++.h> using namespace std; int main() { for(int a=1000 ; a<10000; a++){ ; long long a1,a2,a3,a4; a1=a/1000; a2=a/100%10; a3=a/10%10; a4=a%10; if((a1+a2)*(a1+a3)*(a1+a4)*(a2+a3)*(a2+a4)*(a3+a4)==a) cout<<a<<" "; } }