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-10 of 118 results. Next

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)

A333549 Consider the list (A333552) of numbers m defined by property that when the Recamán term A005132(m) is being computed, we are unable to subtract m from A005132(m-1) because, although A003132(m-1) >= m, the result of the subtraction, A005132(m-1)-m, is already in A005132; sequence gives the successive values of A005132(m-1)-m.

Original entry on oeis.org

0, 1, 6, 3, 0, 7, 24, 21, 13, 45, 42, 0, 25, 90, 87, 84, 81, 78, 63, 163, 160, 157, 154, 39, 151, 264, 261, 17, 14, 11, 8, 3, 135, 114, 285, 282, 279, 276, 273, 270, 81, 78, 265, 453, 63, 46, 269, 266, 263, 260, 257, 18, 15, 12, 9, 6, 3, 0, 228, 514, 511, 508, 505, 502, 499, 496, 493, 490, 164, 502, 499, 496
Offset: 1

Views

Author

N. J. A. Sloane, May 02 2020

Keywords

Comments

These are the collisions that are avoided when A005132 is being constructed.

Examples

			After we have found A005132(6)=13, we attempt to subtract 7 from 13 to get a(7). However, this would give 6, which is a collision, since we already have A005132(3)=6. So 6 gets added to the current sequence.
		

Crossrefs

For records see A333550, A333551.

A333552 List of numbers k defined by property that when the Recamán term A005132(k) is being computed, we are unable to subtract k from A005132(k-1) because, although A003132(k-1) >= k, the result of the subtraction, A005132(k-1)-k, is already in A005132.

Original entry on oeis.org

3, 6, 7, 9, 11, 18, 19, 21, 33, 34, 36, 39, 66, 67, 69, 71, 73, 75, 101, 102, 104, 106, 108, 113, 114, 115, 117, 121, 123, 125, 127, 133, 134, 172, 173, 175, 177, 179, 181, 183, 186, 188, 189, 190, 194, 224, 225, 227, 229, 231, 233, 236, 238, 240, 242, 244, 246, 248, 287, 288, 290, 292, 294, 296, 298, 300, 302, 304
Offset: 1

Views

Author

N. J. A. Sloane, May 03 2020

Keywords

Comments

Positions k of addition steps in Recamán's sequence where A005132(k-1)-k = A005132(m) for some 0 <= m < k.
This is A187922 together with the terms in A333548. (The difference between A187922 and the present sequence is explained by the fact that originally A005132 began at 1 rather than 0.)

Examples

			After we have found A005132(6)=13, we attempt to subtract 7 from 13 to get a(7). However, this would give 6, which is a collision, since we already have A005132(3)=6. So 7 gets added to the current sequence.
		

Crossrefs

A109181 a(n) = A003132(A052034(n)).

Original entry on oeis.org

2, 13, 17, 37, 73, 2, 11, 11, 59, 59, 131, 83, 131, 163, 17, 89, 11, 19, 59, 19, 67, 43, 67, 139, 139, 17, 97, 41, 113, 53, 61, 101, 37, 53, 61, 101, 73, 109, 131, 67, 139, 107, 179, 149, 109, 137, 83, 163, 139, 131, 179, 163, 211, 11, 83, 11, 19, 83, 131, 11, 83, 47, 67, 103, 11, 19, 59, 47, 107, 43, 67, 107, 179, 47, 127, 167, 199, 131, 67, 163
Offset: 1

Views

Author

Zak Seidov, Jun 21 2005

Keywords

Comments

For the primes p see A052034.

Examples

			q=13 is a term because 13 = 2^2 + 3^2 and merging digits 2 and 3 makes p=23, which is a prime.
		

Crossrefs

Programs

  • Maple
    a:=proc(n) local nn, L: nn:=convert(n,base,10): L:=nops(nn): if isprime(n) = true and isprime(add(nn[j]^2,j=1..L))=true then add(nn[j]^2,j=1..L) else end if end proc: seq(a(n),n=1..1200); # Emeric Deutsch, Jan 08 2008

Formula

a(n) = A003132(A052034(n)). - Zak Seidov, Dec 30 2013

Extensions

