login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A367360 Comma transform of squares. 15

%I #36 Jan 05 2024 13:45:07

%S 1,14,49,91,62,53,64,96,48,11,1,11,41,91,62,52,62,93,43,14,4,14,45,95,

%T 66,56,67,97,48,19,9,11,41,91,61,51,61,91,41,11,1,11,41,91,62,52,62,

%U 92,42,12,2,12,42,92,63,53,63,93,43,13,3,13,43,94,64,54,64,94,44,14,5,15,45,95,65,55,65,96,46,16,6,16,46,97

%N Comma transform of squares.

%C To compute the comma transform of a sequence [b,c,d,e,f,...], concatenate the last digit of each term with the first digit of the following term. In other words, these are the numbers formed by the pairs of digits that surround the commas that separate the terms of the original sequence.

%C The comma transform CT(S) of a sequence S of positive numbers maps S into the set F consisting of finite or infinite sequences of positive numbers each with one or two digits. The inverse comma transform CTi maps an element of F to an element of F.

%C Inspired by Eric Angelini's A121805.

%H Michael S. Branicky, <a href="/A367360/b367360.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = 10 * A008959(n) + A002993(n+1). - _Alois P. Heinz_, Nov 22 2023

%e The squares are 0, 1, 4, 9, 16, 25, ..., so the comma transform is [0]1, 14, 49, 91, 62, ...

%p Maple code for comma transform (CT(a)) of a sequence a:

%p # leading digit, from A000030

%p Ldigit:=proc(n) local v; v:=convert(n, base, 10); v[-1]; end;

%p CT:=proc(a) local b,i; b:=[];

%p for i from 1 to nops(a)-1 do

%p b := [op(b), 10*(a[i] mod 10) + Ldigit(a[i+1])]; od: b; end;

%p # Inverse comma transform of sequence A calculated in base "bas": - _N. J. A. Sloane_, Jan 03 2024

%p bas := 10;

%p Ldigit:=proc(n) local v; v:=convert(n, base, bas); v[-1]; end;

%p CTi := proc(A) local B,i,L,R;

%p for i from 1 to nops(A) do

%p if A[i]>=bas^2 then error("all terms must have 1 or 2 digits"); fi; od:

%p B:=Array(1..nops(A),-1);

%p if A[1] >= bas then B[1]:= Ldigit(A[1]); L:=(A[1] mod bas);

%p else B[1]:=10; L:=A[1];

%p fi;

%p for i from 2 to nops(A) do

%p if A[i] >= bas then R := Ldigit(A[i]) else R:=0; fi;

%p B[i] := L*bas + R;

%p L := (A[i] mod bas);

%p od;

%p B;

%p end;

%p # second Maple program:

%p a:= n-> parse(cat(""||(n^2)[-1],""||((n+1)^2)[1])):

%p seq(a(n), n=0..99); # _Alois P. Heinz_, Nov 22 2023

%t a[n_]:=FromDigits[{Last[IntegerDigits[n^2]],First[IntegerDigits[(n+1)^2]]}];

%t a/@Range[0,83] (* _Ivan N. Ianakiev_, Nov 24 2023 *)

%o (Python)

%o from itertools import count, islice, pairwise

%o def S(): yield from (str(i**2) for i in count(0))

%o def agen(): yield from (int(t[-1]+u[0]) for t, u in pairwise(S()))

%o print(list(islice(agen(), 84))) # _Michael S. Branicky_, Nov 22 2023

%o (Python)

%o def A367360(n): return (0, 10, 40, 90, 60, 50, 60, 90, 40, 10)[n%10]+int(str((n+1)**2)[0]) # _Chai Wah Wu_, Dec 22 2023

%Y Cf. A121805, A008959, A002993.

%Y A166499 is the comma transform of the primes, A367361 of the powers of 2, A367362 of the nonnegative integers. See also A368362.

%K nonn,base

%O 0,2

%A _N. J. A. Sloane_, Nov 22 2023.

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 6 18:55 EDT 2024. Contains 374981 sequences. (Running on oeis4.)