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.

A345297 a(n) is the least k >= 0 such that A331835(k) = n.

This page as a plain text file.
%I A345297 #13 Jun 16 2021 04:56:36
%S A345297 0,1,2,3,5,6,7,10,11,13,14,15,22,23,26,27,29,30,31,43,45,46,47,54,55,
%T A345297 58,59,61,62,63,94,95,107,109,110,111,118,119,122,123,125,126,127,187,
%U A345297 189,190,191,222,223,235,237,238,239,246,247,250,251,253,254,255
%N A345297 a(n) is the least k >= 0 such that A331835(k) = n.
%C A345297 Sequence A200947 gives the position of the last occurrence of a number in A331835.
%H A345297 Rémy Sigrist, <a href="/A345297/b345297.txt">Table of n, a(n) for n = 0..2000</a>
%H A345297 Rémy Sigrist, <a href="/A345297/a345297.txt">C program for A345297</a>
%F A345297 a(A014284(n)) = 2^n - 1.
%F A345297 a(n) <= A200947(n).
%e A345297 We have:
%e A345297            n|  0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18
%e A345297   ----------+------------------------------------------------------------------
%e A345297   A331835(n)|  0  1  2  3  3  4  5  6  5  6   7   8   8   9  10  11   7   8   9
%e A345297 So a(0) = 0,
%e A345297    a(1) = 1,
%e A345297    a(2) = 2,
%e A345297    a(3) = 3,
%e A345297    a(4) = 5,
%e A345297    a(5) = 6,
%e A345297    a(6) = 7,
%e A345297    a(7) = 10,
%e A345297    a(8) = 11,
%e A345297    a(9) = 13,
%e A345297    a(10) = 14,
%e A345297    a(11) = 15.
%o A345297 (C) See Links section.
%o A345297 (Python)
%o A345297 from sympy import prime
%o A345297 def p(n): return prime(n) if n >= 1 else 1
%o A345297 def A331835(n): return sum(p(i)*int(b) for i, b in enumerate(bin(n)[:1:-1]))
%o A345297 def adict(klimit):
%o A345297     adict = dict()
%o A345297     for k in range(klimit+1):
%o A345297         fk = A331835(k)
%o A345297         if fk not in adict: adict[fk] = k
%o A345297     n, alst = 0, []
%o A345297     while n in adict: alst.append(adict[n]); n += 1
%o A345297     return alst
%o A345297 print(adict(255)) # _Michael S. Branicky_, Jun 13 2021
%Y A345297 Cf. A014284, A200947, A331835.
%K A345297 nonn,base
%O A345297 0,3
%A A345297 _Rémy Sigrist_, Jun 13 2021