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-2 of 2 results.

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

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).
Showing 1-2 of 2 results.