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.

Previous Showing 51-60 of 118 results. Next

A048377 Append d digits d after each digit d in decimal expansion of n.

Original entry on oeis.org

0, 11, 222, 3333, 44444, 555555, 6666666, 77777777, 888888888, 9999999999, 110, 1111, 11222, 113333, 1144444, 11555555, 116666666, 1177777777, 11888888888, 119999999999, 2220, 22211, 222222, 2223333, 22244444, 222555555, 2226666666
Offset: 0

Views

Author

Patrick De Geest, Mar 15 1999

Keywords

Comments

a(10^n) = 11 * 10^n; A007953(a(n)) = A003132(n) + A007953(n). [Reinhard Zumkeller, Jul 10 2011]

Examples

			12 becomes 1 1 2 22 = 11222.
		

Crossrefs

Cf. A048376.

Programs

  • Haskell
    import Data.Char (digitToInt)
    a048377 :: Integer -> Integer
    a048377 n =
       read $ concat $ zipWith replicate (map ((+ 1) . digitToInt) ns) ns
          where ns = show n
    -- Reinhard Zumkeller, Jul 10 2011
  • Mathematica
    den[n_]:=Module[{idn=IntegerDigits[n]},FromDigits[Flatten[Table[ Table[ idn[[i]],{idn[[i]]+1}],{i,Length[idn]}]]]]; Array[den,30,0] (* Harvey P. Dale, Sep 04 2013 *)

A094830 Start with x = n, repeatedly replace x with x + sum of squares of digits of x until you reach a prime; sequence gives number of steps.

Original entry on oeis.org

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

Views

Author

Jason Earls, Jun 13 2004

Keywords

Comments

It is currently not known if this sequence is well defined, i.e. if for all n>=1 there exists an integer v such that a(n) = v. If the sequence is not well defined then the given programs are incorrect as they will get stuck in an infinite loop for some integers. - Peter Luschny, Oct 28 2016

