View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Jerry W. Lewis Jerry W. Lewis is offline
external usenet poster
 
Posts: 16
Default Very speciel function

You can sum the squares of the digits in a number by the following array
formula in a worksheet cell
=SUMSQ(VALUE(MID(x,ROW(OFFSET($A$1,0,0,LEN(x))),1) ))
where x is the number to be evaluated. Don't forget to array enter
(Ctrl-Shift-Enter) the formula. You can then copy the formula down enough
times to identify whether the original number was happy or not.

Your "happy" condition is unclear. Is a number determined to be according
to whether the 1st 1-digit number that it maps to is 1, or whether it
ultimately maps to 1? For instance, 7 is a 1-digit number that maps to 1 in
five additional rounds (though only 2111, 1211, 1121, 1112, 1111111 can
transition to 7 in one round).

In terms of persistent 1-digit numbers, there are only two: 1 and 4. 17 of
the 90 2-digit numbers are happy.

Jerry

"alvin Kuiper" wrote:

Hi!

I want to check if a number is a happy number
a number number is like this
(sorry i can't write it correct with in 2 hope you understand)
Number is 19

1 in 2 + 9 in 2 = 82
8 in 2 + 2 in 2 = 68
6 in 2 + 8 in 2 = 100
1 in 2 + 0in 2 + 0in 2 = 1

This is not a Happy number
Number = 24

2in2 + 4in2 = 20
2in2 + 0in2 = 4

So only when the last ciffer is one it is a happy number

I can make it by using if and if and if...........................

But isn't there a easy way to do this?
Please help i can't see it..........

Best regards

Alvin