import java.util.ArrayList;
public class Nachbar {
public static boolean nachbar(int a, int b) {
int k;
ArrayList<Integer> teiler = new ArrayList<Integer>();
teiler.add(1);
int summe = 0;
int i;
for (k = a-1; k>1; k--) {
if (a % k == 0) {
teiler.add(a / k);
}
}
int teilerlänge = teiler.size();
for (i=0; i< teilerlänge; i++) {
summe = summe + teiler.get(i);
}
ArrayList<Integer> teiler2 = new ArrayList<Integer>();
teiler2.add(1);
int summe2 = 0;
for (int f = b-1; f>1; f--) {
if (b % f == 0) {
teiler2.add(b / f);
}
}
int teilerlänge2 = teiler2.size();
for (int u=0; u< teilerlänge2; u++) {
summe2 = summe2 + teiler2.get(u);
}
if (a == summe2 && b == summe) {
return true;
}
else {
return false;
}
}
public static void obergrenze(int o){
for (int p=0; p<o; p++) {
for (int j=0; j<o; j++) {
if (nachbar(p,j) == true) {
System.
out.
println(p
+" " + j
);
}
}
}
}
public static void main
(String[] args
) {
// TODO Auto-generated method stub
int a = 220;
int b = 284;
a = 2;
boolean Wahrheit = nachbar(a, b);
int o = 300;
obergrenze(o);
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}