Examples

			a(4)=6 because 4 -> 20 -> 24 -> 44 -> 76 -> 161 -> 199, takes 6 steps to reach a prime.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local x,k;
    x:= n;
    for k from 0 do
      if isprime(x) then return k fi;
      x:= x + add(t^2, t = convert(x,base,10))
    od;
    end proc:
    map(f, [$1..100]); # Robert Israel, Oct 27 2016
  • Mathematica
    p[n_]:=Length[NestWhileList[#+Total[IntegerDigits[#]^2]&,n, !PrimeQ[ #]&]]-1; Array[p,100] (* Harvey P. Dale, Dec 03 2011 *)
  • PARI
    a(n) = my(k=0); while(!isprime(n),d=digits(n); n+=vecsum(vector(#d,i,d[i]^2)); k++) ;k \\ David A. Corneth, Oct 27 2016

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

A055016 Smallest number whose sum of squares of digits is n.

Original entry on oeis.org

0, 1, 11, 111, 2, 12, 112, 1112, 22, 3, 13, 113, 222, 23, 123, 1123, 4, 14, 33, 133, 24, 124, 233, 1233, 224, 5, 15, 115, 1115, 25, 125, 1125, 44, 144, 35, 135, 6, 16, 116, 1116, 26, 45, 145, 335, 226, 36, 136, 1136, 444, 7, 17, 117, 46, 27, 127, 1127, 246
Offset: 0

Views

Author

Henry Bottomley, May 31 2000

Keywords

Crossrefs

Cf. A003132 is inverse in sense that n=A003132(a(n)), though not necessarily a(A003132(n)).

Programs

  • PARI
    A055016(n,q=9,m)={ n>1||return(n); forstep(q=min(sqrtint(n),q),1,-1, m && n \ q^2 * #Str(q) > #Str(m) && break; t=eval(Str(A055016(n-q^2,q),q)); (!m || tM. F. Hasler, Jun 24 2015

A069816 a(n) = (sum of digits of n)^2 - (sum of digits^2 of n).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 0, 14, 28, 42, 56, 70, 84
Offset: 0

Views

Author

N. J. A. Sloane, May 03 2002

Keywords

Comments

a(n) = 0 iff n is a single-digit number or is a power of ten times a single-digit number. - Robert G. Wilson v, May 04 2002

Examples

			n=14: sum of digits = 5, squaring gives 25; sum of squared digits of n = 1^2 + 4^2 = 17, so a(14) = 25 - 17 = 8.
		

Crossrefs

Cf. A067552.

Programs

  • Maple
    A007953 := proc(n) add(d, d=convert(n,base,10)) ; end proc: A003132:= proc(n) add(d^2, d=convert(n,base,10)) ; end proc: A118881 := proc(n) (A007953(n))^2 ; end proc: A069816 := proc(n) A118881(n)-A003132(n) ; end proc: seq(A069816(n),n=0..80) ; # R. J. Mathar, Jun 23 2009
  • Mathematica
    f[n_] := Plus @@ IntegerDigits[n]^2 - Plus @@ (IntegerDigits[n]^2); Table[ f[n], {n, 0, 100}]

Formula

From R. J. Mathar, Jun 23 2009: (Start)
a(n) = 2*A035930(n), n <= 100.
a(n) = A118881(n) - A003132(n). (End)

Extensions

Extended by Robert G. Wilson v, May 04 2002

A090425 Number of iterations required for happy number A007770(n) to converge to 1.

Original entry on oeis.org

1, 6, 2, 3, 5, 4, 4, 3, 4, 5, 5, 3, 6, 4, 4, 3, 5, 5, 4, 2, 3, 5, 4, 3, 6, 6, 4, 4, 5, 5, 4, 6, 4, 4, 4, 6, 4, 6, 6, 6, 6, 4, 4, 6, 3, 4, 3, 6, 6, 4, 6, 6, 6, 5, 7, 6, 7, 6, 6, 6, 7, 5, 6, 6, 6, 7, 5, 5, 5, 4, 4, 7, 5, 5, 5, 7, 7, 4, 7, 4, 5, 3, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7, 4, 5, 5, 4, 6, 3, 6, 7, 6, 4
Offset: 1

Views

Author

Eric W. Weisstein, Nov 30 2003

Keywords

Comments

The count includes both the start and end.

Examples

			7 is the 2nd happy number and iterated digit squarings and additions give the sequence {7,49,97,130,10,1}, so a(2)=6.
		

Crossrefs

Cf. A007770.
Cf. A003132.

Programs

  • Haskell
    a090425 n = snd $ until ((== 1) . fst)
                            (\(u, v) -> (a003132 u, v + 1)) (a007770 n, 1)
    -- Reinhard Zumkeller, Aug 07 2012
    
  • Mathematica
    happy[n_] := If[(list = NestWhileList[Plus @@ (IntegerDigits[#]^2) &, n, UnsameQ, All])[[-1]] == 1, Length[list] - 1, Nothing]; Array[happy, 700] (* Amiram Eldar, Apr 12 2022 *)
  • Python
    from itertools import count, islice
    def A090425_gen(): # generator of terms
        for n in count(1):
            c = 1
            while n not in {1,37,58,89,145,42,20,4,16}:
                n = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(n))
                c += 1
            if n == 1:
                yield c
    A090425_list = list(islice(A090425_gen(),20)) # Chai Wah Wu, Aug 02 2023

A103369 Number in the 2-digitaddition sequence at which the eventually periodic part starts.

Original entry on oeis.org

1, 4, 37, 4, 89, 89, 1, 89, 37, 1, 4, 89, 1, 89, 16, 16, 89, 37, 1, 20, 89, 89, 1, 20, 89, 16, 89, 1, 89, 37, 1, 1, 37, 89, 89, 89, 37, 58, 37, 16, 89, 42, 89, 1, 89, 89, 37, 89, 1, 89, 16, 89, 89, 89, 89, 37, 37, 58, 37, 89, 37, 16, 89, 89, 37, 89, 89, 1, 16, 1, 89, 89, 58
Offset: 1

Views

Author

Eric W. Weisstein, Feb 02 2005

Keywords

Comments

a(A007770(n)) = 1; a(A031177(n)) > 1. - Reinhard Zumkeller, Mar 16 2013

Examples

			The 2-digitaddition sequence for n = 3 is {3, 9, 81, 65, 61, 37, 58, 89, 145, 42, 20, 4, 16, 37, ...}, so a(3) = 37.
		

Crossrefs

Programs

  • Haskell
    a103369 = until (`elem` a039943_list) a003132
    a103369_list = map a103369 [1..]
    -- Reinhard Zumkeller, Oct 17 2011, Aug 24 2011

A226224 The largest value of k in base n for which the sum of digits of k = sqrt(k).

Original entry on oeis.org

1, 25, 9, 64, 100, 144, 49, 64, 81, 225, 121, 441, 169, 441, 441, 256, 289, 324, 361, 1296, 1296, 484, 529, 1089, 625, 676, 729, 2401, 841, 2601, 961, 1024, 3025, 1156, 2500, 4096, 1369, 1444, 4356, 3136, 1681, 4900, 1849, 5929, 3025, 2116, 2209, 6561, 2401
Offset: 2

Views

Author

Keywords

Comments

There are no values of k in base n with more than 3 digits. Proof: such a value with d digits would need to meet the criterion d*(n-1)>=sqrt(n)^d which establishes an upper limit of 4 digits for 2<=n<=6 and 3 for n>6. Because there are no four digit values of k in bases 2 through 6, k has a maximum of three digits in all bases.
Because k must be a square, there are only sqrt(n)^3 possible values in any base.
From the above, it can be shown that for three-digit fixed points of the form xyz, x <= 6; also x<=4 for n>846. These theoretical upper limits are statistically unlikely, and in fact of the 86356 solutions in bases 2 to 10000, only 6.5% of them begin with 2, and none begin with 3 through 6.
a(n)=1 iff A226087(n)=1. Conjecture: this occurs exactly once -- in base 2.

Examples

			For a(16) the solutions are the square numbers {1, 36=6^2, 100=10^2, 225=15^2, 441=21^2} because in base 16 they are written as {1, 24, 64, E1, 1B9} and 1 = 1, 6 = 2+4, 10 = 6+4, 15 = 14+1, and 21 = 1+11+9.
		

Crossrefs

Programs

  • R
    for(n in 2:500) cat("Base",n,":",which(sapply((1:(ifelse(n>6,7,1)*n^ifelse(n>6,1,2)))^2, function(x) sum(inbase(x,n))==sqrt(x)))^2, "\n")

A052035 Palindromic primes whose sum of squared digits is also prime.

Original entry on oeis.org

11, 101, 131, 191, 313, 353, 373, 797, 919, 10301, 11311, 12721, 13331, 13931, 14341, 14741, 16361, 17971, 18181, 19391, 30103, 30703, 33533, 71317, 71917, 74747, 75557, 76367, 77977, 79397, 90709, 93139, 93739, 95959, 96769, 97379
Offset: 1

Views

Author

Patrick De Geest, Dec 15 1999

Keywords

Comments

From Bernard Schott, Oct 20 2021: (Start)
Except for 11, all terms have an odd number of digits.
Except for terms of the form 10^k+1, k >= 2, the middle digit is always odd; the unique known term of the form 10^k+1 for 2 <= k <= 100000 is 101 (see comment in A000533). (End)

Examples

			373 -> 3^2 + 7^2 + 3^2 = 67, which is prime.
		

References

  • Charles W. Trigg, Journal of Recreational Mathematics, Vol. 20(2), 1988.

Crossrefs

Programs

  • Mathematica
    Select[Prime@ Range[2, 10^4], And[PalindromeQ@ #, PrimeQ@ Total[IntegerDigits[#]^2]] &] (* Michael De Vlieger, Oct 20 2021 *)
  • PARI
    isok(p) = my(d=digits(p)); isprime(p) && (d==Vecrev(d)) && isprime(sum(k=1, #d, d[k]^2)); \\ Michel Marcus, Oct 17 2021
    
  • Python
    from sympy import isprime
    def ok(n):
        s = str(n)
        return s==s[::-1] and isprime(n) and isprime(sum(int(d)**2 for d in s))
    print([k for k in range(10**5) if ok(k)]) # Michael S. Branicky, Nov 23 2021
    
  • Python
    # second version for going to large terms
    from sympy import isprime
    from itertools import product
    def ok(pal):
        return isprime(pal) and isprime(sum(int(d)**2 for d in str(pal)))
    def agentod(maxdigs):
        yield 11
        for d in range(3, maxdigs+1, 2):
            pal = 10**(d-1) + 1
            if ok(pal): yield pal
            for first in "1379":
                for left in product("0123456789", repeat=(d-3)//2):
                    left = "".join(left)
                    for mid in "13579":
                        pal = int(first + left + mid + left[::-1] + first)
                        if ok(pal): yield pal
    print([an for an in agentod(5)]) # Michael S. Branicky, Nov 23 2021

A123253 Sum of 7th powers of digits of n.

Original entry on oeis.org

0, 1, 128, 2187, 16384, 78125, 279936, 823543, 2097152, 4782969, 1, 2, 129, 2188, 16385, 78126, 279937, 823544, 2097153, 4782970, 128, 129, 256, 2315, 16512, 78253, 280064, 823671, 2097280, 4783097, 2187, 2188, 2315, 4374, 18571, 80312, 282123
Offset: 0

Views

Author

Zerinvary Lajos, Nov 06 2006

Keywords

Comments

Fixed points are listed in A124068 = row n=7 of A252648. - M. F. Hasler, Apr 12 2015

Crossrefs

Programs

  • Magma
    [0] cat [&+[d^7: d in Intseq(n)]: n in [1..40]]; // Bruno Berselli, Feb 01 2013
    
  • Maple
    A123253 := proc(n)
            add(d^7,d=convert(n,base,10)) ;
    end proc: # R. J. Mathar, Jan 16 2013
  • Mathematica
    Table[Sum[DigitCount[n][[i]] i^7, {i, 9}], {n, 0, 40}] (* Bruno Berselli, Feb 01 2013 *)
  • PARI
    A123253(n)=sum(i=1,#n=digits(n),n[i]^7) \\ M. F. Hasler, Apr 12 2015
Previous Showing 51-60 of 118 results. Next