cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A031177 Unhappy numbers: numbers having period-8 2-digitized sequences.

Original entry on oeis.org

2, 3, 4, 5, 6, 8, 9, 11, 12, 14, 15, 16, 17, 18, 20, 21, 22, 24, 25, 26, 27, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 83
Offset: 1

Views

Author

Keywords

Crossrefs

Complement of happy numbers A007770. Cf. A056527.

Programs

  • Haskell
    a031177 n = a031177_list !! (n-1)
    a031177_list = filter ((/= 1) . a103369) [1..]
    -- Reinhard Zumkeller, Aug 24 2011
    
  • Python
    from itertools import count, islice
    def A031177_gen(startvalue=1): # generator of terms >= startvalue
        for n in count(max(startvalue,1)):
            m = n
            while m not in {1,37,58,89,145,42,20,4,16}:
                m = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(m))
            if m > 1:
                yield n
    A031177_list = list(islice(A031177_gen(),20)) # Chai Wah Wu, Aug 02 2023