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.

Showing 1-7 of 7 results.

A018785 Terms of A001273 with trailing 9's stripped (at n=13 term becomes periodic with period 49).

Original entry on oeis.org

1, 10, 13, 23, 1, 7, 356, 78, 3788, 78888, 258, 888888, 157, 2, 688, 26, 15, 128, 57, 188, 15, 2688, 2688, 888888, 277, 37888, 56, 25, 5, 12, 258, 178, 46, 8, 58, 2588, 17, 77, 17, 77, 17, 77, 88888, 7, 5, 12, 1688, 18888, 178, 37888, 46, 38, 18, 36, 6, 2688, 288, 488
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A001273.

Formula

Period is 2, 688, 26, 15, 128, 57, 188, 15, 2688, 2688, 888888, 277, 37888, 56, 25, 5, 12, 258, 178, 46, 8, 58, 2588, 17, 77, 17, 77, 17, 77, 88888, 7, 5, 12, 1688, 18888, 178, 37888, 46, 38, 18, 36, 6, 2688, 288, 488, 25, 8888888, 25, 7888.

A007770 Happy numbers: numbers whose trajectory under iteration of sum of squares of digits map (see A003132) includes 1.

Original entry on oeis.org

1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94, 97, 100, 103, 109, 129, 130, 133, 139, 167, 176, 188, 190, 192, 193, 203, 208, 219, 226, 230, 236, 239, 262, 263, 280, 291, 293, 301, 302, 310, 313, 319, 320, 326, 329, 331, 338
Offset: 1

Views

Author

N. J. A. Sloane, A.R.McKenzie(AT)bnr.co.uk

Keywords

Comments

Sometimes called friendly numbers, but this usage is deprecated.
Gilmer shows that the lower density of this sequence is < 0.1138 and the upper density is > 0.18577. - Charles R Greathouse IV, Dec 21 2011
Corrected the upper and lower density inequalities in the comment above. - Nathan Fox, Mar 14 2013
Grundman defines the heights of the happy numbers by the number of iterations needed to reach the 1: 0, 5, 1, 2, 4, 3, 3, 2, 3, 4, 4, 2, 5, 3, 3, 2, 4, 4, 3, 1, ... (A090425(n) - 1). E.g., for n=2 the height of 7 is 5 because it needs 5 iterations: 7 -> 49 -> 97 -> 130 -> 10 -> 1. - R. J. Mathar, Jul 09 2017
El-Sedy & Siksek prove that this sequence contains arbitrarily long subsequences of consecutive terms; that is, the upper uniform density of this sequence is 1. - Charles R Greathouse IV, Sep 12 2022

Examples

			1 is OK. 2 --> 4 --> 16 --> 37 --> ... --> 4, which repeats with period 8, so never reaches 1, so 2 (and 4) are unhappy.
A correspondent suggested that 98 is happy, but it is not. It enters a cycle 98 -> 145 -> 42 -> 20 -> 4 -> 16 ->37 ->58 -> 89 -> 145 ...
		

References

  • L. E. Dickson, History of the Theory of Numbers, Vol, I: Divisibility and Primality, AMS Chelsea Publ., 1999.
  • R. K. Guy, Unsolved Problems Number Theory, Sect. E34.
  • J. N. Kapur, Reflections of a Mathematician, Chap. 34 pp. 319-324, Arya Book Depot New Delhi 1996.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 25-26.

Crossrefs

Cf. A003132 (the underlying map), A001273, A035497 (happy primes), A046519, A031177, A002025, A050972, A050973, A074902, A103369, A035502, A068571, A072494, A124095, A219667, A239320 (base 3), A240849 (base 5).
Cf. A090425 (required iterations including start and end).

