login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Shadow of Pi.
2

%I #16 Jul 29 2023 14:36:37

%S 1,4,18,33,42,44,50,55,90,98,195,288,311,395,457,521,859,891,898,1848,

%T 1876,2717,3688,3757,3796,4733,5243,5301,5321,6295,6389,6434,6526,

%U 6556,6634,6650,6690,7318,7938,8027,9013,9293,9327,9409,9462,9883,10053

%N Shadow of Pi.

%C First differences are Pi's shadow. Never twice the same integer in sequence or first differences.

%C a(20) is 1848, not 993, since the latter would leave out the next 0 in Pi. - _Michael S. Branicky_, Jun 15 2021

%H Michael S. Branicky, <a href="/A110621/b110621.txt">Table of n, a(n) for n = 1..10000</a>

%e The first line hereunder is the sequence, the second line are the first differences:

%e 1.4..18..33.42.44.50.55..90.98..195..288..311...

%e .3.14..15..9..2..6..5..35..8..97...93...23 <-- Pi shadow

%e (Pi=3.141592653589793238462643383279502884197169399...)

%t a[1] = 1; a[n_] := a[n] = Block[{c = RealDigits[Pi, 10, 300][[1]], k = 1, t = Table[a[i], {i, n - 1}]}, d = Drop[t, 1] - Drop[t, -1]; b = Drop[c, Length[ Flatten[ IntegerDigits /@ d]]]; e = Union[ Join[t, d]]; While[f = FromDigits[ Take[b, k]]; Position[e, f] != {} || b[[k + 1]] == 0, k++ ]; f + a[n - 1]]; Table[ a[n], {n, 47}] (* _Robert G. Wilson v_ *)

%o (Python)

%o # download https://stuff.mit.edu/afs/sipb/contrib/pi/pi-billion.txt, then

%o # with open('pi-billion.txt', 'r') as f: pi = f.readline()

%o from sympy import S

%o pi = str(S.Pi.n(3*10**5)).replace('.', '') # alternatively

%o def aupton(terms):

%o global pi

%o alst, idx, seen = [1], 0, {0, 1}

%o while len(alst) < terms:

%o k = 1

%o while int(pi[idx:idx+k]) in seen or pi[idx+k] == '0': k += 1

%o diffn = int(digits_of_pi[idx:idx+k])

%o alst.append(alst[-1] + diffn)

%o seen |= {diffn, alst[-1]}

%o idx += k

%o return alst

%o print(aupton(47)) # _Michael S. Branicky_, Jun 15 2021

%Y Cf. A000796.

%K easy,nonn,base

%O 1,2

%A _Eric Angelini_ and _Alexandre Wajnberg_, Sep 14 2005

%E More terms from _Robert G. Wilson v_, Oct 10 2005