More terms from Emeric Deutsch and Alvin Hoover Belt, Jan 08 2008

A099649 Solutions to A099648(k) > k, i.e., numbers such that the largest term in the iteration of the A003132() function strictly exceeds the initial value.

Original entry on oeis.org

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

Views

Author

Labos Elemer, Nov 12 2004

Keywords

Comments

The last term I encountered was a(130) = 144. Is this sequence finite? Is a(130) = 144 the final term?

Examples

			For n=7, the list of values in the trajectory is {7,49,97,130,10,1,1,1,1,1,1,1,...}; max = 130 > 7 = n, so 7 is in the sequence.
For n=32, list = {32,13,10,1,1,...}; max = 32 = n, so 32 is not in the sequence.
The sequence includes all positive integers < 145 except {1,10,13,23,31,32,44,100,103,109,129,130,133,139}.
		

Crossrefs

Programs

  • Mathematica
    ed[x_] :=IntegerDigits[x]; func[x_] :=Apply[Plus, ed[x]^2]; itef[x_, ho_] :=NestList[id2, x, 100]; ta={{0}};Do[s=Max[Union[itef[w, 100]]]; If[Greater[s, w], Print[w];ta=Append[ta, w]], {w, 1, 10000000}]; Delete[ta, 1]

Extensions

Edited by Jon E. Schoenfield, Nov 26 2017

A152077 Length of the trajectory of the map x->A003132(x) started at x=n^2 up to the end of its first period.

Original entry on oeis.org

1, 8, 12, 8, 11, 16, 5, 12, 11, 2, 18, 13, 17, 17, 13, 11, 11, 11, 13, 9, 13, 14, 11, 11, 11, 19, 12, 5, 12, 12, 17, 14, 15, 17, 13, 14, 17, 6, 4, 9, 14, 14, 16, 17, 13, 9, 9, 11, 14, 11, 15, 14, 11, 14, 11, 14, 11, 7, 13, 16, 17, 12, 15, 7, 6, 4, 18, 15, 14, 5, 9, 10, 12, 16, 13, 15, 12, 12
Offset: 1

Views

Author

R. J. Mathar, Sep 16 2009

Keywords

Comments

This accumulates the length of the "transient" or "pre-periodic" part of the trajectory started at n^2 plus the length of the first period.

Examples

			a(5)=11 since the trajectory starting at x=5^2 is 25, 29, 85, 89, 145, 42, 20, 4, 16, 37, 58 the next term 89 is already there.
a(10)= 2 since the trajectory starting at x=10^2 is 100,1 and the next term is again the 1.
a(11)= 18 because the trajectory is 121, 6, 36, 45, 41, 17, 50, 25, 29, 85, 89, 145, 42, 20, 4, 16, 37, 58, the next 89 is already there.
		

Crossrefs

Formula

a(n) = A099645(n^2)+A031176(n^2) .

A259391 Numbers n such that A258881(n+k) is prime for k=0,...,9; where A258881(x) = x + sum of the square of the digits of x (A003132).

Original entry on oeis.org

10, 1761702690, 7226006660, 16453361570, 95748657190, 104217487100, 111058349320, 141665059420, 168759510430, 177313689280, 177313689330, 178209124090, 188343072120, 347296044930, 347296045010, 381449093790, 381449093840, 445151776780, 491570264380
Offset: 1

Views

Author

M. F. Hasler, Jul 19 2015

Keywords

Comments

Terms computed by G. Resta, cf. link to Prime Puzzle 776.

Examples

			For n = 10, A258881(10) = 10 + 1^2 + 0^2 = 11, A258881(11) = 11 + 1^2 + 1^2 = 13, A258881(12) = 12 + 1^2 + 2^2 = 17, ..., A258881(19) = 19 + 1^2 + 9^2 = 101 are all prime, therefore a(1) = 10.
The next value of 10 in A259567 occurs at index n = 1761702690 = a(2).
		

Crossrefs

A082382 Table which contains in row n the track of n->A003132(n) until reaching 1 or 4.

Original entry on oeis.org

