database design – Using one sequence across all tables in PostgreSQL

I propose using a single sequence for the bigint identity columns of most or all tables. (Essentially, OID, except 64-bit.)

  1. This helps prevent security problems for a multi-tenant application that joins tables incorrectly.

  2. While a uuid could be used for this, bigint is half that size, helping save index space.

My understanding is that sequence generation is very fast in PostgreSQL.

The only downside I can see is widening the type of tables could get by with 4 byte integer IDs, but thanks to PostgreSQL upsert behavior (generating a new value whether or not it’s needed), I rarely use int IDs anyway.

Is there an issue with approach? I haven’t found anyone advocating for it, but I consider the join safeguard to be quite nice.

nt.number theory – Sum of Fibonacci sequence evaluated at a Dirichler character

Let $F_n$ be the Fibonacci sequence and $chi$ a non-principal primitive Dirichlet character. Does there exist $n$ such that $chi(F_n) neq 0,1$?

One way to prove this would be to obtain non-trivial bounds for sums of the shape $sum_{n leq x} chi(F_n)$.

It is foreseeable that there could be some “bad” Dirichlet characters where one does not obtain the result, so I’m very happy to ignore finitely many Dirichlet characters of any given order (say).

More generally, I’d like to know a version of this where $F_n$ is replaced by an arbitrary Lucas sequence.

real analysis – Let ${x_n}$ be a sequence such that $lim_{n to infty} sup(x_n)=infty$. Then there is a sub sequence of ${x_n}$ that converges to $infty$.

Im not sure how to go about this. I think I am supposed to use the definition of limit superior, but I do not know how to incorporate this. I barely have anything useful, all I have is:

We will start by assuming ${x_n}$ is a sequence and $lim_{n to infty} sup(x_n)=infty$ and we will let $x_{pn}$ be any sub sequence of ${x_n}$.

Can anyone help me, please?

nt.number theory – Explanation of unexpectedly large offset of the first occurrence of five consecutive zeroes in the sequence of second-to-last bits of primes

Assuming that $x$ is a real number, the function $f_n(x)$ is defined as follows: the value of $f_n(x)$ is equal to the number of bits before the first occurrence of $n$ consecutive zero bits in the binary representation of the fractional part of $x$. For example, $$begin{array}{l}
f_1(0.11100110001ldots) = f_2(0.11100110001ldots) = 3,\
f_2(0.1110110001ldots) = f_3(0.11100110001ldots) = 6.
end{array}$$

(Here we can assume that if $n$ consecutive zero bits never occur in $x$, the value of $f_n(x)$ is undefined: for example, $f_n(frac{1}{3}) = f_n(0.010101ldots_2))$ is undefined for any $n>1$.

Let $r$ denote the real number such that $0 < r < 1$ and an $i$-th bit of the binary representation of the fractional part of $r$ is equal to the second-to-last bit of the binary representation of an $i$-th prime. That is, $$r = 0.11011001101001101011011000110ldots_2$$

There are $131007$ zero bits in the first $262144 = 2^{18}$ bits of the binary representation of the fractional part of $r$. The number of zero bits in the first $500000$ bits is $249888$.

Consider the value of $f_5(r)=377$, which is significantly larger than expected in an unbiased sequence of random (or pseudo-random) bits: for comparison, $$f_5(pi)=95, f_5(e)=89, f_5(sqrt{2})=7, f_5(sqrt{3})=92, f_5(sqrt{5})=53, f_5(sqrt{6})=25, f_5(sqrt{7})=115, f_5(sqrt{8})=6, f_5(sqrt{10})=16.$$

Question: why is the value of $f_5(r)$ so large?

transactions – Sequence valid before time

I’m studying sequence, and I set a transaction valid after 512 seconds.
First of all I use regtest and I start from clean blockchain, after that I mine 114 blocks.
At this point miner creates a transaction and tries to send it

My decode transaction

{
  "txid": "59ff4adafb47a5b22c6434af38f6e138c9008356778ed8b308c48029d7d4032f",
  "hash": "1bef48f96d18f1c78021b7e4b0a7d5285f6f7d2cc8c7adc31671820e367c3d70",
  "version": 2,
  "size": 191,
  "vsize": 110,
  "weight": 437,
  "locktime": 0,
  "vin": (
    {
      "txid": "88fb1408675c774c36692f170c6122af49cab7a5bab336272f0e4d8c0ef8c89a",
      "vout": 0,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": (
        "3044022070b753c99e2b6d241fd8a4ebe26f53644ef3eea58fff743e51f7a69e1ee7a99602204cbe9a60fc25be24baa3e4613f27a3e51df4a285174e001b62de18e1da2e42fd01",
        "03494041191fd2b02579fd49877755e55d9d451a37c6d0bbe04aab8ef507a78b19"
      ),
      "sequence": 4194305
    }
  ),
  "vout": (
    {
      "value": 49.99100000,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 18363770025baac1ebdb99a948eab2776d9568ae",
        "hex": "001418363770025baac1ebdb99a948eab2776d9568ae",
        "reqSigs": 1,
        "type": "witness_v0_keyhash",
        "addresses": (
          "bcrt1qrqmrwuqztw4vr67mnx55364jwake269w8hl5fe"
        )
      }
    }
  )
}

I Give an error when I try to use sendrawtransaction

error code: -26
error message:
non-BIP68-final (code 64)

And it’s correct because my UTXO (88fb1408675c774c36692f170c6122af49cab7a5bab336272f0e4d8c0ef8c89a) come from the block with height 2 and 113 confirmations, and its median time is 1590276467 (2020-05-24 01:27:47 CET/CEST) and My transaction is valid after 512 seconds (Date:2020-05-24 01:41:23 CET/CEST) and the best block has that value 2020-05-24 01:28:06 CET/CEST (it’s not useful)

