Super-d numbers: Difference between revisions
Content added Content deleted
Line 199: | Line 199: | ||
int n = 0; |
int n = 0; |
||
⚫ | |||
System.out.printf("First %d super-%d numbers: %n", max, d); |
System.out.printf("First %d super-%d numbers: %n", max, d); |
||
while ( n < max ) { |
|||
⚫ | |||
BigInteger val = BigInteger.valueOf(d).multiply(BigInteger.valueOf(i).pow(d)); |
BigInteger val = BigInteger.valueOf(d).multiply(BigInteger.valueOf(i).pow(d)); |
||
if ( val.toString().contains(test) ) { |
if ( val.toString().contains(test) ) { |
||
n++; |
n++; |
||
System.out.printf("%d ", i); |
System.out.printf("%d ", i); |
||
if ( n >= max ) { |
|||
⚫ | |||
⚫ | |||
} |
} |
||
} |
} |