123 is a peculiar integer, because 1+2+3=1*2*3. 1412 is also peculiar, since 1+4+1+2=1*4*1*2.
A simple question: are there infinitely many such numbers?
A not so simple question: if so, are there such numbers for ANY number of digits?
With a program testing up to 26 non-"1" digits, most numbers of digits show up quickly as possible, but 24, 34, 35, 44, 48, and 66 (and possibly others) don't show up in the time I have to wait for them. Either they need a lot of non-"1" digits to fit the rule or they don't fit the rule.
public class Test
{
public static void main(String[] args)
{
KeyboardReader reader = new KeyboardReader ();
for(int count=-24;count>-100;count++)
{
for (int a=1;a<=9;a++)
{
for (int b=1;b<=9;b++)
{
for (int c=1; c<=9;c++)
(up to z)
for (int z=1;z<=9;z++)
{
if (count==-2||count==8||count==9||count==18||count==22)
{
a=b=c=d=e=f=g=h=i=j=k=l=m=n=o=p=q=r=s=t=u=v=x=y=z=10;
}
if (a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z-a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z==count)
{
a=b=c=d=e=f=g=h=i=j=k=l=m=n=o=p=q=r=s=t=u=v=w=x=y=z=10;
System.out.println(count+26);
}
|
Posted by Joe
on 2006-08-21 16:45:01 |