Now, If I create another transaction with the TXID comes from block with height 1 and 114 confirmations it works, I can send it.
Below my transaction and details.

{
  "txid": "f98d3ef70ca2c9d797bf7fff2e96e07f5ba10a280186a2132c6a902eebcab31e",
  "hash": "5776ad750fe759411a1ed5aa10e759b33e52b2935555d90b997fa788c9e25405",
  "version": 2,
  "size": 191,
  "vsize": 110,
  "weight": 437,
  "locktime": 0,
  "vin": (
    {
      "txid": "e1ee4602a78ab4f5f58705a75405d2f223307989950e1cbe03a4518cf23b7914",
      "vout": 0,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": (
        "304402200641ef29e3f0c8ef0c55dbb4a86a752e3655dd0c928c4e2e6659d3beeaf3f3870220026821b9ba043894cb20c7d7a378eaae76f56400755bf412f8ab1524a9a238b301",
        "03494041191fd2b02579fd49877755e55d9d451a37c6d0bbe04aab8ef507a78b19"
      ),
      "sequence": 4194305
    }
  ),
  "vout": (
    {
      "value": 49.99100000,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 18363770025baac1ebdb99a948eab2776d9568ae",
        "hex": "001418363770025baac1ebdb99a948eab2776d9568ae",
        "reqSigs": 1,
        "type": "witness_v0_keyhash",
        "addresses": (
          "bcrt1qrqmrwuqztw4vr67mnx55364jwake269w8hl5fe"
        )
      }
    }
  )
}

The median time of block 1 and 114 confirmations is 1590276486 (2020-05-24 01:28:06 CET/CEST) and my transaction should be valid after 512 seconds (2020-05-24 01:45:05 CET/CEST), and my best block median time is 2020-05-24 01:28:06 CET/CEST

Below, the details of block 2 with 114 confirmations

{
  "hash": "5f769f610f29057577611868a660b353bea06e51d94905f3dbf7fb93e60a3d30",
  "confirmations": 1,
  "strippedsize": 214,
  "size": 250,
  "weight": 892,
  "height": 114,
  "version": 536870912,
  "versionHex": "20000000",
  "merkleroot": "1699f1cebdde9f4da1211f948f2ec194f7820fcfbab80c93bb5ea486e6837be7",
  "tx": (
    "1699f1cebdde9f4da1211f948f2ec194f7820fcfbab80c93bb5ea486e6837be7"
  ),
  "time": 1590276487,
  "mediantime": 1590276486,
  "nonce": 0,
  "bits": "207fffff",
  "difficulty": 4.656542373906925e-10,
  "chainwork": "00000000000000000000000000000000000000000000000000000000000000e6",
  "nTx": 1,
  "previousblockhash": "36f373a49886a31eff05ff8de39722f589cff103bed47715dd697d14350539ce"
}

Now, I know the sequence (00000000010000000000000000000001) is checked on median time of UTXO’s block, But block 2 (with 114 confirmations) and block 3 (with 113 confirmations) are very similar and very close, and I don’t understand why with block height 2 I’m able to send the transaction.

pr.probability – The mean value of the reconstruction complexity of a random sequence

This problem is motivated by the problem of reconstructing a genome from the family of its short subwords.

Given a word $w$ and a positive integer $k$, let $M_k(w)$ be the family of all subwords of length $k$ and $mu_{k,w}:M_k(w)to omega$ be the function assigning to each subword $vin M_k(w)$ the number of subwords of $w$ that are equal to $v$.

For example, for the word $w=mathover!flow$ we have
$$M_2(w)={ma,at,th,ho,ov,ve,er,rf,fl,lo,ow}$$ and
$$M_3(w)={mat,ath,tho,hov,ove,ver,erf,rfl,flo,low}$$ and $mu_{k,w}equiv 1$ is the constant unit functions on $M_k(w)$ for $kin{2,3}$.

Definition. The reconstruction complexity of a word $w$ is the smallest $k$ such that for any word $u$, the equality $mu_{k,w}=mu_{k,u}$ implies $w=u$.

For example, the word $mathover!flow$ has reconstruction complexity 2.

Problem. What is the mean value of the reconstruction complexity of a random word of length $n$ in a finite alphabet $A$? We assume that each word appears with equal probability $1/|A|^n$.

I am especially interested in case $|A|=4$ (because DNA-sequences are written in such an alphabet).

Computer experiments show that a random word in 4-letter alphabet of length about 1500 (a typical length of a short gene) has reconstruction complexity about 10, and the complexity slightly grows with growth of $n$. For $n=3000$ it is near 12. So, what are lower and upper bounds for the reconstruction complexity of a random word? Maybe it is $O(ln n)$?

i need JavaScript to check a column uniqueness in the list and if column is unique start sequence column with number as 1

i need JavaScript to check a column uniqueness in the list and if column is unique start sequence column with number as 1

Eg: Column A (Work order number) is entered with a value then script should whether value is new (new work order) to the list >> if yes and sequence column (Column B) to show value 1

Please help.

Sharepoint 2013

i need JavaScript to add sequence based on value in last added item in sharepoint list

i need JavaScript to add sequence number based on sequence number in last added item (I do not want to use ID for increment in sequence )

Eg: Auto sequence column is with value 1 … on adding second item value on last item should be checked and sequence as 2 in new item . Since , Sequence column will get reset by workflow as 1 based on some condition i do not want to use ID as increment. I need JavaScript to add increatment value of 1 for new items

Please help.

Sharepoint 2013