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.

A254116 Permutation of natural numbers: a(n) = A064216(A254103(n)).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 13, 10, 11, 12, 9, 14, 17, 16, 41, 26, 23, 20, 15, 22, 19, 24, 67, 18, 37, 28, 47, 34, 29, 32, 27, 82, 61, 52, 73, 46, 43, 40, 89, 30, 21, 44, 59, 38, 31, 48, 111, 134, 107, 36, 57, 74, 33, 56, 149, 94, 79, 68, 83, 58, 25, 64, 359, 54, 181, 164, 193, 122, 101, 104, 229, 146, 49, 92, 85, 86, 71, 80, 185, 178, 139, 60, 95, 42, 39
Offset: 1

Views

Author

Antti Karttunen, Feb 04 2015

Keywords

Crossrefs

Inverse: A254115.
Fixed points: A254099.
Related permutations: A064216, A254103, A254118.

Programs

  • PARI
    default(primelimit, 2^30);
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A064216(n) = A064989((2*n)-1);
    A254103(n) = { if(0==n,0,if(!(n%2),(3*A254103(n/2))-1,(3*(1+A254103((n-1)/2)))\2)); };
    A254116(n) = A064216(A254103(n));
    for(n=1, 8192, write("b254116.txt", n, " ", A254116(n)));
    
  • Python
    from sympy import factorint, prevprime, floor
    from operator import mul
    def a064216(n):
        f=factorint(2*n - 1)
        return 1 if n==1 else reduce(mul, [prevprime(i)**f[i] for i in f])
    def a254103(n):
        if n==0: return 0
        if n%2==0: return 3*a254103(n/2) - 1
        else: return floor((3*(1 + a254103((n - 1)/2)))/2)
    def a(n): return a064216(a254103(n)) # Indranil Ghosh, Jun 06 2017
  • Scheme
    (define (A254116 n) (A064216 (A254103 n)))
    

Formula

a(n) = A064216(A254103(n)).
Other identities. For all n >= 1:
a(n) = a(2n)/2. [Even bisection halved gives back the sequence itself.]
A254118(n) = (a((2*n)+1) - 1)/2. [Likewise, the odd bisection induces A254118.]