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 11-13 of 13 results.

A245453 Self-inverse and multiplicative permutation of natural numbers, A235041-conjugate of balanced bit-reverse: a(n) = A235042(A057889(A235041(n))).

Original entry on oeis.org

0, 1, 2, 3, 4, 19, 6, 7, 8, 9, 38, 13, 12, 11, 14, 57, 16, 59, 18, 5, 76, 21, 26, 53, 24, 361, 22, 27, 28, 109, 114, 31, 32, 39, 118, 133, 36, 41, 10, 33, 152, 37, 42, 103, 52, 171, 106, 61, 48, 49, 722, 177, 44, 23, 54, 247, 56, 15, 218, 17, 228, 47, 62, 63, 64
Offset: 0

Views

Author

Antti Karttunen, Aug 07 2014

Keywords

Comments

a(n) has the same prime signature as n: The permutation maps primes to primes, squares to squares, cubes to cubes, and so on. Permutation A234748 shares the same property.

Examples

			Example of multiplicativity:
a(5)=19, a(11)=13, a(55) = a(5*11) = a(5) * a(11) = 19*13 = 247.
		

Crossrefs

Programs

Formula

a(n) = A235042(A057889(A235041(n))).

A341090 Fully multiplicative: for any prime p, if the reversal of p in base 10, say q, is prime, then a(p) = q, otherwise a(p) = p.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 31, 14, 15, 16, 71, 18, 19, 20, 21, 22, 23, 24, 25, 62, 27, 28, 29, 30, 13, 32, 33, 142, 35, 36, 73, 38, 93, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 213, 124, 53, 54, 55, 56, 57, 58, 59, 60, 61, 26, 63, 64, 155, 66
Offset: 1

Views

Author

Rémy Sigrist, Feb 13 2022

Keywords

Comments

This sequence is a self-inverse permutation of the natural numbers.

Examples

			For n = 377:
- 377 = 13 * 29,
- the reversal of 13, 31, is prime,
- the reversal of 29, 92, is not prime,
- so a(377) = 31 * 29 = 899.
		

Crossrefs

Programs

  • Maple
    R:= n-> (s-> parse(cat(s[-i]$i=1..length(s))))(""||n):
    a:= proc(n) option remember; mul((q->
         `if`(isprime(q), q, j[1]))(R(j[1]))^j[2], j=ifactors(n)[2])
        end:
    seq(a(n), n=1..66);  # Alois P. Heinz, Feb 15 2022
  • Mathematica
    f[p_, e_] := If[PrimeQ[(q = IntegerReverse[p])], q, p]^e; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Feb 15 2022 *)
  • PARI
    a(n) = { my (f=factor(n)); prod (k=1, #f~, my (p=f[k,1], e=f[k,2], q=fromdigits(Vecrev(digits(p)))); if (isprime(q), q, p)^e) }

A226019 Primes whose binary reversal is a square.

Original entry on oeis.org

2, 19, 79, 149, 569, 587, 1237, 2129, 2153, 2237, 2459, 2549, 4129, 4591, 4657, 4999, 8369, 8999, 9587, 9629, 9857, 10061, 17401, 17659, 17737, 18691, 20149, 20479, 33161, 33347, 34631, 35117, 35447, 39023, 40427, 40709, 66403, 68539, 74707, 75703, 79063, 79333, 80071
Offset: 1

Views

Author

Alex Ratushnyak, May 23 2013

Keywords

Comments

The sequence of corresponding squares begins: 1, 25, 121, 169, 625, 841, 1369, 2209, 2401, 3025, 3481, 2809, 4225, 7921, ...
For n>1 the second and third most significant bits of a(n) are "0" because all odd squares are equal to 1 mod 8. - Andres Cicuttin, May 12 2016

Crossrefs

Subsequence of A204219. Cf. also A235027.

Programs

  • Mathematica
    Select[Table[Prime[j],{j,1,10000}],Element[Sqrt[FromDigits[Reverse[IntegerDigits[#,2]],2]],Integers]&] (* Andres Cicuttin, May 12 2016 *)
  • PARI
    isok(k) = isprime(k) && issquare(fromdigits(Vecrev(binary(k)), 2)); \\ Michel Marcus, Feb 19 2021
  • Python
    import math
    primes = []
    def addPrime(k):
      for p in primes:
        if k%p==0:  return
        if p*p > k:  break
      primes.append(k)
      r = 0
      p = k
      while k:
        r = r*2 + (k&1)
        k>>=1
      s = int(math.sqrt(r))
      if s*s == r:  print(p, end=', ')
    addPrime(2)
    addPrime(3)
    for i in range(5, 1000000000, 6):
      addPrime(i)
      addPrime(i+2)
    
  • Python
    from sympy import isprime
    A226019_list, i, j = [2], 0, 0
    while j < 2**34:
        p = int(format(j,'b')[::-1],2)
        if j % 2 and isprime(p):
            A226019_list.append(p)
        j += 2*i+1
        i += 1
    A226019_list = sorted(A226019_list) # Chai Wah Wu, Dec 20 2015
    
  • Python
    from sympy import integer_nthroot, primerange
    def ok(p): return integer_nthroot(int(bin(p)[:1:-1], 2), 2)[1]
    def aupto(lim): return [p for p in primerange(2, lim+1) if ok(p)]
    print(aupto(80071)) # Michael S. Branicky, Feb 19 2021
    
Previous Showing 11-13 of 13 results.