OFFSET
0,2
COMMENTS
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.
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.
Inspired by Eric Angelini's A121805.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..10000
FORMULA
EXAMPLE
The squares are 0, 1, 4, 9, 16, 25, ..., so the comma transform is [0]1, 14, 49, 91, 62, ...
MAPLE
Maple code for comma transform (CT(a)) of a sequence a:
# leading digit, from A000030
Ldigit:=proc(n) local v; v:=convert(n, base, 10); v[-1]; end;
CT:=proc(a) local b, i; b:=[];
for i from 1 to nops(a)-1 do
b := [op(b), 10*(a[i] mod 10) + Ldigit(a[i+1])]; od: b; end;
# Inverse comma transform of sequence A calculated in base "bas": - N. J. A. Sloane, Jan 03 2024
bas := 10;
Ldigit:=proc(n) local v; v:=convert(n, base, bas); v[-1]; end;
CTi := proc(A) local B, i, L, R;
for i from 1 to nops(A) do
if A[i]>=bas^2 then error("all terms must have 1 or 2 digits"); fi; od:
B:=Array(1..nops(A), -1);
if A[1] >= bas then B[1]:= Ldigit(A[1]); L:=(A[1] mod bas);
else B[1]:=10; L:=A[1];
fi;
for i from 2 to nops(A) do
if A[i] >= bas then R := Ldigit(A[i]) else R:=0; fi;
B[i] := L*bas + R;
L := (A[i] mod bas);
od;
B;
end;
# second Maple program:
a:= n-> parse(cat(""||(n^2)[-1], ""||((n+1)^2)[1])):
seq(a(n), n=0..99); # Alois P. Heinz, Nov 22 2023
MATHEMATICA
a[n_]:=FromDigits[{Last[IntegerDigits[n^2]], First[IntegerDigits[(n+1)^2]]}];
a/@Range[0, 83] (* Ivan N. Ianakiev, Nov 24 2023 *)
PROG
(Python)
from itertools import count, islice, pairwise
def S(): yield from (str(i**2) for i in count(0))
def agen(): yield from (int(t[-1]+u[0]) for t, u in pairwise(S()))
print(list(islice(agen(), 84))) # Michael S. Branicky, Nov 22 2023
(Python)
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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Nov 22 2023.
STATUS
approved