Soit
i)Calculer les images du segment [|0;10|] par f
ii)déterminer le ou les applications vérifiant ces propriétés
merci.
Tiruxa a écrit:Bon je ne sais pas si c'est la solution la plus courte mais j'ai trouvé cela pour f(7).
f(7²+24²)=f(25²)=f(25)²=f(5²)²=f(5)^4=5^4=625
donc f(7)²+f(24)²=625
de plus
f(24²+10²)=f(26²)=f(26)²=f(5²+1²)²=(f(5)²+f(1)²)²=26²=676
donc f(24)²+f(10)²=676
ou f(24)²=676-100=576
On a donc en remplaçant
f(7)²+576=625
d'où f(7)²= 49 donc f(7)=7
function Tree(val, a,b){
this.val=val;
this.a=a;
this.b=b;
}
Tree.prototype.innerToString=function(){
return 'f('+this.val+')=f('+this.a.val+')^2 + f('+this.b.val+')^2';
}
Tree.prototype.toString=function(offset, history){
if(typeof(offset)=='undefined'){
offset = '';
}
if(typeof(history)=='undefined'){
history = {values:[]};
}
if(history.values.indexOf(this.val)==-1){
history.values.push(this.val);
var str = [offset+this.innerToString()];
str.push(this.a.toString(offset+'.', history));
str.push(this.b.toString(offset+'.', history));
str.push(offset+'->'+this.value());
return str.join('\n');
}
return offset+'->remind f('+this.val+')='+this.value();
}
Tree.prototype.value=function(){
var r=this.a.value();
var s=this.b.value();
return r*r+s*s;
}
function MinusTree(val, a,b){
Tree.call(this, val, a,b);
}
function TerminalNode(val){
Tree.call(this, val);
}
TerminalNode.prototype = new Tree;
TerminalNode.prototype.toString=function(offset){
if(typeof(offset)=='undefined'){
offset = '';
}
return offset+'f('+this.val+')='+this.val;
}
TerminalNode.prototype.value=function(){
return this.val;
}
MinusTree.prototype = new Tree;
MinusTree.prototype.innerToString=function(){
return 'resolving: f('+this.val+')=sqrt(f('+this.a.val+')^2 - f('+this.b.val+')^2)';
}
MinusTree.prototype.value=function(){
var r=this.a.value();
var s=this.b.value();
return Math.sqrt(r*r - s*s);
}
function Map(){
this.map=[];
this.tree={};
}
Map.prototype.has = function(k){
return this.map.indexOf(k)!=-1;
}
Map.prototype.store = function(val,a,b){
this.map.push(val);
if(arguments.length==1){
this.tree[val] = new TerminalNode(val);
}else{
this.tree[val] = new Tree(val, a,b);
}
}
Map.prototype.minusStore = function(val,a,b){
this.map.push(val);
this.tree[val] = new MinusTree(val, a,b);
}
Map.prototype.get = function(k){
return this.tree[k];
}
var map = new Map;
map.store(0);
map.store(1);
var exclusionList = [];
function couple(a,b){//integers
var c = a*a+b*b
if(!map.has(c)){
map.store(c, f(a),f(b));
}
return map.get(c);
}
/**
a:int
returns Tree
*/
function f(a){
if(!map.has(a)){
f.resolve(a);
}
return map.get(a);
}
function isSquare(a){
var t = Math.round(Math.sqrt(a))
return Math.abs(t*t - a)<1e-9
}
function isDoubleSquare(a){
if(a%2==0){
a/=2;
return isSquare(a);
}
return false;
}
function getSumSquare(a){
for(var i=1; i*i<a; ++i){
var b=a-i*i;
if(isSquare(b)){
return [i, Math.round(Math.sqrt(b))];
}
}
}
function minusSquare(a){
var i=0;
var candidates=[];
while(++i && i<=(a*a-1)/2){
if(exclusionList.indexOf(i)!=-1){
continue;
}
var c = a*a+i*i;
var t = Math.round(Math.sqrt(c));
if(isSquare(c)){
candidates.push( [t,i] )
}
}
return candidates;
}
f.resolve = function(a){//int
if(isDoubleSquare(a)){
var t = Math.round(Math.sqrt(a/2));
map.store(a, f(t), f(t));
return map.get(a);
}
if(isSquare(a)){
var t = Math.round(Math.sqrt(a));
map.store(a, f(t), f(0));
return map.get(a);
}
var sumsq = getSumSquare(a);
if(sumsq){
exclusionList.push(a);
map.store(a, f(sumsq[0]), f(sumsq[1]));
exclusionList.pop();
return map.get(a);
}
var candidates = minusSquare(a);
exclusionList.push(a);
var res = candidates.some(function(c){
if(!f(c[0]) || !f(c[1])){
return false;
}
map.minusStore(a, f(c[0]), f(c[1]));
return true;
});
exclusionList.pop();
return map.get(a);
}
console.log(f(33).toString());
console.log(f(165).toString());
mathelot a écrit:car supposé non nul
si
f est elle "multivoque" ,ie, avec plusieurs possibilités pour f(x)
pour un même x ?
un même entier ayant parfois de nombreuses décompositions comme somme de deux carrés.
resolving: f(15)=sqrt(f(17)^2 - f(8)^2)
.f(17)=f(1)^2 + f(4)^2
..f(1)=1
..f(4)=f(2)^2 + f(0)^2
...f(2)=f(1)^2 + f(1)^2
....f(1)=1
....f(1)=1
...->2
...f(0)=0
..->4
.->17
.f(8)=f(2)^2 + f(2)^2
..f(2)=f(1)^2 + f(1)^2
...f(1)=1
...f(1)=1
..->2
..f(2)=f(1)^2 + f(1)^2
...f(1)=1
...f(1)=1
..->2
.->8
->15
resolving: f(33)=sqrt(f(65)^2 - f(56)^2)
.f(65)=f(1)^2 + f(8)^2
..f(1)=1
..f(8)=f(2)^2 + f(2)^2
...f(2)=f(1)^2 + f(1)^2
....f(1)=1
....f(1)=1
...->2
...f(2)=f(1)^2 + f(1)^2
....f(1)=1
....f(1)=1
...->2
..->8
.->65
.resolving: f(56)=sqrt(f(70)^2 - f(42)^2)
..resolving: f(70)=sqrt(f(74)^2 - f(24)^2)
...f(74)=f(5)^2 + f(7)^2
....f(5)=f(1)^2 + f(2)^2
.....f(1)=1
.....f(2)=f(1)^2 + f(1)^2
......f(1)=1
......f(1)=1
.....->2
....->5
....resolving: f(7)=sqrt(f(25)^2 - f(24)^2)
.....f(25)=f(5)^2 + f(0)^2
......f(5)=f(1)^2 + f(2)^2
.......f(1)=1
.......f(2)=f(1)^2 + f(1)^2
........f(1)=1
........f(1)=1
.......->2
......->5
......f(0)=0
.....->25
.....resolving: f(24)=sqrt(f(26)^2 - f(10)^2)
......f(26)=f(1)^2 + f(5)^2
.......f(1)=1
.......f(5)=f(1)^2 + f(2)^2
........f(1)=1
........f(2)=f(1)^2 + f(1)^2
.........f(1)=1
.........f(1)=1
........->2
.......->5
......->26
......f(10)=f(1)^2 + f(3)^2
.......f(1)=1
.......resolving: f(3)=sqrt(f(5)^2 - f(4)^2)
........f(5)=f(1)^2 + f(2)^2
.........f(1)=1
.........f(2)=f(1)^2 + f(1)^2
..........f(1)=1
..........f(1)=1
.........->2
........->5
........f(4)=f(2)^2 + f(0)^2
.........f(2)=f(1)^2 + f(1)^2
..........f(1)=1
..........f(1)=1
.........->2
.........f(0)=0
........->4
.......->3
......->10
.....->24
....->7
...->74
...resolving: f(24)=sqrt(f(26)^2 - f(10)^2)
....f(26)=f(1)^2 + f(5)^2
.....f(1)=1
.....f(5)=f(1)^2 + f(2)^2
......f(1)=1
......f(2)=f(1)^2 + f(1)^2
.......f(1)=1
.......f(1)=1
......->2
.....->5
....->26
....f(10)=f(1)^2 + f(3)^2
.....f(1)=1
.....resolving: f(3)=sqrt(f(5)^2 - f(4)^2)
......f(5)=f(1)^2 + f(2)^2
.......f(1)=1
.......f(2)=f(1)^2 + f(1)^2
........f(1)=1
........f(1)=1
.......->2
......->5
......f(4)=f(2)^2 + f(0)^2
.......f(2)=f(1)^2 + f(1)^2
........f(1)=1
........f(1)=1
.......->2
.......f(0)=0
......->4
.....->3
....->10
...->24
..->70
..resolving: f(42)=sqrt(f(58)^2 - f(40)^2)
...f(58)=f(3)^2 + f(7)^2
....resolving: f(3)=sqrt(f(5)^2 - f(4)^2)
.....f(5)=f(1)^2 + f(2)^2
......f(1)=1
......f(2)=f(1)^2 + f(1)^2
.......f(1)=1
.......f(1)=1
......->2
.....->5
.....f(4)=f(2)^2 + f(0)^2
......f(2)=f(1)^2 + f(1)^2
.......f(1)=1
.......f(1)=1
......->2
......f(0)=0
.....->4
....->3
....resolving: f(7)=sqrt(f(25)^2 - f(24)^2)
.....f(25)=f(5)^2 + f(0)^2
......f(5)=f(1)^2 + f(2)^2
.......f(1)=1
.......f(2)=f(1)^2 + f(1)^2
........f(1)=1
........f(1)=1
.......->2
......->5
......f(0)=0
.....->25
.....resolving: f(24)=sqrt(f(26)^2 - f(10)^2)
......f(26)=f(1)^2 + f(5)^2
.......f(1)=1
.......f(5)=f(1)^2 + f(2)^2
........f(1)=1
........f(2)=f(1)^2 + f(1)^2
.........f(1)=1
.........f(1)=1
........->2
.......->5
......->26
......f(10)=f(1)^2 + f(3)^2
.......f(1)=1
.......resolving: f(3)=sqrt(f(5)^2 - f(4)^2)
........f(5)=f(1)^2 + f(2)^2
.........f(1)=1
.........f(2)=f(1)^2 + f(1)^2
..........f(1)=1
..........f(1)=1
.........->2
........->5
........f(4)=f(2)^2 + f(0)^2
.........f(2)=f(1)^2 + f(1)^2
..........f(1)=1
..........f(1)=1
.........->2
.........f(0)=0
........->4
.......->3
......->10
.....->24
....->7
...->58
...f(40)=f(2)^2 + f(6)^2
....f(2)=f(1)^2 + f(1)^2
.....f(1)=1
.....f(1)=1
....->2
....resolving: f(6)=sqrt(f(10)^2 - f(8)^2)
.....f(10)=f(1)^2 + f(3)^2
......f(1)=1
......resolving: f(3)=sqrt(f(5)^2 - f(4)^2)
.......f(5)=f(1)^2 + f(2)^2
........f(1)=1
........f(2)=f(1)^2 + f(1)^2
.........f(1)=1
.........f(1)=1
........->2
.......->5
.......f(4)=f(2)^2 + f(0)^2
........f(2)=f(1)^2 + f(1)^2
.........f(1)=1
.........f(1)=1
........->2
........f(0)=0
.......->4
......->3
.....->10
.....f(8)=f(2)^2 + f(2)^2
......f(2)=f(1)^2 + f(1)^2
.......f(1)=1
.......f(1)=1
......->2
......f(2)=f(1)^2 + f(1)^2
.......f(1)=1
.......f(1)=1
......->2
.....->8
....->6
...->40
..->42
.->56
->33
resolving: f(165)=sqrt(f(173)^2 - f(52)^2)
.f(173)=f(2)^2 + f(13)^2
..f(2)=f(1)^2 + f(1)^2
...f(1)=1
...f(1)=1
..->2
..f(13)=f(2)^2 + f(3)^2
...f(2)=f(1)^2 + f(1)^2
....f(1)=1
....f(1)=1
...->2
...resolving: f(3)=sqrt(f(5)^2 - f(4)^2)
....f(5)=f(1)^2 + f(2)^2
.....f(1)=1
.....f(2)=f(1)^2 + f(1)^2
......f(1)=1
......f(1)=1
.....->2
....->5
....f(4)=f(2)^2 + f(0)^2
.....f(2)=f(1)^2 + f(1)^2
......f(1)=1
......f(1)=1
.....->2
.....f(0)=0
....->4
...->3
..->13
.->173
.f(52)=f(4)^2 + f(6)^2
..f(4)=f(2)^2 + f(0)^2
...f(2)=f(1)^2 + f(1)^2
....f(1)=1
....f(1)=1
...->2
...f(0)=0
..->4
..resolving: f(6)=sqrt(f(10)^2 - f(8)^2)
...f(10)=f(1)^2 + f(3)^2
....f(1)=1
....resolving: f(3)=sqrt(f(5)^2 - f(4)^2)
.....f(5)=f(1)^2 + f(2)^2
......f(1)=1
......f(2)=f(1)^2 + f(1)^2
.......f(1)=1
.......f(1)=1
......->2
.....->5
.....f(4)=f(2)^2 + f(0)^2
......f(2)=f(1)^2 + f(1)^2
.......f(1)=1
.......f(1)=1
......->2
......f(0)=0
.....->4
....->3
...->10
...f(8)=f(2)^2 + f(2)^2
....f(2)=f(1)^2 + f(1)^2
.....f(1)=1
.....f(1)=1
....->2
....f(2)=f(1)^2 + f(1)^2
.....f(1)=1
.....f(1)=1
....->2
...->8
..->6
.->52
->165
En quel langage est-ce écrit ?
Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 57 invités
Tu pars déja ?
Identification
Pas encore inscrit ?
Ou identifiez-vous :