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.

A277428 a(n) = the n-bit number in which the i-th bit is 1 if and only if prime(i) divides A060795(n).

This page as a plain text file.
%I A277428 #35 Dec 03 2016 12:04:23
%S A277428 0,1,4,9,11,22,75,105,449,425,1426,2837,4765,2775,21895,57558,87602,
%T A277428 145177,123788,694479,677326,1516496,3363284,2048443,26968428,
%U A277428 24488513,98733728
%N A277428 a(n) = the n-bit number in which the i-th bit is 1 if and only if prime(i) divides A060795(n).
%C A277428 a(n) is also the n-bit number in which the i-th bit is 1 if and only if prime(i) does not divide A060796(n).
%C A277428 a(n) is also the encoding of the fraction defined as follows:
%C A277428 Consider the set of fractions that can be built by only using each prime number from prime(1) to prime(n) exactly once as factors, either in the numerator or in the numerator. There are 2^n such fractions. One of them, let's call it x, has the property of yielding the result nearest to 1. a(n) is the n-bit number in which the i-th bit is 1 if prime(i) appears in the numerator of x, 0 if prime(i) appears in the denominator of x.
%C A277428 Remark: x is A060795(n) / A060796(n). Notice how in this prime-rank-to-bit representation, A060795(n) and A060796(n) are each other's bitwise negation.
%e A277428 For n = 1, two distinct fractions can be written with the first prime number, namely 1/2 and 2. Of the two, 1/2 is nearer to 1. 1/2 has its 2 below the fraction bar, so its binary encoding is 0, which yields a(1) = 0.
%e A277428 For n = 2, four distinct fractions can be written with the first two prime numbers, namely 1/6, 2/3, 3/2 and 6. 2/3 is the nearest to 1. 2/3 has its 2 above the fraction bar and its 3 below, so its encoding is 01, which yields a(2) = 1.
%t A277428 {0}~Join~Table[Function[p, FromDigits[#, 2] &@ Reverse@ MapAt[# + 1 &, ConstantArray[0, n], Partition[#, 1, 1]] &@ PrimePi@ FactorInteger[Numerator@ #][[All, 1]] &@ Max@ Select[Map[p/#^2 &, Divisors@ p], # < 1 &]][Times @@ Prime@ Range@ n], {n, 2, 23}] (* _Michael De Vlieger_, Oct 19 2016 *)
%o A277428 (Java)
%o A277428 package oeis;
%o A277428 public class BinaryEncodedBestPrimeSetup {
%o A277428   // Brute force implementation... Can it be improved?
%o A277428 public static int PRIME[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, /* to be continued */ };
%o A277428 public static void main(String args[]) {
%o A277428   int nMax = PRIME.length; // number of terms of the sequence
%o A277428   for (int n = 1; n <= nMax; n ++) {
%o A277428    if (n > 1) {
%o A277428     System.out.print(", ");
%o A277428    }
%o A277428    System.out.print(u(n));
%o A277428   }
%o A277428 }
%o A277428 private static int u(int n) {
%o A277428   double bestMul = 0.0;
%o A277428   int bestSetup = -1;
%o A277428   int s = 0; // binary-encoded setup number
%o A277428   for (s = 0; s < (1 << n); s ++) {
%o A277428    double mul = 1.0;
%o A277428    int i = 0; // prime number #
%o A277428    for (i = 0; i < n; i ++) {
%o A277428     if ((s & (1 << i)) != 0) {
%o A277428      mul *= PRIME[i]; // 1 = above fraction bar
%o A277428     } else {
%o A277428      mul /= PRIME[i]; // 0 = below fraction bar
%o A277428     }
%o A277428    }
%o A277428    if (mul < 1.0) {
%o A277428     if (mul > bestMul) {
%o A277428      bestMul = mul;
%o A277428      bestSetup = s;
%o A277428     }
%o A277428    }
%o A277428   }
%o A277428   return bestSetup;
%o A277428 }
%o A277428 }
%o A277428 (PARI) a060795(n) = my(m=prod(i=1, n, prime(i))); divisors(m)[numdiv(m)\2];
%o A277428 a(n) = {my(a95 = a060795(n)); v = vector(n, i, (a95 % prime(i))==0); subst(Polrev(v), x, 2); } \\ _Michel Marcus_, Dec 03 2016
%Y A277428 Encodes A060795 and A060796. Cf. A002110, A261144.
%K A277428 nonn,base,more
%O A277428 1,3
%A A277428 _Luc Rousseau_, Oct 14 2016
%E A277428 a(22)-a(27) from _Michael De Vlieger_, Oct 19 2016