login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 6
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
a(1) = 1 by convention.
The first binary home prime that is not known is a(2295). - Ely Golden, Jan 09 2017
LINKS
Patrick De Geest, Home Primes
EXAMPLE
4 = 2*2 -> 1010 = 10 = 2*5 ->10101 = 21 = 3*7 -> 11111 = 31 = prime.
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 *)
PROG
(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
(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
CROSSREFS
Sequence in context: A217370 A088115 A230627 * A093712 A035514 A114009
KEYWORD
nonn,base,nice
AUTHOR
Michael B Greenwald (mbgreen(AT)central.cis.upenn.edu)
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 25 08:43 EDT 2024. Contains 374586 sequences. (Running on oeis4.)