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.

A357268 If n is a power of 2, a(n) = n. Otherwise, if 2^j is the greatest power of 2 not exceeding n, and if k = n - 2^j, then a(n) is the smallest m*a(k) which has not occurred already, where m is an odd number.

This page as a plain text file.
%I A357268 #44 Jun 29 2025 18:29:01
%S A357268 1,2,3,4,5,6,9,8,7,10,15,12,25,18,27,16,11,14,21,20,35,30,45,24,49,50,
%T A357268 75,36,125,54,81,32,13,22,33,28,55,42,63,40,77,70,105,60,175,90,135,
%U A357268 48,99,98,147,100,245,150,225,72,343,250,375,108,625,162,243,64,17
%N A357268 If n is a power of 2, a(n) = n. Otherwise, if 2^j is the greatest power of 2 not exceeding n, and if k = n - 2^j, then a(n) is the smallest m*a(k) which has not occurred already, where m is an odd number.
%C A357268 The definition implies that if n is not a power of 2, then neither is a(n).
%C A357268 Similar to the Doudna sequence (A005940), except that here the multiple of a(k) used to compute a(n) is the least odd number (rather than the least odd prime), such that a(n) is a novel term. Terms are the same as in A005940 until a(49)=99 (instead of 121), subsequent to which further odd nonprime multiples produce more differences from A005940; the next is a(71)=117 (instead of 99).
%C A357268 A permutation of the positive integers, in which the primes appear in natural order, but the odd numbers do not (9 precedes 7, 25 precedes 21, etc.).
%H A357268 Michael De Vlieger, <a href="/A357268/b357268.txt">Table of n, a(n) for n = 1..16384</a>
%H A357268 Michael De Vlieger, <a href="/A357268/a357268_1.png">Fan style binary tree</a>, n = 1..2^14, with a color function showing primes in red, proper prime powers in gold, squarefree composites in green, and numbers neither squarefree nor prime powers in blue and purple, where magenta represents powerful numbers that are not prime powers.
%H A357268 Michael De Vlieger, <a href="/A357268/a357268_2.png">Log log scatterplot of a(n)</a>, n = 1..2^14, with the same color function as immediately above.
%H A357268 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A357268 a(2^n + 1) is the smallest odd number which has not already occurred.
%e A357268 n = 49 = 2^5 + 17, and a(17) = 11, so a(49) is the least m*a(17) which has not occurred earlier, where m is an odd number. Up to this point we have seen 3*11, 5*11, 7*11, but not 9*11. Therefore a(49) = 9*11 = 99 (compare with A005940(71)=99).
%t A357268 nn = 65; m = 1; c[_] = False; Do[Set[{m, k}, {1, n - 2^Floor[Log2[n]]}]; If[k == 0, Set[{a[n], c[n]}, {n, True}], While[Set[t, m a[k]]; Or[m == 1, c[t]], m += 2]; Set[{a[n], c[t]}, {t, True}]], {n, nn}]; Array[a, nn] (* _Michael De Vlieger_, Sep 21 2022 *)
%o A357268 (Python)
%o A357268 from sympy import nextprime
%o A357268 from sympy.ntheory import digits
%o A357268 from itertools import count, islice
%o A357268 def b(n): return n - 2**(len(bin(n)[2:]) - 1)
%o A357268 def agen():
%o A357268     aset, alst = set(), [None]
%o A357268     for n in count(1):
%o A357268         k = b(n)
%o A357268         if k == 0: an = n
%o A357268         else:
%o A357268             ak, p = alst[k], 3
%o A357268             while p*ak in aset: p += 2
%o A357268             an = p*ak
%o A357268         yield an; aset.add(an); alst.append(an)
%o A357268 print(list(islice(agen(), 65))) # _Michael S. Branicky_, Sep 21 2022
%o A357268 (PARI) f(n) = n - 2^(logint(n, 2)); \\ A053645
%o A357268 lista(nn) = {my(va = vector(nn), sa = Set(va)); for (n=1, nn, my(x = f(n)); if (x == 0, va[n] = n, my(k=1); while (setsearch(sa, k*va[x]), k+=2); va[n] = k*va[x];); sa = Set(va);); va;} \\ _Michel Marcus_, Sep 27 2022
%Y A357268 Cf. A005940, A356867, A356886.
%Y A357268 Cf. A053644, A053645.
%K A357268 nonn
%O A357268 1,2
%A A357268 _David James Sycamore_, Sep 21 2022