[go: up one dir, main page]

login
Revision History for A245812 (Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing entries 1-10 | older changes
Self-inverse permutation of natural numbers: a(0) = 0, a(1) = 1, and for n > 1, if A065620(n) < 0, a(n) = A065621(1+a(-(A065620(n)))), otherwise a(n) = A048724(a(A065620(n)-1)).
(history; published version)
#29 by Michel Marcus at Sat May 08 11:24:19 EDT 2021
STATUS

reviewed

approved

#28 by Joerg Arndt at Sat May 08 11:12:17 EDT 2021
STATUS

proposed

reviewed

#27 by F. Chapoton at Sat May 08 11:03:25 EDT 2021
STATUS

editing

proposed

#26 by F. Chapoton at Sat May 08 11:03:18 EDT 2021
PROG

def a065620(n): return n if n<3 else 2*a065620(n//2) if n%2==0 else -2*a065620((n - 1)//2) + 1

print ([a(n) for n in range(101)] ) # Indranil Ghosh, Jun 07 2017

STATUS

approved

editing

Discussion
Sat May 08
11:03
F. Chapoton: adapt py code to py3
#25 by N. J. A. Sloane at Sat Dec 07 12:18:27 EST 2019
PROG

print [a(n) for n in xrangerange(101)] # Indranil Ghosh, Jun 07 2017

Discussion
Sat Dec 07
12:18
OEIS Server: https://oeis.org/edit/global/2837
#24 by Bruno Berselli at Wed Jun 07 10:44:29 EDT 2017
STATUS

reviewed

approved

#23 by Joerg Arndt at Wed Jun 07 10:34:33 EDT 2017
STATUS

proposed

reviewed

#22 by Indranil Ghosh at Wed Jun 07 10:30:22 EDT 2017
STATUS

editing

proposed

#21 by Indranil Ghosh at Wed Jun 07 10:29:26 EDT 2017
PROG

(PARI)

a048724(n) = bitxor(n, 2*n);

a065620(n) = if(n<3, n, if(n%2, -2*a065620((n - 1)/2) + 1, 2*a065620(n/2)));

a065621(n) = bitxor(n, 2*(n - bitand(n, -n)));

a(n) = x=a065620(n); if(n<2, n, if(x<0, a065621(1 + a(-x)), a048724(a(x - 1))));

for(n=0, 100, print1(a(n), ", ")) \\ Indranil Ghosh, Jun 07 2017

(Python)

def a048724(n): return n^(2*n)

def a065620(n): return n if n<3 else 2*a065620(n/2) if n%2==0 else -2*a065620((n - 1)/2) + 1

def a065621(n): return n^(2*(n - (n & -n)))

def a(n):

x=a065620(n)

return n if n<2 else a065621(1 + a(-x)) if x<0 else a048724(a(x - 1))

print [a(n) for n in xrange(101)] # Indranil Ghosh, Jun 07 2017

STATUS

approved

editing

#20 by N. J. A. Sloane at Fri Aug 22 16:46:44 EDT 2014
STATUS

proposed

approved