A240849 Quinary happy numbers.
1, 5, 7, 11, 19, 23, 25, 27, 33, 35, 41, 43, 49, 51, 55, 79, 81, 83, 91, 93, 95, 99, 103, 109, 115, 119, 121, 123, 125, 127, 133, 135, 141, 143, 149, 153, 157, 159, 161, 165, 169, 171, 173, 175, 181, 189, 193, 197, 201, 203, 205, 209, 213, 215, 217, 219, 221, 223, 229, 231, 233, 237, 241, 243, 245, 249
Offset: 1
Examples
19 is a quinary happy number because 19=34_5 -> 3^2 + 4^2 = 25 = 100_5 -> 1+0+0 = 1.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
- H. G. Grundmann, Semihappy Numbers, J. Int. Seq. 13 (2010), 10.4.8.
Programs
-
Maple
isA240849 := proc(n) t := SqrdB5(n) ; tloo := {} ; for i from 1 do if t = 1 then return true; end if; if t in tloo then return false; end if; tloo := tloo union {t} ; t := A276191(t) ; end do: end proc: for n from 1 to 300 do if isA240849(n) then printf("%d,",n) ; end if; end do: # R. J. Mathar, Aug 24 2016
-
Mathematica
happyQ[n_, b_] := NestWhile[Plus @@ (IntegerDigits[#, b]^2) &, n, UnsameQ, All] == 1; Select[Range[250], happyQ[#, 5] &] (* Amiram Eldar, May 28 2020 *)
Comments