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.

A048986 Home primes in base 2: primes reached when you start with n and (working in base 2) concatenate its prime factors (A048985); repeat until a prime is reached (or -1 if no prime is ever reached). Answer is written in base 10.

Original entry on oeis.org

1, 2, 3, 31, 5, 11, 7, 179, 29, 31, 11, 43, 13, 23, 29, 12007, 17, 47, 19, 251, 31, 43, 23, 499, 4091, 4091, 127, 4091, 29, 127, 31, 1564237, 59, 4079, 47, 367, 37, 83, 61, 383, 41, 179, 43, 499, 4091, 4091, 47, 683, 127, 173, 113, 173, 53, 191, 4091
Offset: 1

Views

Author

Michael B Greenwald (mbgreen(AT)central.cis.upenn.edu)

Keywords

Comments

a(1) = 1 by convention.
The first binary home prime that is not known is a(2295). - Ely Golden, Jan 09 2017

Examples

			4 = 2*2 -> 1010 = 10 = 2*5 ->10101 = 21 = 3*7 -> 11111 = 31 = prime.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Module[{fi}, If[PrimeQ[n], n, fi = FactorInteger[n]; Table[ First[#], {Last[#]}]& /@ fi // Flatten // IntegerDigits[#, 2]& // Flatten // FromDigits[#, 2]&]]; a[1] = 1; a[n_] := TimeConstrained[FixedPoint[f, n], 1] /. $Aborted -> -1; Array[a, 55] (* Jean-François Alcover, Jan 01 2016 *)
  • Python
    from sympy import factorint, isprime
    def f(n):
        if n == 1: return 1
        return int("".join(bin(p)[2:]*e for p, e in factorint(n).items()), 2)
    def a(n):
        if n == 1: return 1
        while not isprime(n): n = f(n)
        return n
    print([a(n) for n in range(1, 56)]) # Michael S. Branicky, Oct 07 2022
  • SageMath
    def digitLen(x,n):
        r=0
        while(x>0):
            x//=n
            r+=1
        return r
    def concatPf(x,n):
        r=0
        f=list(factor(x))
        for c in range(len(f)):
            for d in range(f[c][1]):
                r*=(n**digitLen(f[c][0],n))
                r+=f[c][0]
        return r
    def hp(x,n):
        x1=concatPf(x,n)
        while(x1!=x):
            x=x1
            x1=concatPf(x1,n)
        return x
    radix=2
    index=2
    while(index<=1344):
        print(str(index)+" "+str(hp(index,radix)))
        index+=1
    

A006919 Write down all the prime divisors in previous term.

Original entry on oeis.org

8, 222, 2337, 31941, 33371313, 311123771, 7149317941, 22931219729, 112084656339, 3347911118189, 11613496501723, 97130517917327, 531832651281459, 3331113965338635107, 3331113965338635107
Offset: 1

Views

Author

Keywords

References

  • H. Jaleebi, personal communication.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A056938 (same for a(1)=49), A037271-A037276, A048985, A048986, A049065.

Programs

  • Mathematica
    g[ n_ ] := (x = n; d = {}; While[ FactorInteger[ x ] != {}, f = FactorInteger[ x, FactorComplete -> True ][ [ 1, 1 ] ]; x = x/f; AppendTo[ d, IntegerDigits[ f ] ] ]; FromDigits[ Flatten[ d ] ]); NestList[ g, 8, 15 ]
    NestList[FromDigits[Flatten[IntegerDigits/@(Table[First[#],{Last[#]}]& /@ FactorInteger[#])]]&,8,15] (* Harvey P. Dale, Dec 04 2011 *)
  • PARI
    first(N, a=8)=vector(N,i,if(i>1,a=A037276(a),a)) \\ M. F. Hasler, Oct 07 2022

Formula

a(n+1) = A037276(a(n)), a(1) = 8. - M. F. Hasler, Oct 07 2022

Extensions

More terms from Robert G. Wilson v, Sep 05 2000, who remarks that sequence stabilizes at 13th term with a prime.
Showing 1-2 of 2 results.