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.

A277021 Left inverse of A277022.

This page as a plain text file.
%I A277021 #13 May 08 2021 23:05:32
%S A277021 0,1,2,2,6,3,4,3,30,7,8,4,12,5,6,4,210,31,32,8,36,9,10,5,60,13,14,6,
%T A277021 18,7,8,5,2310,211,212,32,216,33,34,9,240,37,38,10,42,11,12,6,420,61,
%U A277021 62,14,66,15,16,7,90,19,20,8,24,9,10,6,30030,2311,2312,212,2316,213,214,33,2340,217,218,34,222,35,36,10,2520,241,242
%N A277021 Left inverse of A277022.
%H A277021 Antti Karttunen, <a href="/A277021/b277021.txt">Table of n, a(n) for n = 0..8191</a>
%H A277021 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%H A277021 <a href="/index/Pri#primorialbase">Index entries for sequences related to primorial base</a>
%F A277021 a(n) = A276085(A005940(1+n)).
%F A277021 Other identities. For all n >= 0:
%F A277021 a(A277022(n)) = n.
%o A277021 (Scheme)
%o A277021 (define (A277021 n) (let loop ((s 0) (n n) (r 0) (i 1) (pr 1)) (cond ((zero? n) (+ s (* r pr))) ((even? n) (loop (+ s (* r pr)) (/ n 2) 0 (+ 1 i) (* (A000040 i) pr))) (else (loop s (/ (- n 1) 2) (+ 1 r) i pr)))))
%o A277021 (Python)
%o A277021 from sympy import primorial, primepi, prime, factorint, floor, log
%o A277021 def a002110(n): return 1 if n<1 else primorial(n)
%o A277021 def a276085(n):
%o A277021     f=factorint(n)
%o A277021     return sum([f[i]*a002110(primepi(i) - 1) for i in f])
%o A277021 def A(n): return n - 2**int(floor(log(n, 2)))
%o A277021 def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n))
%o A277021 def a(n): return a276085(b(n - 1))
%o A277021 print([a(n) for n in range(1, 101)]) # _Indranil Ghosh_, Jun 22 2017
%Y A277021 Left inverse of A277022.
%Y A277021 Cf. A005940, A276085.
%Y A277021 Cf. also A277017.
%K A277021 nonn,base
%O A277021 0,3
%A A277021 _Antti Karttunen_, Sep 26 2016