Programs

  • Haskell
    a007770 n = a007770_list !! (n-1)
    a007770_list = filter ((== 1) . a103369) [1..]
    -- Reinhard Zumkeller, Aug 24 2011
    
  • Mathematica
    f[n_] := Total[IntegerDigits[n]^2]; Select[Range[400], NestWhile[f, #, UnsameQ, All] == 1 &] (* T. D. Noe, Aug 22 2011 *)
    Select[Range[1000],FixedPoint[Total[IntegerDigits[#]^2]&,#,10]==1&] (* Harvey P. Dale, Oct 09 2011 *)
    (* A example with recurrence formula to test if a number is happy *)
    a[1]=7;
    a[n_]:=Sum[(Floor[a[n-1]/10^k]-10*Floor[a[n-1]/10^(k+1)]) ^ (2) ,{k, 0,
          Floor[Log[10,a[n-1]]] }]
    Table[a[n],{n,1,10}] (* José de Jesús Camacho Medina, Mar 29 2014 *)
  • PARI
    ssd(n)=n=digits(n);sum(i=1,#n,n[i]^2)
    is(n)=while(n>6,n=ssd(n));n==1 \\ Charles R Greathouse IV, Nov 20 2012
    
  • PARI
    select( {is_A007770(n)=while(6M. F. Hasler, Dec 20 2024
    
  • Python
    def ssd(n): return sum(int(d)**2 for d in str(n))
    def ok(n):
      while n not in [1, 4]: n = ssd(n) # iterate until fixed point or in cycle
      return n==1
    def aupto(n): return [k for k in range(1, n+1) if ok(k)]
    print(aupto(338)) # Michael S. Branicky, Jan 07 2021

Formula

From Ulrich Krug (leuchtfeuer37(AT)gmx.de), Apr 23 2009: (Start)
1) Every power 10^k is a member of the sequence.
2) If n is member the numbers obtained by placing zeros anywhere in n are members.
3) If n is member each permutation of digits of n gives another member.
4) If the repeated process of summing squared digits give a number which is already a member of sequence the starting number belongs to the sequence.
5) If n is a member the repunit consisting of n 1's is a member.
6) If n is a member delete any digit d, new number consisting of remaining digits of n and d^2 1's placed everywhere to n is a member.
7) It is conjectured that the sequence includes an infinite number of primes (see A035497).
8) For any starting number the repeated process of summing squared digits ends with 1 or gives an "8-loop" which ends with (37,58,89,145,42,20,4,16,37) (End)

A094406 Smallest unhappy number that takes n steps to reach any of the unhappy cycle (4, 16, 37, 58, 89, 145, 42, 20) under iteration of sum of squares of digits map.

Original entry on oeis.org

4, 2, 11, 15, 5, 3, 14, 45, 36, 6, 112, 269, 15999
Offset: 4

Views

Author

Sergio Pimentel, Apr 30 2004

Keywords

Comments

This sequence is an analog of sequence A001273 with the unhappy numbers instead of the happy numbers.
The next term, 577999999999....999999999999 (199 digits) is too large to include.

Examples

			15 is the fourth term because: 15: 1^2 + 5^2 = 26 / 26: 2^2 + 6^2 = 40 / 40: 4^2 + 0^2 = 16 and 16 is a member of the unhappy number series (4, 16, 37, 58, 89, 145, 42, 20)
		

Crossrefs

Cf. A001273.

Extensions

Edited by Charles R Greathouse IV, Aug 03 2010

A217705 Smallest number greater than 1 that is happy under bases 2 through n.

Original entry on oeis.org

2, 3, 3, 23, 79, 2207, 58775, 569669, 11814485, 210511543, 73748383237
Offset: 2

Views

Author

Sergio Pimentel, Mar 20 2013

Keywords

Comments

A happy number is a number that after iteration of sum of squares of digits eventually reaches 1 (A007770). The happy property is base-dependent. This sequence lists the smallest number that is happy in bases 2, 3, ..., n.
All numbers are happy in binary and base 4.

Examples

			a(8) = 58775 because:
Base 2: 1110010110010111 - 1010 - 10 - 1,
Base 3: 2222121212 - 1011 - 10 - 1,
Base 4: 321121113 - 132 - 32 - 31 - 22 - 20 - 10 - 1,
Base 5: 3340100 - 120 - 10 - 1,
Base 6: 1132035 - 121 - 10 - 1,
Base 7: 333233 - 100 - 1,
Base 8: 162627 - 202 - 10 - 1,
Base 9 fails since the end is the 58 - 108 - 72 cycle and fails to reach 1.
		

Crossrefs

Programs

  • PARI
    ssd(n,b)=my(s);while(n,s+=(n%b)^2;n\=b);s
    happy(k,b)=my(t=ssd(k,b));k=ssd(t,b);while(t!=k&&k>1,t=ssd(t,b);k=ssd(ssd(k,b),b));k==1
    h3(k)=while(k>8, k=ssd(k,3));k==1 || k==3
    a(n)=if(n<4,return(n));my(k=2);while(k++, if(!h3(k),next); for(b=5,n, if(!happy(k,b), next(2)));return(k)) \\ Charles R Greathouse IV, Mar 22 2013

Extensions

a(9)-a(12) from Giovanni Resta, Mar 21 2013

A126973 a(n+1) is the smallest integer greater than a(n) such that the sum of the squares of its decimal digits is equal to a(n).

Original entry on oeis.org

1, 10, 13, 23, 1233, 33999999999999999
Offset: 1

Views

Author

Paolo P. Lava and Giorgio Balzarotti, Mar 20 2007; corrected Mar 23 2007

Keywords

Examples

			10 --> 1^2+0^2 = 1+0 =1
13 --> 1^2+3^2 = 1+9 = 10
23 --> 2^2+3^2 = 4+9 =13
1233 --> 1^2+2^2+3^3+3^2 = 1+4+9+9 = 23
33999999999999999 = 3^2*2 + 9^2*15 = 1233
		

Crossrefs

Extensions

Next term is greater than 10^419753086419753. [From Charles R Greathouse IV, Nov 13 2010]

A176762 Smallest number that takes n steps to reach a cycle under iteration of sum-of-squares-of-digits map.

Original entry on oeis.org

1, 10, 13, 23, 19, 7, 356, 4, 2, 11, 15, 5, 3, 14, 45, 36, 6, 112, 269, 15999
Offset: 0

Views

Author

Robert G. Wilson v, Apr 25 2010

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Plus @@ (IntegerDigits[n]^2); t = Table[0, {25}]; k = 1; While[k < 150000001, a = Length@ NestWhileList[f, k, UnsameQ@## &, All] - 1; If[a < 25 && t[[a]] == 0, t[[a]] = k; Print[{a, k}]]; k++ ]

Formula

a(n) = minimum of either A001273(n) or A094406(n+3).

A383646 Smallest number that takes n steps to reach 1 under iteration of sum-of-cubes-of-digits map.

Original entry on oeis.org

1, 10, 112, 1189, 778, 13477, 2388889999999999999999
Offset: 0

Views

Author

Shyam Sunder Gupta, May 11 2025

Keywords

Comments

These could also be called the smallest cubic happy numbers of height n.
Subsequent terms are too large to display in full.
a(7) = 1127 * 10^3276941015089163237 - 1 (1126 followed by 3276941015089163237 nines).
a(8) = 35678 * 10^((a(7) - 1054)/729) - 1.

Examples

			a(2) = 112, because 112 takes 2 steps to reach 1 (112 --> 1 + 1 + 8 = 10 --> 1 + 0 = 1).
		

Crossrefs

Showing 1-7 of 7 results.