1, 1, 2, 4, 3, 9, 81, 65, 61, 37, 58, 89, 145, 42, 20, 4, 4, 16, 37, 58, 89, 145, 42, 20, 4, 5, 25, 29, 85, 89, 145, 42, 20, 4, 6, 36, 45, 41, 17, 50, 25, 29, 85, 89, 145, 42, 20, 4, 7, 49, 97, 130, 10, 1, 8, 64, 52, 29, 85, 89, 145, 42, 20, 4, 9, 81, 65, 61, 37, 58, 89, 145, 42, 20
Offset: 1

Views

Author

Cino Hilliard, Apr 13 2003

Keywords

Comments

If n=1 or 4, the row is extended until reaching 1 or 4 a second time after the starting value.
Conjecture: Each sequence terminates with 1 or the 4 16 37 58 89 145 42 20 4... loop.

Examples

			The table starts in row 1 as
1,1 ;
2,4 ;
3,9,81,65,61,37,58,89,145,42,20,4;
4,16,37,58,89,145,42,20,4;
5,25,29,85,89,145,42,20,4;
6,36,45,41,17,50,25,29,85,89,145,42,20,4;
		

References

  • C. Stanley Ogilvy, Tomorrow's Math, 1972

Programs

  • PARI
    \ The squared digital root of a number output initial terms digitsq2(m) = {y=0; for(x=1,m, digitsq(x) ) } digitsq(n) = { print1(n" "); while(1, s=0; while(n > 0, d=n%10; s = s+d*d; n=floor(n/10); ); print1(s" "); if(s==1 || s==4,break); n=s; ) }

Extensions

Redefined as an irregular table, merged 8 and 9 to 89 at one place - R. J. Mathar, Mar 14 2010

A099648 Largest term arising in complete-iteration-list (both transient and cycle) when f(x) = A003132(x) is iterated, i.e., if digit-squares of iterate added repeatedly until steady state (= either cycle or fixed point) is reached.

Original entry on oeis.org

1, 145, 145, 145, 145, 145, 130, 145, 145, 10, 145, 145, 13, 145, 145, 145, 145, 145, 100, 145, 145, 145, 23, 145, 145, 145, 145, 100, 145, 145, 31, 32, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 44, 145, 145, 145, 145, 130, 145, 145, 145, 145, 145
Offset: 1

Views

Author

Labos Elemer, Nov 12 2004

Keywords

Examples

			n=2: list = {2,4,16,37,58,89,145,42,20,4,16,37,58,...}; a(2) = max(list) = 145;
For n < 145, max > initial value except few cases. See A099649.
		

Crossrefs

Programs

  • Mathematica
    ed[x_] :=IntegerDigits[x]; func[x_] :=Apply[Plus, ed[x]^2]; itef[x_, ho_] :=NestList[id2, x, 100]; Table[Max[Union[itef[w, 100]]], {w, 1, 256}]

A307735 Integers k such that if m = k + A003132(k) then k = m - A003132(m).

Original entry on oeis.org

0, 9, 205, 212, 217, 366, 457, 663, 1314, 1315, 1348, 1672, 1742, 1792, 1797, 2005, 2012, 2017, 2129, 2201, 2208, 2213, 2216, 2305, 2404, 2405, 2465, 2564, 2565, 2671, 2741, 2748, 2789, 2829, 3114, 3115, 3205, 3303, 3306, 3394, 3436, 3475, 3696, 3819, 4204, 4205, 4245, 4347, 4475, 4542, 4629, 4647, 4688
Offset: 1

Views

Author

Antonio Roldán, Apr 25 2019

Keywords

Comments

A003132(n) is the sum of the squares of the digits of n.

Examples

			205 is in the sequence because 205 + 2^2 + 0^2 + 5^2 = 234 and 234 - 2^2 - 3^2 - 4^2 = 205.
		

Crossrefs

Programs

  • Mathematica
    sod2[n_] := Total @ (IntegerDigits[n]^2); aQ[n_] := sod2[n + (s=sod2[n])] == s; Select[Range[0, 4700], aQ] (* Amiram Eldar, Jul 03 2019 *)
  • PARI
    for(i = 0 , 5000 , a = i + norml2(digits(i)) ; b = a - norml2(digits(a)) ; if(i == b , print1(i , ", ")))
Showing 1-10 of 118 results. Next