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

A258881 a(n) = n + the sum of the squared digits of n.

Original entry on oeis.org

0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 11, 13, 17, 23, 31, 41, 53, 67, 83, 101, 24, 26, 30, 36, 44, 54, 66, 80, 96, 114, 39, 41, 45, 51, 59, 69, 81, 95, 111, 129, 56, 58, 62, 68, 76, 86, 98, 112, 128, 146, 75, 77, 81, 87, 95, 105, 117, 131, 147, 165, 96, 98, 102
Offset: 0

Views

Author

M. F. Hasler, Jul 19 2015

Keywords

Crossrefs

Cf. A003132, A062028, A259391, A259567, A033936, A076161 (indices of primes), A329179 (indices of squares).

Programs

  • Mathematica
    Total[Flatten@ {#, IntegerDigits[#]^2}] & /@ Range[0, 61] (* Michael De Vlieger, Jul 20 2015 *)
    Table[n+Total[IntegerDigits[n]^2],{n,0,100}] (* Harvey P. Dale, Nov 27 2022 *)
  • PARI
    A258881(n)=n+norml2(digits(n))
    
  • Python
    def ssd(n): return sum(int(d)**2 for d in str(n))
    def a(n): return n + ssd(n)
    print([a(n) for n in range(63)]) # Michael S. Branicky, Jan 30 2021

A033936 a(n+1) = a(n) + sum of squares of digits of a(n).

Original entry on oeis.org

1, 2, 6, 42, 62, 102, 107, 157, 232, 249, 350, 384, 473, 547, 637, 731, 790, 920, 1005, 1031, 1042, 1063, 1109, 1192, 1279, 1414, 1448, 1545, 1612, 1654, 1732, 1795, 1951, 2059, 2169, 2291, 2381, 2459, 2585, 2703, 2765, 2879, 3077, 3184
Offset: 0

Views

Author

Olivier Gorin (gorin(AT)roazhon.inra.fr)

Keywords

Comments

Orbit of 1 under iterations of A258881. - M. F. Hasler, Jul 23 2015

Examples

			After 1063, since 1^2 + 0^2 + 6^2 + 3^2 = 46 we get 1063+46 = 1109.
		

Crossrefs

Programs

  • Maple
    A[0] := 1;
    for n to 50 do
       A[n] := A[n-1]+add(t^2, t = convert(A[n-1], base, 10))
    od:
    seq(A[i],i=0..50); # Robert Israel, Feb 15 2018
  • Mathematica
    NestList[#+Total[IntegerDigits[#]^2]&,1,45] (* Harvey P. Dale, Aug 14 2011 *)

Formula

a(n+1) = A258881(a(n)). a(n) = (A258881^n)(1). - M. F. Hasler, Jul 23 2015

A259567 Number of subsequent numbers, starting with n, for which A258881(x) = x + (sum of squares of digits of x) is prime.

Original entry on oeis.org

0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

M. F. Hasler, Jul 19 2015

Keywords

Comments

This sequence is motivated by sequence A259391 and the "Prime puzzle 776".

Examples

			For n = 0, A258881(0) = 0 is not prime.
For n = 1, A258881(1) = 1+1 = 2 is prime, but A258881(2) = 2+4 is not prime, therefore a(1)=1.
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, but A258881(20) = 20 + 2^2 + 0^2 is not prime, therefore a(10) = 10.
The next value of 10 occurs at index n = 1761702690, see A259391.
		

Crossrefs

Programs

  • PARI
    a(n)=for(m=n,n+9e9,isprime(A258881(m))||return(m-n))

Formula

If a(n) > 0, then a(n+1) = a(n)-1.
a(n) > 0 iff n is in A076161.
Showing 1-3 of 3 results.