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.

A225974 Multiplicative persistence with squares of decimal digits: smallest number such that the number of iterations of "multiply digits squared" needed to reach 0 or 1 equals n.

Original entry on oeis.org

0, 10, 25, 5, 8, 6, 3, 2
Offset: 0

Views

Author

Michel Lagneau, May 22 2013

Keywords

Comments

This sequence is probably finite.

Examples

			a(1) is not 1, because 1 takes 0 steps to reach 0 or 1. - _N. J. A. Sloane_, Nov 05 2022
From _Mohammed Yaseen_, Oct 11 2022: (Start)
5 -> 25 -> 4*25 = 100 -> 1*0*0 = 0. So a(3) = 5.
8 -> 64 -> 36*16 = 576 -> 25*49*36 = 44100 -> 16*16*1*0*0 = 0. So a(4) = 8. (End)
		

Crossrefs

Programs

  • Mathematica
    lst = {}; n = 0; Do[While[True, k = n; c = 0; While[k > 9, k = Times @@ IntegerDigits[k]^2; c++]; If[c == l, Break[]]; n++]; AppendTo[lst, n], {l, 0, 7}]; lst
  • Python
    from math import prod
    from itertools import count, islice
    def f(n): return prod(map(lambda x: x*x, map(int, str(n))))
    def A031348(n):
        c = 0
        while n not in {0, 1}: n, c = f(n), c+1
        return c
    def agen():
        adict, n = dict(), 0
        for k in count(0):
            v = A031348(k)
            if v not in adict: adict[v] = k
            while n in adict: yield adict[n]; n += 1
    print(list(islice(agen(), 8))) # Michael S. Branicky, Oct 13 2022

Formula

a(n) = Min{k >= 0 : A031348(k) = n}. - Michael S. Branicky, Oct 13 2022

Extensions

a(3)-a(6) corrected and a(7) from Mohammed Yaseen, Oct 11 2022

A226036 Let abc... be the decimal expansion of n. a(n) is the number of iterations of the map n -> f(n) needed to reach the last number of the cycle, where f(n) = a^a + b^b + c^c + ...

Original entry on oeis.org

1, 0, 58, 66, 57, 104, 46, 70, 144, 98, 59, 59, 105, 70, 66, 107, 102, 46, 150, 124, 105, 105, 145, 71, 146, 47, 145, 65, 69, 115, 70, 70, 71, 152, 142, 104, 106, 106, 103, 44, 66, 66, 146, 142, 189, 151, 50, 62, 141, 101, 107, 107, 47, 104, 151, 102, 186, 76
Offset: 0

Views

Author

Michel Lagneau, May 24 2013

Keywords

Comments

Additive persistence with powers of decimal digits: number of steps for "add digit(i) ^ digit(i)" operation to stabilize when started at n.
Or number of distinct values obtained by iterating n -> A045503(n).
We take 0^0 = 1.
It is conjectured that the trajectory for every number converges to a single number. The growth of a(n) is very slow; for example, a(457) = 211, a(10337) = 213, a(16669) = 214, ...

Examples

			a(0) = 1 because 0 -> 0^0 = 1 with 1 iteration;
a(1) = 0 because 1 -> 1^1 => 0 iteration;
a(354) = 4 because:
354 -> 3^3 + 5^5 + 4^4 = 3408;
3408 -> 3^3 + 4^4 + 0^0 + 8^8 = 16777500;
16777500 -> 1^1 + 6^6 + 7^7 + 7^7 + 7^7 + 5^5 + 0^0 + 0^0 = 2520413;
2520413 -> 2^2 + 5^5 + 2^2 + 0^0 + 4^4 + 1^1 + 3^3 = 3418 and
3418 is the last number of the cycle because 3418 -> 16777500 is already in the trajectory. We obtain 4 iterations: 354 -> 3408 -> 16777500 -> 2520413 -> 3418.
		

Crossrefs

Programs

  • Maple
    A000312:=proc(n)
        if n = 0 then 1;
        else add(d^d, d=convert(n, base, 10)) ;
        end if;
    end proc:
    A226036:= proc(n)
        local traj , c;
        traj := n ;
        c := [n] ;
        while true do
           traj := A000312(traj) ;
           if member(traj, c) then
           return nops(c)-1 ;
           end if;
           c := [op(c), traj] ;
        end do:
    end proc:
    seq(A226036(n), n=0..100) ;
  • Mathematica
    Unprotect[Power]; 0^0 = 1; Protect[Power]; f[n_] := (cnt++; id = IntegerDigits[n]; Total[id^id]); a[n_] := (cnt = 0; NestWhile[f, n, UnsameQ, All]; cnt-1); Table[a[n], {n, 0, 60}] (* Jean-François Alcover, May 24 2013 *)

A226135 Let abcd... be the decimal expansion of n. Number of iterations of the map n -> f(n) needed to reach a number < 10, where f(n) = a^b + c^d + ... which ends in an exponent or a base according as the number of digits is even or odd.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 5, 2, 21, 2, 1, 1, 1, 3, 2, 3, 6, 8, 19, 6, 1, 1, 2, 5, 21, 3, 4, 12, 17, 4, 1, 1, 3, 2, 3, 5, 4, 15, 4, 3, 1, 1, 7, 2, 4, 14, 16, 4, 16, 4, 1, 1, 5, 6, 3, 2, 5, 11, 13, 15, 1, 1, 5
Offset: 0

Views

Author

Michel Lagneau, May 27 2013

Keywords

Comments

Inspired by the sequence A133501 (Number of steps for "powertrain" operation to converge when started at n). It is conjectured that the trajectory for each number converges to a single number < 10.
The conjecture is true, since f(x) < x trivially holds for x > 10^10 and I have verified that for every 10 <= x <= 10^10 there is a k such that f^(k)(x) < x, where f^(k) denotes f applied k times. Both the conventions 0^0 = 1 and 0^0 = 0 have been taken into account. - Giovanni Resta, May 28 2013

Examples

			a(62) = 7 because:
62 -> 6^2 = 36;
36 -> 3^6 = 729;
729 -> 7^2 + 9^1 = 58;
58 -> 5^8 = 390625;
390625 -> 3^9 + 0^6 + 2^5 = 19715;
19715 -> 1^9 + 7^1 + 5^1 = 13;
13 -> 1^3 = 1;
62 -> 36 -> 729 -> 58 -> 390625 -> 19715 -> 13 -> 1 with 7 iterations.
		

Crossrefs

Programs

  • Maple
    A133501:= proc(n)
         local a, i, n1, n2, t1, t2;
         n1:=abs(n); n2:=sign(n); t1:=convert(n1, base, 10); t2:=nops(t1); a:=0;
            for i from 0 to floor(t2/2)-1 do
             a := a+t1[t2-2*i]^t1[t2-2*i-1];
           od:
           if t2 mod 2 = 1 then
           a:=a+t1[1]; fi; RETURN(n2*a); end;
    A226135:= proc(n)
        local traj , c;
        traj := n ;
        c := [n] ;
        while true do
           traj := A133501(traj) ;
           if member(traj, c) then
           return nops(c)-1 ;
           end if;
           c := [op(c), traj] ;
        end do:
    end proc:
    seq(A226135(n), n=0..100) ;
    # second Maple program:
    f:= n-> `if`(n<10, n, `if`(is(length(n), odd), f(10*n+1),
                   iquo(irem(n, 100, 'r'), 10, 'h')^h+f(r))):
    a:= n-> `if`(n<10, 0, 1+a(f(n))):
    seq(a(n), n=0..100);  # Alois P. Heinz, May 27 2013
Showing 1-3 of 3 results.